20 May 2008
Fixing NetworkManager DNS issue in Ubuntu (Hardy Heron/Gutsy)
Posted by Mikhail Esteves under: LAMP; Tips .
Using NetworkManager to change your DNS to custom servers, like OpenDNS, does not seem to stay between reboots. To fix this, edit the /etc/dhcp3/dhclient.conf file. In there, you will see a line similar to:
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name,
netbios-name-servers, netbios-scope;
First of all, Remove domain-name-servers from that list.
Second, add a line to set your custom DNS servers. For OpenDNS, you would do:
prepend domain-name-servers 208.67.222.222,208.67.220.220;
Update: That doesn’t seem to always work. Easier way out would be to edit /etc/resolv.conf and add your DNS records like this:
nameserver 208.67.222.222
nameserver 208.67.220.220
Then run sudo chattr +i /etc/resolv.conf to stop NetworkManager from overwriting the file.
Your settings should now stay between restarts.
2 Comments so far...
gasull Says:
23 May 2008 at 9:14 pm.
That didn’t work for me, because then the nm-applet takes forever trying to modify /etc/resolv.conf, and I never get a working Internet connection.
The solution is to edit /etc/dhcp3/dhclient.conf with the following line:
prepend domain-name-servers 208.67.222.222,208.67.220.220;
With the IP’s above you will be using the OpenDNS servers.
http://ubuntu.wordpress.com/2006/08/02/local-dns-cache-for-faster-browsing/
lennart Says:
20 September 2008 at 3:40 pm.
First solution did work for me. Tnx!