How to install DJB’s dnscache on Ubuntu 10.10

I recently attempted to install DJB’s dnscache from packages on Ubuntu 10.10. It seemed to be a bit broken and I wasn’t interested in installing from source. This is a quick set of steps to get it running.

First, install the dnscache-run package. This will install all the dependencies required. (daemontools daemontools-run djbdns dnscache-run ucspi-tcp)

apt-get install dnscache-run

svscan looks in /service for programs to start. This doesn’t seem to get created during the install, fix it with this:

mkdir /service
ln -s /etc/dnscache /service

Now, lets configure dnscache for our environment:

Edit /etc/dnscache/env/IP with the IP you want dnscache to listen on. The default is That won’t work for hosts on our network.

vi /etc/dnscache/env/IP

Now we need to tell dnscache what networks are allowed to query the cache. It’s as simple as touching a file.

touch /etc/dnscache/root/ip/192.168

We’ve allowed access to all of If we wanted to further restrict we could do this:

touch /etc/dnscache/root/ip/192.168.1

The default cache size is 1MB. I like to boost this to 100MB.

echo 100000000 > /service/dnscache/env/CACHESIZE
echo 104857600 > /service/dnscache/env/DATALIMIT

Now we need to start svscan, which will keep dnscache running:

/sbin/start svscan

That’s it, our cache should be up and ready to answer queries. Read more about dnscache here:

The main reason I use dnscache is the memory usage. BIND tends to get very bloated when used strictly as a cache and as a result the system it’s running on suffers. Dnscache is very strict about memory usage and removing old cache items.

This entry was posted in Configs, HowTo and tagged , , , , , . Bookmark the permalink.