HOW-TO: Basic installation of Daniel J. Bernstein's djbdns (TinyDNS) on Ubuntu Linux

When I first went looking for HOW-TO docs concerning installing Daniel J. Bernstein's djbdns on Ubuntu, I could not find such. What I did find was plenty of docs on how to download and compile Mr. Bernstein's djbdns code from source, however Ubuntu has very kindly created packages of everything you need for installing djbdns.

Finally I found this page which gave a good solid and CONCISE configuration guideline WITHOUT elaborating on compiling djbdns. So I intend this to be a supplemental guide for Steve Litt's documentation. Specifically on that page, search for "Set up in the proper order" and that is the golden / CONCISE steps I am referring to.

First, install the packages needed for djbdns:

# apt-get install djbdns dnscache-run

Note for Ubuntu 9.04: This version of Ubuntu did not start Mr. Bernstein's architecture (daemontools) service, though 9.04 installs it as a service. I had to manually start the service, and I did so in /etc/rc.local as follows:

#Start daemontools service which in turn starts djbdns
/sbin/start daemontools

With Ubuntu 9.10 and 10.04, this workaround is not necessary as Ubuntu both installs and starts the service.

Then reboot the system.

Next, set up and test DNSCache:

# echo >/etc/dnscache/env/IP
# touch /etc/dnscache/root/ip/10.10.12
# chmod 0600 /etc/dnscache/root/ip/10.10.12
# svc -t /etc/service/dnscache
# perl -p -i -e 's/nameserver' /etc/resolv.conf

Or you may hand edit for the last line... I prefer to do so myself rather than having perl do the editing. The file should look similar to this:


Next, on to setting up tinydns on

For this next step, Ubuntu has an omission in their packages of djbdns. Mr. Bernstein requires three ID's be created for use with djbdns, however Ubuntu only creates two of the three. For now, this single line of code will add the missing ID:

# adduser --quiet --system --force-badname --shell /bin/false --group --home /nonexistent --no-create-home Gtinydns

And please chime in on this bug report in the Ubuntu tracker: Gtinydns id not created, but two other id's created

Once the ID is created, you may proceed with the following command.

# tinydns-conf Gtinydns Gdnslog /etc/tinydns

Then enable the tinydns service:

# ln -s /etc/tinydns /etc/service

Finally, connect dnscache to tinydns:

# echo>/etc/dnscache/root/servers/
# echo>/etc/dnscache/root/servers/

And now you have a basic djbdns configured! Fill in your static zone information, run "make", and you should be good to go!

Change IP example

Thanks for posting this.

It would be even more helpful if you selected a different IP prefix for your example instead of the 10.10.10 so we can quickly realize when it should be reversed or not...


I looked over another djbdns installation on a different Class C subnet and updated this document.

Basically if it does not say "", then the addressing is forwards. You only reverse the numbering when you see "".

Point taken...

;-) Way back when I chose Class C / 10.10.10.x for our internal LAN, thus find myself always defaulting to that.

I will update the examples shortly. Thank you for taking the time to make the suggestion.

Great write-up

Thanks for posting -- especially the bits about the missing user and the link to the appropriate Bug. Got me running in like 5 minutes flat.

Thank you!

Greetings Brian, I am glad to hear this blog entry assisted you with setting up djbdns on Ubuntu. Thank you for leaving your comment! :-)