Categories

Redhat 7 – Network management nmtui – nmcli

Redhat 7 Static IP configuration

 

Static IP address configuration on Redhat 7


#nmtui​​ – NETWORK CONFIGURATION USING A TEXT USER INTERFACE (NMTUI)
RHEL/CentOS – 7 Network Management – nmcli or nmtui

The NetworkManager text user interface (TUI) tool, nmtui, provides a text interface to configure networking by controlling NetworkManager. The tool is contained with the sub package NetworkManager-tui and is not installed along with NetworkManager by default.

To install NetworkManager-tui, issue the following command as

1

root

#​​ nmtui​​ is an alternative command for​​ nmcli​​ which is based on “command line text user Interface”.

Step 1: first verify the status of network service with below command.

[root@techinformant ~]# systemctl status network.service

redhat-centos-7-static-ip-techinformant-0000

Step 2: To check which network interface is managed by Network Manager, run below command to know connected network devices list.

[root@techinformant ~]# nmcli dev status

redhat-centos-7-static-ip-techinformant-0001
Go to the “
/etc/sysconfig/network-scripts” directory, and locate its configuration file (ifcfg-enp0s3). Create it if not found.
First, need to verity the network settings and its proper configuration as below

[root@techinformant ~]# vim /etc/sysconfig/network-scripts/ifcfg-enp0s3

 

TYPE=Ethernet
BOOTPROTO=dhcp ( This is for DHCP Based IP)
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s3
UUID=d6d59094-f19a-43fa-be38-84164ac2c174
ONBOOT=yes (This is very important to make network device enable on the booting time)
HWADDR=08:00:27:60:08:C3
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

redhat-centos-7-static-ip-techinformant-0002
*******************************************************************************
Method-1 : Static IP address configuration without Network Manager:
********************************************************************************

[root@techinformant ~]# vim /etc/sysconfig/network-scripts/ifcfg-enp0s3

 

TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes

IPV4_FAILURE_FATAL=yes

IPADDR=172.16.3.101
PREFIX=24
GATEWAY=172.16.3.1
DNS=172.16.3.10
IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

NAME=enp0s3

UUID=20078f59-7432-4adb-a667-a051c842c8d6

DEVICE=enp0s3
ONBOOT=yes
PEERDNS=yes

PEERROUTES=yes

IPV6_PEERDNS=yes

IPV6_PEERROUTES=yes

IPV6_PRIVACY=no

redhat-centos-7-static-ip-techinformant-0004

Finally, restart the network service and check the IP address, subnet mask details.

Restart Network Service with below command.

[root@techinformant ~]# systemctl restart network.service

Check the Network service Status.

[root@techinformant ~]# systemctl status network.service

redhat-centos-7-static-ip-techinformant-00011

Verify the IP Address and subnet details.

[root@techinformant ~]# ifconfig

 

enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.16.3.101 netmask 255.255.255.0 broadcast 172.16.3.255
inet6 fe80::a00:27ff:fe03:b18e prefixlen 64 scopeid 0x20<link>

ether 08:00:27:03:b1:8e txqueuelen 1000 (Ethernet)

RX packets 2125 bytes 239217 (233.6 KiB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 2500 bytes 208491 (203.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

redhat-centos-7-static-ip-techinformant-00012

(or)

[root@techinformant ~]# ip add show

redhat-centos-7-static-ip-techinformant-00013

=======================================================================

Method -2 :  Network Manager Text User Interface – Static IP address configuration

=======================================================================

If you want  Network Manager to manage the interface, you can use nmtui (Network Manager Text User Interface) which provides a way to configure Network Manager in a terminal environment.

Before using nmtui, first set “NM_CONTROLLED=yes” in /etc/sysconfig/network-scripts/ifcfg-enp0s3

Now let’s install nmtui as follows ( if it is not installed ) if you have installed “Server with Desktop” features of Linux, this package will install along with them. 

[root@techinformant ~]# yum install NetworkManager-tui

Then go ahead and edit the Network Manager configuration of enp0s3 interface:

[root@techinformant ~]# nmtui

Use the arrow keys to navigate this screen, press Enter to select from a list of values (or fill in the desired values), and finally click OK at the bottom right:redhat-centos-7-static-ip-techinformant-00017

Finally, restart the network service.

Restarting the networking service

[root@techinformant ~]# systemctl restart network.service

Conclusion: This is all about Static IP address configuration on Redhat 7. Now check ping status with internal and external network connectivity status.

 

 

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  

  

  

This site uses Akismet to reduce spam. Learn how your comment data is processed.