Bootstrap FreeKB - Network Manager (nmcli) - Modify Network Interface using the nmcli modify command
Network Manager (nmcli) - Modify Network Interface using the nmcli modify command


apt-get, dnf or yum can be used to install the NetworkManager package which includes nmcli.

dnf install NetworkManager

 

And then start and enable NetworkManager.

systemctl start NetworkManager
systemctl enable NetworkManager

 

The nmcli connection show command can be used to list your network interfaces.

~]# nmcli connection show
NAME  UUID                                  TYPE      DEVICE 
eth0  5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03  ethernet  eth0

 

Specifying a connection will show the settings for the connection.

]# nmcli connection show eth0 | grep -i dns
connection.mdns:                        -1 (default)
connection.dns-over-tls:                -1 (default)
ipv4.dns:                               10.14.15.7
ipv4.dns-search:                        example.com,stage.example.com
ipv4.dns-options:                       --
ipv4.dns-priority:                      0
ipv4.ignore-auto-dns:                   no
ipv6.dns:                               --
ipv6.dns-search:                        --
ipv6.dns-options:                       --
ipv6.dns-priority:                      0
ipv6.ignore-auto-dns:                   no
IP4.DNS[1]:                             10.14.15.7
IP4.DNS[2]:                             --

 

The nmcli connection modify <interface name> command can be used to modify one or more settings.

nmcli connection modify eth0 ipv4.dns "10.14.15.7,10.14.15.8"

 

After making a change to a device, the /etc/resolv.conf file may reflect the change. The nmcli device reapply <interface name> command can be used to get /etc/resolv.conf refreshed to have the change you made.

]# nmcli device reapply eth0
Connection successfully reapplied to device 'eth0'.

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 4b02cc in the box below so that we can be sure you are a human.