Overriding ISP Provided DNS Server
Except if you live in a country where sites are blocked via the ISP’s DNS … and would rather override the ISP’s suggested DNS server with Google’s free DNS server at 126.96.36.199.
Well there’s a good article on how Ubuntu 12.04’s DNS resolving works at http://www.stgraber.org/2012/02/24/dns-in-ubuntu-12-04/.
In short, I managed to override it on my desktop and laptop by appending “nameserver 188.8.131.52” to /etc/resolvconf/resolv.conf.d/head.
For servers, where network manager is not in use, and you use static IP adressing, the DNS server can now go into the /etc/network/interfaces file … under the iface as “dns-nameservers”, as described here: http://www.jansipke.nl/ubuntu-12-04-network-configuration/.
Update: An alternative way to force a fixed DNS server is to hack dhclient … as described here: http://www.liberiangeek.net/2012/05/setup-static-dns-servers-in-ubuntu-12-04-precise-pangolin/ … but this only works for DNS supplied via DHCP.
UPDATE 2012-10-28: … this works until you are on a “captive portal” wifi network that uses “DNS Poisoning” to get you to the acces control page. In those situations, you will need to undo this and use the DNS provided by DHCP, at least until authenticated.
- 2014-05-08 02:38:02+0800 Sem Brignoli But how did u append the # Dns to the /etc/resolvconf/resolv.conf.d/head. if the files quote that all manual changes will be overwritten?
- 2014-05-12 12:33:39+0800 shahada abubakar The “head” and “base” files form a template that are merged together with DNS server addresses into the actual /etc/resolv.conf file. The message about not editing by hand in the “head” file is intended to be read after its been merged into /etc/resolv.conf. 😎 Did you have any problem with your changes disappearing from the “head” file?
- 2014-05-12 12:36:11+0800 Sem Brignoli Mm.. Not yet… I’m trying to get a new more customizable router to make it easier and faster.. If I can I will keep trying.. Thanks thought