Install and use pdnsd for name service caching

The man pages describe pdnsd as a dns proxy daemon capable of saving the contents of its DNS cache to the disk on exit.

The Install

yum install pdnsd-1.2.9a-par.x86_64.rpm
cp /etc/pdnsd.conf.sample /etc/pdnsd.conf

Edit the /etc/pdnsd.conf file.  Under server, change the ip value to your DNS server.

server {
     label= "myisp";
     ip =,; # Put your ISP's DNS-server address(es) here.

Edit the /etc/resolv.conf to point the server to itself. For my test, I commented out everything and only added the one line.


The files

  • /etc/pdnsd.conf is the pdnsd configuration file. The file format and configuration options are described in the pdnsd.conf(5) man page. You can find examples of almost all options in /etc/pdnsd.conf.sample.
  • /var/cache/pdnsd/pdnsd.cache
  • /var/cache/pdnsd/pdnsd.status is the status control socket, which must be enabled before you can use pdnsd-ctl.
  • /etc/init.d/pdnsd (the name and location of the start-up script may be different depending on your distribution.)
  • /etc/resolv.conf
  • /etc/defaults/pdnsd contains additional parameters or options which may be passed to pdnsd at boot time. This saves the hassle of fiddling with initscripts (not available on all distributions).


Start the service and make it autostart.

service pdnsd start
chkconfig pdnsd on

A few ways to test things.

# Run the folling command twice.  See the difference in time it takes to return results.
time nslookup
# dig should return results.
dig @
# netstat should show that port 53 is listening.
netstat -antp | grep 53
# This command will dump to the screen the cache that has been collected.
pdnsd-ctl dump

[root@test]# pdnsd-ctl dump
Opening socket /var/cache/pdnsd/pdnsd.status
07/26 11:52:23 A
07/26 11:52:35 SOA 2016072050 3600 600 1209600 86400
07/26 11:52:26 A
07/26 11:52:23 A


Unlike ncsd, where a restart of the service will delete the cache, the following command will do the trick.  In other words, restarting pdnsd will not delete the cache.

pdnsd-ctl empty-cache

For help.

man pdnsd
pdnsd-ctl help

Howto pdnsd on redhat/centos from Source