Table of Contents

About

pdnsd is an alternative DNS to bind9. The difference is that while bind releases its cached domain resolutions on restart, pdnsd implements a persistent cache 1) by storing previous resolutions to a file on disk.

This tutorial is a short guide on how to make pdnsd a forwarder for bind so that all the requests going through bind will first query pdnsd. The performance benefits are minor for a small datacentre but they increase given a fair amount of clients since previously resolved queries will not have to be resolved again and can be fed to the clients from cache.

pdnsd

The problem with bind working together with pdnsd is that bind listens on an IP address and on the 53 port. It has no option to set a forwarder port, and you can only specify an IP address. In order to make bind and pdnsd work together, we are going to make pdnsd listen on a different loopback address, such as 127.0.0.2 instead of 127.0.0.1 so it will not conflict with bind.

To do that, we edit /etc/pdnsd.conf and change the server_ip variable:

server_ip = 127.0.0.2;

Performance Tweaks

Since we are still here, we can add under the global settings:

neg_rrs_pol=on;
par_queries=1;

and under the server settings:

proxy_only=on;
purge_cache=off;

The options are explained as follows:

In the global section we can also specify something like:

       min_ttl=15m;       // Retain cached entries at least 15 minutes.
       max_ttl=1w;        // One week.
       timeout=10;        // Global timeout option (10 seconds).

In order to hold records for a longer time in cache.

bind

Next, we configure pdnsd as a forwarder in the bind configuration. We load up either /etc/named.conf or /etc/bind/named.conf.options under Debian and add pdnsd as a forwarder:

        forward first;
        forwarders {
                127.0.0.2;
        };

Upon the next restart, bind should query pdnsd first.

1)
That is, in fact, an oxymoron. Caches are not meant to be persistent, they should be released or updated eventually.