Home page
Articles for Windows, Linux, OS X
Mac tips and articles
Mac tips
Windows 8 tips and articles
Windows 7 tips and articles
Vista Tips
XP Tips
Linux tips and articles
Read the blog
Online store
Windows, Linux, OS X programs

Linux tips and tweaks

Get a faster more reliable internet with OpenDNS or Google

Whenever we want to visit a website on the internet we type something like www.google.com into the web browser's address box and then it appears in a second or two. A website address like www.google.com is actually just a convenience for us people because they are easy to remember. You may be surprised to learn that computers don't actually use them. Instead, they use IP addresses to identify other computers, such as a web server, that they want to communicate with.

Every computer that is connected to the internet is given a unique IP address, which is a series of numbers to identify it. An IP address consists of four numbers that look like this: (traditionally it has been four, but IP addresses with six numbers are being introduced because we're running out of addresses with four numbers there are are so many computers and devices on the internet).

When you enter the address of a website like www.google.com the web browser must find out the IP address of the computer you want to access. Once it knows the IP address it can establish communications with it and request the web page.

The web browser accesses a domain name server (DNS), which is a special computer on the internet that hosts a database that contains of all the website names like www.google.com, and their corresponding IP addresses. The web browser sends the address to the domain name server and then receives the IP address that it sends back.

Your ISP will run a domain name server for its users and your computer will autmatically use it. Unfortunately, some ISPs can get very busy at peak times and the response can be slow, and this means that web browsing is also slow because each address you enter must first be looked up at the domain name server. Your ISP's domain name server might even be unavailable occasionally, and then you won't be able to access any websites because the IP addresses cannot be found

You don't have to use your ISP's domain name server though and you can in fact use another one - if you know it's address. OpenDNS is a free domain name server that anyone can use. It aims to be faster and more reliable than your ISP's domain name server, and what's more, it has some cool features too. When your computer uses OpenDNS to convert text addresses into IP numbers it will do it slightly more quickly and this makes using the web more responsive, especially when your ISP is overloaded with DNS requests.

It is not the only service of this type and Google also runs free DNS servers that anyone can use instead of the ones that their ISP run.

There are two ways to get Linux to use OpenDNS domain name servers, and the first method shows how easy it is in Ubuntu. The second method is a bit more general, so if you have some other flavour of Linux, you might find it useful.

Method 1

Ubuntu DNS serversRight click the networking icon in the top panel and select Edit Connections. Select the connection method you use, such as Wired, and you'll see an item listed, such as Auto eth0 on the Wired tab. Select it and click the Edit button.

Select the IPv4 tab and set the method to Automatic (DHCP) addresses only. This enables the DNS servers box below and you can now enter the ones you want to use.

To use OpenDNS servers, enter, or for Google's DNS servers, enter, - that's two IP addresses separated by a comma. There usually are two DNS servers - a primary one and a secondary one. Click the Apply button and the job's done.

You might need to click the network icon to reconnect to the network or restart the system. If you have used the OpenDNS servers, you can go to http://welcome.opendns.com in a web browser to check that it is working. You'll see a message confirming it.

Method 2

The DNS servers to use are stored in a file called /etc/resolv.conf and you need to edit this in a text editor. Just replace the DNS server(s) listed with either OpenDNS or Google servers.

Open a Terminal window and then type sudo gedit /etc/resolv.conf to load the file into Gedit. Of course, you can use vi, nano or whateber text editor you prefer.

Most people connect to the internet through a router. Unless the router is manually configured with fixed DNS server addresses, when it is powered it will automatically get various settings from your ISP, such as the IP addresses of the DNS servers to use - there are usually two. When Linux starts up, it will automatically use the router's IP address as the DNS server (because the router passes on requests to the real DNS server). The /etc/resolv.conf file may therefore look something like this:

# Generated by NetworkManager

All you need to do is to replace the IP address with the alternative DNS server and then add another line to specify the second DNS server. Here's what it will look like for OpenDNS:

# Generated by NetworkManager

If you want to use Google's DNS servers, just replace the IP addresses above with and

Save the file and that's it. You're now using OpenDNS or Google domain name servers. If you have used the OpenDNS servers, you can go to http://welcome.opendns.com in a web browser to check that it is working. You'll see a message confirming it.

If the settings won't stick...

A problem you may have is that the settings won't stick and when you restart Linux, the /etc/resolv.conf gets overwritten with the default setting. The solution is to back up the original file (just in case):

sudo cp /etc/resolv.conf /etc/resolv.conf.auto

Now edit the /etc/dhcp3/dhclient.conf file:

sudo gedit /etc/dhcp3/dhclient.conf

This file gets all the network information, including the domain name servers to use. We need to add a line to the end like this:

prepend domain-name-servers,;

This is an instruction to put our domain name servers first in the list. Of course, you can use OpenDNS servers instead of the Google ones in the line above. Replace them with,

Go to Linux tips index...