How To Install And Use The djbdns Name Server On Debian Etch - Page 2

On this page

  1. 4 Configuring tinydns

4 Configuring tinydns

All tinydns records are stored in the file /service/tinydns/root/data. This file can either be edited by hand, or you can use some helper scripts that are in the /service/tinydns/root directory, e.g. add-ns, add-host, add-alias, etc.

I will now create some records for the domain using these helper scripts. To use these helper scripts, we must go to the /service/tinydns/root directory:

cd /service/tinydns/root

Now I want this server ( to be a name server for the domain, so I run:


The name of the name server is not directly specifiable. Names are automatically assigned by add-ns itself, following the pattern [a-z], i.e. the name server is named (you don't have to create an A record for, this has been created automatically by the previous add-ns command).

Now let's make the server with the IP address our second name server for the domain - this is


Next let's create A records for the servers that will host - let's name them and


A single IP address can be used only once in an add-host command. To create further hostnames that use the IP address, we must now use the add-alias command:


Let's make the mail exchanger for


The name of the SMTP server is not directly specifiable. Names are automatically assigned by add-mx itself, following the pattern [a-z], in this case It is not possible to specify the distance value (i.e., the priority) for the SMTP server.

After you've created all wanted records, you must run


so that your changes can take effect.

There are no helper scripts to create CNAME and TXT records (e.g. for SPF records), so if you want to create such records, you must modify /service/tinydns/root/data manually, e.g. like this:

vi /service/tinydns/root/data

' a mx ~all:3600

You can use the SPF wizard on to create an SPF record for your domain - the wizard shows the record in BIND and tinydns syntax so that you can copy & paste the record.

Don't forget to run



If you take a look at the /service/tinydns/root/data file...

cat /service/tinydns/root/data

server1:/service/tinydns/root# cat /service/tinydns/root/data
' a mx ~all:3600

... you'll notice that the records begin with signs such as ., =, +, @, ', C, etc. You can find explanations of the different record types on and

Instead of using the add-* helper scripts, you can of course specify all records manually in /service/tinydns/root/data. This way you are more flexible, for example you can assign individual names to your name servers and mail exchangers, e.g. instead of

cd /service/tinydns/root
vi data

#define the authoritative nameserver
#mail exchanger
#IP for machine1,2,3,4,5
#machine5 is also known as ns1
#machine1 is our mailserver
#and our webserver


To test your records, you can use the dig command, e.g.

dig @

dig @ ns

dig @ mx

dig @ txt

dig @


To learn more about djbdns, you should definitely take a look at the following web sites:

Share this page:

2 Comment(s)

Add comment


From: Anonymous

Djbdns looks great, and I have tried over the past three years at least thrice to install it on both OpenBSD and Debain Squeeze, and failed on every occasion! ( I gave up and used BIND each time.)

Sadly, its a complete bitch to get working, which is why many people use BIND instead. As much as I think dnsdjb is far superior to BIND (and bug free), there is little point in touting it when the it is too difficult to install. Installation would be far easier if there were reliable instructions for various O/Ses other than the rather sparse entries on

It would be good to see the packages in Debian Squeeze. Then we may have a chance (ucspi-tcp daemontools daemontools-run are available, but djbdns is not).

From: Anonymous

Sadly again, I used it happily in Debian Lenny while it is not available in Debian Squeeze.  After distro update, I failed to make it up ...