Skip navigation

My tweet you just read says the long story short. In case you didn’t come across, Google made DNS a buzzing topic again with Google Public DNS. So I felt like trying a dns cache again. The logic is “If a better DNS server makes things better, DNS cache makes it even better.”

This is more of a note to self than a HOWTO. If your use case atches with mine, feel free to use this.

My use case: I use an HSDPA, mobile broadband connection on Ubuntu 9.04 Jaunty Jackalope.

Install pdnsd with,

$sudo apt-get install pdnsd

Now launch the text editor you hate and add following to /etc/pdnsd.conf

(By default all the parts are commented so just adding this was fine enough for me)


server {
ip=208.67.222.222 , 8.8.8.8;
timeout=5;
interval=30;
uptest=ping;
ping_timeout=50;
purge_cache=off;
}

global {
 perm_cache=5120;
 cache_dir="/var/cache/pdnsd";
 min_ttl=15m;       // Retain cached entries at least 15 minutes.
 max_ttl=1w;        // One week.
 timeout=10;        // Global timeout option (10 seconds).
}

I copied this piece from here and edited ;). Added the global field because defaults were not cool enough for me. And in ip field I’ve put respectively OpenDNS and Google DNS addresses. You can just add one address there. ‘man pdnsd.conf’ will teach you more about the content in the file.

Once you are done editing the configuration file restart pdnsd with

$sudo /etc/init.d/pdnsd restart

Now you should tell the network manager to look for pdnsd for it’s DNS needs.

Right click network manager icon and then follow Edit Connections > Mobile Broadband and choose to edit your preferred network connection.

In Editing <Your Network Connection> dialog box,
[1] Choose IPv4 Settings tab
[2] Choose Automatic Addresses (ppp) Only in Methods Dropdown box.
[3] Set DNS Servers field to 127.0.0.1 (which refers to pdnsd in our case)

And obviously, Apply Changes :P .

If everything went fine, you are now ready to enjoy DNS cache goodness with pdnsd.

You can check how good is it with dig command.

ex:
$dig yahoo.com

run this command twice and compare Query time field.

Note: If you followed all the steps but still it doesn’t work, try restarting pdnsd. If you get following error refer this page

/etc/resolv.conf must be a symlink

Update: Added the global settings for config file.

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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: