How can we modify the network connection via nmcli command, to use 8.8.8.8 as a DNS server?
Answer
Find the connection name:
# nmcli con show NAME UUID TYPE DEVICE System ens5 8126c120-a964-e959-ff98-ac4973344505 ethernet ens5 System eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 ethernet --Here the connection name is "System ens5". Let's say we want to modify settings for this connection.
Modify the connection to use 8.8.8.8 as DNS server:
# nmcli con mod "System ens5" ipv4.dns "8.8.8.8"We need to reactivate the connection for the change to take effect:
nmcli con up "System ens5"Verify our settings once more:
cat /etc/resolv.conf nmcli -f ipv4.dns con show "System ens5"