Skip to main content
Welcome guest. | Register | Login | Post

telling networkmanager about dns servers

NetworkManager is a nice, easy to use utility. If you're a laptop user who wants to use any WLAN when available, without configuration, it's one of those things you don't want to live compute without.

But what if the some of the dhcp servers in the networks you walk into don't give you correct (or any!) DNS? The first response of any advanced user is to add the IP address of a nameserver to /etc/resolv.conf, but there you will find this:

# generated by NetworkManager, do not edit!

And if you edit it anyway, it will be overwritten as soon as you enter another network.

The solution is to edit /etc/dhclient.conf. Change

prepend domain-name-servers;


prepend domain-name-servers;
prepend domain-name-servers;

Where you should type the ip address of the nameserver you want to use instead of . NetworkManager will now add this nameserver to resolv.conf the next time you join a network, and every time after that too.