Google launched its public DNS service in the end of 2009 and now it is time to say that is fast and reliable enough to start using it with your Ubuntu. See below how to configure your DNS settings and point your Ubuntu to Google’s DNS entry.
As far as Ubuntu is one of Linux distributions DNS entries are stored in /etc/resolv.conf text file that is read by operating system in real-time. If you need to point your Ubuntu to Google DNS quickly and easy just execute the following command that adds one line to /etc/resolv.conf:
sudo echo "nameserver 126.96.36.199" > /etc/resolv.conf
At the same time this is temporary solution as network manager coming with any Ubuntu by default for easy network settings configuration, overwrites resolv.conf according to network connection setup either wired or wireless. Therefore to set up Google Public DNS as permanent DNS entry in your Ubuntu you have to edit your network connection using network manager and set up static DNS entry. Just follow below screenshots (they are taken on my Ubuntu Lucid Lynx 10.04 LTS):
1. Go to Ubuntu menu –> System –> Preferences –> Network Connections and select network connection you use to get access to Internet:
2. Press Edit button and go to IPv4 Settings tab. Set DNS Servers field to 188.8.131.52 and Search Domains to google.com.
Once you pressed Apply button settings will be saved. Reset your network connection through network manager (disconnect and connect) to make it generate new /etc/resolv.conf file and start using Google Public DNS in your Ubuntu.