Ubuntu 10.04 Server: Quick Fix if your Local DNS Resolution Fails Tips, Tricks and Tutorials 07 AUG 2013

ubuntu-10-logoIf your hosted environment’s DNS services fail rendering your hosted Ubuntu 10.04 server unable to make connections to the outside world (maybe a cURL call to Google or Amazon is required by your system to function), a quick temporary fix is to change your environment’s DNS server settings to point to another, public provider.

To do this, make a change to the /etc/resolv.conf file and enter some new ‘nameserver’ entries which point to public DNS server addresses (which you can usually find with a pretty basic Google search). The most common one to switch to is Google (public DNS servers are at and, though OpenDNS is also a pretty popular one (public DNS servers are at and

In practice:

sudo nano /etc/resolv.conf

The resulting changes should look like this:

#temporary fix
#existing, currently not working entries

The changes are instantaneous, meaning that once you saved the file, those new nameservers will be hit for any outgoing network requests.

Note that this is for Ubuntu 10.04. In Ubuntu 12.04 the handling of resolv.conf changed.

If you want to add your own nameserver address(es) in 12.04, then edit the file /etc/resolvconf/resolv.conf.d/head:

sudo nano /etc/resolvconf/resolv.conf.d/head

and add your nameserver there (eg: Google DNS):


Save the file and then run

sudo resolvconf -u

Again, no reboot is required, though you might have to restart the network-manager:

sudo service network-manager restart

You can test if your fix is working by running the nslookup command against a valid domain:

nslookup www.google.com

If successful you’ll get a print out of the Server and Address being used to perform the lookup, followed by the Name/Address answer.

Related Posts:

About Craig Lotter

South African software architect and developer at Touchwork. Husband to a cupcake baker and father to two little girls. I don't have time for myself any more.