Speed Up Web Browsing by Caching DNS to Your Hard Drive in Ubuntu. 07/28/07
I was sent a web link today that contained a great article about how to speed up web browsing by locally caching DNS name resolution results using dnsmasq. That article is great and it is here: Local DNS Cache for Faster Browsing. I like it because it is equally simple to do and works, but the results (of DNS lookups) are not saved after your PC or laptop “session” is finished.
To clarify, in my opinion, one of the drawbacks (someone correct me if I’m wrong), seems to be that the cache is lost after the laptop or PC is turned off.
To resolve that issue, I prefer to use pdnsd.
As a side note: if you’re looking for a fast, reliable DNS server, I’ve been using OpenDNS for 2 years and the service has been reliable (and arguably provides faster responses than the DNS servers from my ISP). I will be using their DNS server IP’s to configure pdnsd – But you can use any DNS server IP’s you want.
To install pdnsd simply use apt-get by issuing the following command in an Ubuntu Linux terminal window:
sudo apt-get install pdnsd resolvconf
As I mentioned, this will cache the results of DNS lookups to your hard drive and therefore improve your web surfing speed. As a side not, don’t omit the “resolveconf” part (above). If you omit it, then you may run into problems when different applications/programs are trying to access (or change) the configuration file (found at /etc/resolv.conf).
After the install is complete (it should be fast), edit that configuration file by issuing this terminal command:
sudo gedit /etc/pdnsd.conf
One of the significant change I made is:
label = “OpenDNS”;
To compare, here is what my complete edited pdnsd.conf file contains:
# next setting allows ppp/ip-up update the name servers — ABa / 20040213
#Edit these to be your own servers if wished:
label = “OpenDNS”;
# if you installed resolvconf, and status_ctl=on
After saving your changes, you’ll need to restart the server by issuing this terminal command:
sudo /etc/init.d/pdnsd restart
Then of course, test that everything is working. I used the command:
And received resolution in 74ms as below
Then (as I knew this should be cached), I re-issued the above command. In my case name resolution using the cached results was 1ms – Wow!
A great way to help speed up your web surfing.
Not bad for 10 minutes work on a saturday afternoon!