the djb way

djbdns


tinydns, a DNS publisher

If you are responsible for serving DNS information for your domain, tinydns is the server to use for publishing this information.

By "responsible for", we mean you have a DNS "delegation of authority" for the domain. Typically this means you or your organization have paid to register your domain name with some registry or your ISP. You have then instructed your registrar that you will be publishing DNS information from your own servers. They should then put delegation of authority records into their servers, pointing to your DNS server(s) running tinydns.

On-line domain registry services usually have web-based interfaces for purchasing domains and making the necessary DNS delegation entries yourself.

Setting up a tinydns service for your domain is then almost as easy as setting up a dnscache service. As usual, you will first need to have a non-root user account to run the service. Add an account named "tinydns" to your system, group "nofiles", disabled password and login shell.

Then decide what publicly accessible IP address your tinydns server will "listen" to for queries. Substitute the address of your server's external interface for the "1.2.3.4" we use in the example below.

All right, then? Simply run tinydns-conf:

# tinydns-conf tinydns multilog /var/svc.d/tinydns 1.2.3.4

This automatically installs a daemontools service definition in the directory /var/svc.d/tinydns. Take a look at the run script there to see how it works.

It also installs a logging service in the log subdirectory, the "run" script in the usual /var/svc.d/tinydns/log/run:


#!/bin/sh
exec setuidgid multilog multilog t ./main

If you prefer the consistency of /var/multilog for your log files, modify the script to read:


#!/bin/sh
exec setuidgid multilog multilog t /var/multilog/tinydns

Then setup the log directory:

# mkdir -p /var/multilog/tinydns
# chown multilog /var/multilog/tinydns

Now you can activate the service:

# ln -s /var/svc.d/tinydns /service/tinydns

At this point, the service is running, but tinydns knows nothing. You now need to tell tinydns about the data it should publish.

DNS data for your domain will be entered as plain text into the file named data, in the root subdirectory of the service. The plain text is then compiled into a cdb database, saved to the file named data.cdb.

There are a couple ways you can make entries into the data file:

To get started, it is usually convenient to use the add-* utilities for the first few records. Once this is done, a text editor is easier, using cut-and-paste to quickly make new records in the proper format.

So first, add an NS record, telling the world this server is a nameserver for your domain:

# cd /service/tinydns/root
# ./add-ns example.org 1.2.3.4

Then add the hostname records for your domain:

# ./add-host alice.example.org 1.2.3.4
# ./add-host betty.example.org 1.2.3.5
# ./add-host carol.example.org 1.2.3.6

If you have a mailserver for your domain, add an MX record:

# ./add-mx example.org 1.2.3.4

Maybe you have aliases for some of your hosts:

# ./add-alias www.example.org 1.2.3.5

Whenever your modifications to the data file are complete, run make:

# make

This compiles the plain-text data file into data.cdb. The changes made to the data will be available to tinydns immediately, no need to restart the service.

Is the server working? Check the entries with the tinydns testing utility, dnsq:

$ dnsq ns example.org 1.2.3.4
2 example.org:
64 bytes, 1+1+0+1 records, response, authoritative, noerror
query: 2 example.org
answer: example.org 259200 NS a.ns.example.org
additional: a.ns.example.org 259200 A 1.2.3.4
$ dnsq a betty.example.org 1.2.3.4
1 betty.example.org
86 bytes, 1+1+1+1 records, response, authoritative, noerror
query: 1 betty.example.org
answer: betty.example.org 86400 A 1.2.3.5
authority: example.org 259200 NS a.ns.example.org
additional: a.ns.example.org 259200 A 1.2.3.4
$ dnsq mx example.org 1.2.3.4
15 example.org:
101 bytes, 1+1+1+2 records, response, authoritative, noerror
query: 15 example.org
answer: example.org 86400 MX 0 a.mx.example.org
authority: example.org 259200 NS a.ns.example.org
additional: a.mx.example.org 86400 A 1.2.3.4
additional: a.ns.example.org 259200 A 1.2.3.4

Looks great, tinydns is now serving!

See the next section for more information on editing the data file manually.


Copyright © 2002, 2003, 2004, Wayne Marshall.
All rights reserved.

Last edit 2004.10.04, wcm.