Howto install djbdns with autoaxfr

If you like to setup autoaxfr with djbdns, maybe this howto will help you.

First of all, I assume that you have already installed ucspi-tcp and daemontools. If not, look at D.J. Bernsteins Webseite and install it.

After that, you will have to download autoaxfr and the djbdns Package.
What I’m doing is a basic installation. If you need IPv6 support, watch out, there will be a patch somewhere for djbdns.

Now, add the necessary users:

groupadd dns
useradd -g dns -s /bin/false dnscache
useradd -g dns -s /bin/false tinydns
useradd -g dns -s /bin/false dnslog
useradd -g dns -s /bin/false axfrdns
useradd -g dns -s /bin/false autoaxfr


First of all, we install dnscache to

dnscache-conf dnscache dnslog /etc/dnscache
If you like to distribute dns service to other machines in your network, add a real ip address.
WARNING: You can only use dnscache or tinydns on ONE ip address.

If you need dnscache to resolv domain names for other machines in your network, add the network or every machine by doing this.
touch /etc/dnscache/root/ip/192.168.0

Now it’s time to activate your dnscache.
ln -s /etc/dnscache /service


You will need tinydns if you like to play dns server for domains.
First of all, configure it:
tinydns-conf tinydns dnslog /etc/tinydns
Use the external ip address, the server should be reachable at.

Now it’s time to setup autoaxfr.
autoaxfr-conf autoaxfr dnslog /etc/autoaxfr

You will now have to edit the file /etc/tinydns/root/Makefile
Replace everything with this:
data.cdb: data

data: mydata axfrdata
cat $^ > $@

axfrdata: /service/autoaxfr/root/zones/*
sort -u $^ > $@

Don’t forget to add the file mydata & axfrdata:

touch /etc/tinydns/root/axfrdata
touch /etc/tinydns/root/mydata

After every change of data, a secondary dns or whatever, you’ll have to type make in /etc/tinydns/root/
Just automate this with a cronjob.

*/10 * * * * cd /etc/tinydns/root && make > /dev/null 2>&1

Let’s start tinydns and autoaxfr.

ln -s /etc/tinydns /service
ln -s /etc/autoaxfr /service

Goto /etc/autoaxfr/root/slaves.
Add every domain you would like to distribute as secondary dns by adding the domain name as filename and the ip address of the primary dns controller as content in the file.


DONE! That’s the basic.

If you like to play primary dns server you’ll have to install axfrdns.
axfrdns-conf axfrdns dnslog /etc/axfrdns /etc/tinydns
Use the same ip address as for tinydns.

Set the servers that are allowed to be secondary dns servers.
cd /etc/axfrdns
vi /etc/axfrdns/tcp

insert to following.

You can restrict that to networks, domains and so on. For that, see the axfrdns manuel from djb.

After you have changed the file, type make.

Start axfrdns.

ln -s /etc/axfrdns /service

Comments, questions, whatever are welcome.

One Response to Howto install djbdns with autoaxfr

  1. […] tools to help web application testing and development>> saved by kyleobrien 13 days ago5 votesHowto install djbdns with autoaxfr>> saved by johndoe76 28 days ago3 votesHow to install Bind DNS in a chroot jail>> saved by zagugirl […]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.