Home / Linux  / CentOS  / Network Configuration with nmcli and Network Manager on CentOS 7 / RHEL 7

Network Configuration with nmcli and Network Manager on CentOS 7 / RHEL 7

In new latest Version of RHEL / Cantos 7 , there is changes in network configurations and tools. Network Manager is a process to manage network services and network connection and devices. This service can be managed through different way like and other command line and graphical tools.

Here in this tutorial article, I am going to explain about uses of network configuration and host-name, ip related tools.

 

Showing  IP Addresses Information

IP command will be used to show device and network address information. List of below commands will generate different type of customize output of address information.

  • Show all interfaces IP address and Netmask information.

# ip addr

Some option of ip addr command as below, execute below command and get specific interface information.

# ip addr show
# ip addr show [Device Name ]

Device Name  :  Network interfaces in can be named as eth0,eth1 and enp2s0.The interface name is based on device topology , firmware and device type like Ethernet interface begin with en and WLAN interface will begin with wl name.

The above command will show all interface device information.

(a) UP showing as active interface.

(b) MAC address of device.

(c) Inet line shows the IPv4 and Netmaks or Prefix information.

(d) Broadcast address

(e) Scope and device name are also on the same line.

(f) This will show IPv6 information.

rhel 7 nmcli networkmanager.service network configuration manager ip4.address centos 7

 

  • Display Routing Information

# ip  route

rhel 7 nmcli networkmanager.service network configuration manager ip4.address centos 7

 Network Device Configuration with nmcli  and Network Manager

NMCLI General Command and its usages.

(a) Below command wil list all connections .

# nmcli con show

(b) Active connection will show with  –active option.

# nmcli con show  --active

(c) You can check device status and details.

# nmcli  dev status

(d) It will show general status of Network Manager.

# nmcli general status

rhel 7 nmcli networkmanager.service network configuration manager ip4.address centos 7
(e) Now nmcli  will show configuration of connection through below command.

# nmcli con show  “CONNECTION NAME or UUID”

The output of below command is completed. some of content screecast image is below.

rhel 7 nmcli networkmanager.service network configuration manager ip4.address centos 7

 

Add  new IP or update Network interface information on existing interface with nmcli

Here we are going to update or change IP address on existing active interface. Be careful with live servers before doing this , you should aware what you are doing, it can be lost network connection and lost remote server , you should have good system administrator knowledge.

Turn on autoconnect 

Below command will  be enable  network device on boot .

# nmcli con mod  “CONNECTION NAME ” connection.autoconnect yes

rhel 7 nmcli networkmanager.service network configuration manager ip4.address centos 7

Add a DNS Server 

# nmcli con mod  “CONNECTION NAME” ipv4.dns [DNS IP]

rhel 7 nmcli networkmanager.service network configuration manager ip4.address centos 7

If you want to add one more DNS as a secondary DNS, you can use +/- operator in the argument ,like below command.

# nmcli con mod “CONNECTION NAME”  +ipv4.dns [DNS IP]    rhel 7 nmcli networkmanager.service network configuration manager ip4.address centos 7

Add manual static IP address and gateway

# nmcli con mod "CONNECTION NAME” ipv4.addresses [IP ADDRESS/PREFIX  GATEWAY]

Here 192.168.0.10 is IP Address and 24 is Prefix or net mask and 192.168.0.2 is gateway  which I have set .

If you want to add a secondary IP address without a gateway , you can use as below.

# nmcli con mod “CONNECTION NAME”  +ipv4.addresses [IP ADDRESS/PREFIX]

rhel 7 nmcli networkmanager.service network configuration manager ip4.address centos 7

 

Now if your connection  has been done , these command will save your command setting to the configuration , it will reflect and worked after activated or deactivated connection. Here are reload configuration and activated and deactivated connection command below.

rhel 7 nmcli networkmanager.service network configuration manager ip4.address centos 7

A Linux Geek with Freelance Contributor, Server/ Cloud Administrator having 6+ Years experience in Open Source and Cloud Technologies.

Review overview
NO COMMENTS

POST A COMMENT