On 2020-02-17 03:36, Tom Horsley wrote:
I keep seeing signs that "network" will someday disappear entirely and I'll be forced to use NetworkManager, so the first question I haven't been able to find an answer for:
What is the "proper" way to setup a network connection using nmcli which will get an IP via DHCP, but will ignore the DHCP provided DNS and use a different DNS server specified manually? (I can do it using techniques like chattr +i on /etc/resolv.conf, but that isn't exactly "proper" :-).
A google search sent me here. https://www.certdepot.net/rhel7-configure-ipv4-addresses/
With the advice...
You can’t remove a DNS server provided through DHCP with the previous command (with the -ipv4.dns option for example), you will get this error message: “Error: failed to remove a value from ipv4.dns: the property doesn’t contain DNS server ‘192.168.1.1’.”. If you want to set your own DNS configuration in this context, type:
# nmcli con mod net-eth0 ipv4.ignore-auto-dns yes
Note: You get the same result by specifying PEERDNS=no in the network configuration files.