Installing a local DNS cache on Ubuntu 11.10

A while ago I noticed that Firebug would report 40-100ms DNS lookups for sites that could not possibly not be in the local DNS. When reloading a page that had just been rendered, the same DNS lookup delays would show up over and over. I could not verify whether it’s an issue with my ISP or the local router. Initially I thought that maybe it’s ipv6 [1], but disabling it did not make the DNS lookups faster or go away, so I went for a local DNS cache.

I couldn’t say it better my self, the complete installation instructions are here [2], the short version:

1. sudo apt-get install dnsmasq
2. edit /etc/dnsmasq.conf and uncomment listen-address=127.0.0.1
3. edit /etc/dhcp/dhclient.conf and modify the prepend line to look like this:
prepend domain-name-servers 127.0.0.1;

 4. edit resolve.conf:

nameserver 127.0.0.1
 nameserver whatever_IP_there_was_already

5. sudo /etc/init.d/networking restart

6. sudo /etc/init.d/dnsmasq restart

[1] IPv6 will slow you down
http://www.belshe.com/2011/05/18/ipv6-will-slow-you-down-dns/

[2] Faster browsing in Linux with local DNS cache
http://www.webupd8.org/2009/12/faster-browsing-in-linux-with-local-dns.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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