Linux Commands - Modify Network Manager using the nmlci command

by
Jeremy Canfield |
Updated: July 14 2023
| Linux Commands articles
The nmcli connection modify command can be used to modify a network interface. Before using the nmcli modify command, you probably will want to use the nmcli connection show command to get the name and UUID of the network interface.
nmcli connection show
. . .
NAME UUID TYPE DEVICE
eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 ethernet eth0
Here is an example of how to change the DNS servers of the interface.
nmcli connection modify eth0 ipv4.dns "10.124.141.51,10.112.42.10"
nmcli device reapply eth0
The resolvectl command can then be used to show the current DNS server being used.
~]# resolvectl
Global
Protocols: LLMNR=resolve -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
Link 2 (ens192)
Current Scopes: DNS LLMNR/IPv4
Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 10.124.141.51
DNS Servers: 10.124.141.51 10.112.42.10
Did you find this article helpful?
If so, consider buying me a coffee over at