Google Public DNS is a free, global Domain Name System (DNS) resolution service, that you can use as an alternative to your current DNS provider.By using Google Public DNS you can speed up your browsing experience,improve your security and get the results you expect with absolutely no redirection.
Setting up Google Public DNS in Ubuntu

1. Open Network Connections in System->Preferences menu,select the connection Wired or Wireless which you want to configure the Google Public DNS.

google_plublic_dns

2. Select your network interface in the list and click Edit,then select IPV4 Settings tab
google_plublic_dns2

3.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.
Then,type the Google Public DNS IP addresses in the DNS servers area,separated by a space: 8.8.8.8 8.8.4.4
4. Click Apply and save the change.

Test that the Google DNS resolver is working:

1. From your browser, type in a hostname, such as http://www.google.com. If it resolves correctly, bookmark the page, and try accessing the page from the bookmark. If both of these tests work, everything is working correctly. If not, go to step 2.
2. From your browser, type in a fixed IP address. You can use http://18.62.1.6/ (which points to the website http://eecs.mit.edu/) as the URL*. If this works correctly, bookmark the page, and try accessing the page from the bookmark. If these tests work (but step 1 fails), then there is a problem with your DNS configuration; check the steps above to make sure you have configured everything correctly. If these tests do not work, go to step 3.
3. Roll back the DNS changes you made and run the tests again. If the tests still do not work, then there is a problem with your network settings; contact your ISP or network administrator for assistance.

The original from:http://code.google.com/intl/en/speed/public-dns/docs/using.html