Fixing NetworkManager DNS issue in Ubuntu (Hardy Heron/Gutsy)
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 220.127.116.11,18.104.22.168;
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 22.214.171.124 nameserver 126.96.36.199
sudo chattr +i /etc/resolv.conf to stop NetworkManager from overwriting the file.
Your settings should now stay between restarts.