In Ubuntu 12.04 changes were made to DNS resolving, announced here; also see the resolvconf man page.
Changes state that
resolvconf is a set of script and hooks managing DNS resolution. The
most notable difference for the user is that any change manually done
to /etc/resolv.conf
will be lost as it gets overwritten next time
something triggers resolvconf. Instead, resolvconf uses DHCP client
hooks, a Network Manager plugin and /etc/network/interfaces
to
generate a list of nameservers and domain to put in /etc/resolv.conf.
"I use static IP configuration, where should I put my DNS configuration?"
The DNS configuration for a static interface should go as
“dns-nameservers”, “dns-search” and “dns-domain” entries added to the
interface in /etc/network/interfaces
To try from Older method i.e. prior to Ubuntu 12.04 edition
NOTE: Before you change your DNS settings to use Google Public DNS or
OpenDNS, be sure to backup the current server addresses or settings
somewhere. It is very important that you keep these numbers for backup
purposes, in case you need to revert to them at any time.
Option A: Changing DNS server settings on Ubuntu can be configured through Network Manager.
In the System Settings..., go to Network, then Select the connection for which you want to configure Google Public DNS.
To change the settings for an Ethernet connection, select the Wired tab, then select your network interface in the list. It is usually called eth0
.
To change the settings for a Wireless connection, select the Wireless tab, then select the appropriate wireless network.
Click Edit, and in the window that appears, select the IPv4 Settings or IPv6 Settings tab according to your needs.
If the selected method is Automatic (DHCP), open the dropdown and select Automatic (DHCP) addresses
only instead. If the method is set to something else, do not change it.
In the DNS servers field, enter the Google Public DNS IP addresses, separated by a space:
For IPv4:
8.8.8.8 and/or 8.8.4.4
For IPv6:
2001:4860:4860::8888 and/or 2001:4860:4860::8844
Click Apply to save the change. If you are prompted for a password or confirmation, type the password or provide confirmation. Test your settings here.
Option B: Alternately through CLI
Edit /etc/resolv.conf
:
sudo gedit /etc/resolv.conf
If any nameserver lines appear, backup the IP addresses for future reference.
Replace the nameserver lines with, or ADD the following lines:
For IPv4:
nameserver 8.8.8.8
nameserver 8.8.4.4
You can select your Linked addresses here.
For IPv6:
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844
Save and exit. And again test it from above link.
Source.