nmcli cheat! Setting up network using nmcli in Red Hat 7 in less than a 30 seconds – QUICK & EASY!!!

Red Hat Enterprise Linux 7: Setting up network using nmcli without learning in less than a 30 seconds like a pro!

This procedure will work on server which does not have any NetworkManager connection configured but also on server which has already some NetworkManager connections configured.

1) Find out name of your ethernet device:

ip a
or
nmcli dev

2) redirect first 4 lines of “Example 9” from nmcli-examples man page into a file.

man nmcli-examples | grep -A 4 "Example 9" > nmcli.sh

3) modify new file “nmcli.sh” and update it with desired IP address, gateway, DNS servers and given interface name.

vi nmcli.sh

#!/bin/bash
nmcli con add con-name my-con-em1 ifname eth0 type ethernet ip4 172.16.99.98/24 gw4 172.16.99.1
nmcli con mod my-con-em1 ipv4.dns "8.8.8.8 208.67.222.222"
nmcli con up my-con-em1

4) Modify permissions of a new file “nmcli.sh” to executable and run the script “nmcli.sh”

chmod a+x nmcli.sh
./nmcli.sh

5) Verify IP address:

ip a

6) Verify gateway:

ip r

7) Verify /etc/resolv.conf file:

cat /etc/resolv.conf

8) Verify DNS server functionality:

dig redhat.com

9) Verify if remote destination is pingable:

ping redhat.com

Related Video Tutorials:

Red Hat Enterprise Linux v7 networking

Calculate netmask, network and broadcast address – EASY!

Network Interface naming convention in Red Hat 7

Setting up network without NetworkManager in Redhat 7

Setting up network using NetworkManager and network scripts in Redhat 7

Setting up network using a NetworkManager text user interface (nmtui) in Red Hat 7 – EASY!!!

Setting up network in Red Hat 7 in less than a minute – QUICK & EASY!!!

Setting up network using a NetworkManager command line interface (nmcli) in Red Hat 7

nmcli cheat! Setting up network using nmcli in Red Hat 7 in less than a 30 seconds – QUICK & EASY!!!

Setting up network using a NetworkManager connection editor GUI tool in Red Hat 7 – EASY!!!

Complete Beginners Guide to Linux Network Configuration – GUI & Easy!

NetworkManager connection priority – manage network profile priority in Linux.