Last Updated on 1 month by Sachin G

In new latest Version of RHEL / Cantos  , there is changes in network configurations and tools. A network manager is a process that manages network services, network connections, and devices. This service can be managed through different way like nmcli 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 Linux 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.

ipaddr

 

  • Display Routing Information

# ip  route

iproute

 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

nmclistatus
(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.

showenp3s0

 

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

connection.autoconnect

Add a DNS Server 

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

ipv4.addresses

 

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

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

addipv4.dns

 

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]

IPV4.address

 

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

ipservices