Linux

Setting Up Ubuntu to Use Google’s DNS

February 21, 2010

With the blazing speeds offered by Google’s open DNS servers there is absolutely no reason to not use them. Setting up your Ubuntu or any other Debian based Linux distribution to use these DNS servers is incredibly easy. I will be showing you the command line method as it will work on both your desktop and server based installs.

Let’s start off by recapping on how to set up your network connection. You will need to ensure you are not using DHCP, if you are then you would simply set the DNS in your router or modem and your box will use those settings. Your network config file can be edited by typing the following command:

sudo nano /etc/network/interfaces

Your text editor will open up and you will see something like:

iface eth0 inet static
address 192.168.1.5
netmask 255.255.255.0
gateway 192.168.1.1

You may have other settings in there such as broadcast or network, we’re not too worried about these settings were are just making sure that you are not configured to use DHCP. Despite what you may expect, you will not be setting your DNS servers here.

If your config looks more like the following then you are using DHCP:

auto eth0
iface eth0 inet dhcp

So now that we’ve established that you are manually configuring your static connection, we are going to edit the resolv.conf file and set your DNS servers.

sudo nano /etc/resolv.conf

The modify the file to match the following:

nameserver 8.8.8.8
nameserver 8.8.4.4

You can, of course, leave the search directive at the top of the file intact if it has been set.

After saving and closing the file, restart your network interface to ensure that the changes have been put into affect.

sudo /etc/init.d/networking restart

Now you will no longer be hindered by your DNS.

Only registered users can comment.

  1. OpenDNS is faster in in the UK , all so I don’t like use in one company for all my internet needs.
    but thanks for the share .

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.