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=
3. edit /etc/dhcp/dhclient.conf and modify the prepend line to look like this:
prepend domain-name-servers;
4. edit resolve.conf:
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

[2] Faster browsing in Linux with local DNS cache

Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s