Monday, April 30, 2007

OpenDNS + Bind = Turbocharged DNS resolving

At first I would like to thank my friend Autunu for informing me about OpenDNS.

"OpenDNS offers DNS resolution for consumers and businesses as an alternative to using their Internet service provider's DNS servers. By placing company servers in strategic locations and employing a large cache of the domain names, DNS queries are processed much more quickly, thereby increasing page retrieval speed."

Here is a quick howto to on using open DNS with bind in linux. For those who don't know, bind is the standard domain name server solution in linux.

In Debian/Ubuntu:
#apt-get install bind9

This will install bind server in your PC.

Now we want to use our local server as the DNS server. So open the following file: /etc/resolv.conf, erase all the contents and add the following line:

nameserver 127.0.0.1

Now here is the DNS forwarding trick to OpenDNS servers:

Open the following file /etc/bind/named.conf.options and look for the lines like this:
options {
forwarders {
............;};
};

Change those lines to look like this:

options {
forwarders { 208.67.222.222; 208.67.220.220; };
...
};
Restart bind server:

#/etc/init.d/bind9 restart

Walla! Done. After browsing for some time, you shall start to see the difference.

Here is what happens after you have done the above mentioned things:

When you try to open a web page, first the request is sent to your local server, if the DN of the page is not found then bind forwards that request to OpenDNS server and the DNS is fetched from there. As we know OpenDNS is generally faster that conventional DNS server you get here a speed boost. But then, that DN gets saved in your local bind server. So when you try to visit the page for the second time, your local server can resolve the request by itself and the page loads instantly, again providing another speed boost.

A complete howto on configuring OpenDNS in windows is covered here, in Autunu's blog,

3 comments:

; said...

Thanks for the link back ;) I see that you are being your usual unix-nerd self ^_^

BTW, "Atunu" would be the appropriate spelling, but its alright if the actual message is conveyed anyway.

Anonymous said...

Thanks man. Excellent :)

dhanny said...

great tutorial, i wonder what would be happen when user set their DNS manually such as google dns. are they can bypass opendns.

*pardon for my english

Back to Blogging

After a failed attempt last year to get back to blogging, I'm trying it again this year. I really wanted to get back, but got busy will...