network manager: how to stop nm updating /etc/resolv.conf
One way to stop Network Manager from adding dns-servers to /etc/resolv.conf
file is to do this:
First open the nm conf file /etc/NetworkManager/NetworkManager.conf
:
sudo vim /etc/NetworkManager/NetworkManager.conf
And add this to the [main]
section:
dns=none
Save and exit.
My personal favorite is to use line supersede domain-name-servers
in /etc/dhcp/dhclient.conf
. No matter what dns access point provides , your ubuntu will always use those dns specified in dhclient.conf
Sample from my file
#send host-name "andare.fugue.com";
send host-name = gethostname();
#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
#send dhcp-lease-time 3600;
#supersede domain-name "fugue.com home.vix.com";
supersede domain-name-servers 208.67.220.220;
#prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers,
dhcp6.fqdn, dhcp6.sntp-servers;
#require subnet-mask, domain-name-servers;