How to configure Network Using NMCLI in RHEL7
How to configure Network Using NMCLI in RHEL7

CALL NOW FOR FREE CONSULTATION

+91 9983340133, +91 9001997175

grras

How to configure Network Using NMCLI in RHEL7

Nmcli is a command-line tool for controlling and getting network status. The main nmcli’s usage is on servers, headless machines or just for power users who prefer the command line for changing the network parameter. In Red Hat Enterprise Linux 7, the default networking service is provided by NetworkManager, which is a dynamic network control and configuration daemon that attempts to keep network devices and connections up and active when they are available. The basic format of a command is as follows:

nmcli [ OPTIONS ] OBJECT { COMMAND | help }

In this blog we will configure network with the help of NMCLI tool. First of all we will install the Network Manager Package and make it enable as following command:
# yum install NetworkManager
# systemctl status NetworkManager
# systemctl start NetworkManager
# systemctl enable NetworkManager

Steps For configure Network Manager:

1. First step in network configuration is to show the overall status of NetworkManager:

# nmcli general status

2. Now to show all connections or to list the currently available network connections run the following command:

# nmcli connection show

3. Now to add an Ethernet configuration profile with dynamic IP configuration, a command in the following format can be used:

# nmcli con add con-name “my-office” type ethernet ifname “eth0”

4. Now if we want to add an Ethernet connection with static IPv4 configuration, a command in the following format can be used:

# nmcli con add type ethernet con-name my-office ifname eth0 ip4 10.10.10.10/24 gw4 10.10.10.254
IPv6 address and gateway information can be added using the ip6 and gw6 options.

5. To bring up the Ethernet connection, issue a command as follows:

# nmcli con up my-office
6. Now we learn to modify the network interfaces with the NMCLI command. Here we are goining To set IPv4 DNS server address

#nmcli con mod my-office ipv4.dns “192.188.8.8”
7. Now to bring up the new Ethernet connection, issue a command as follows:

# nmcli con up my-office

Leave a Reply

Your email address will not be published. Required fields are marked *