josuah.net

Configuration of tinydns

To run nameservers, you need to maintain a bunch of interdependent DNS information.

To achieve this, I write small input files that end up in data.cdb, read by the tinydns program:

(text)
rr.domain ┐             (text)                   (binary)
rr.host   │ ┌────────┐          ┌────────────┐
rr.mx     ├─┤data.awk├─> data >─┤tinydns-edit├─> data.cdb
rr.ns     │ └────────┘          └────────────┘
rr.alias  ┘

The workhorse here is data.awk, and the whole chain is controlled by a small Makefile.

/etc/tinydns/rr.domain

A list of top and second level domain names. The first one listed is the "technical" domain name.

z0.is
josuah.net

/etc/tinydns/rr.host

A list of "hostname without domain part", "IPv4", "IPv6". This is the only file where IP are written. This is the book keeping of the servers you address.

Each line of this file leads to a hostname.technical.dom record of type A, AAAA, and PTR:

kuntur   199.247.28.162  2001:19f0:5001:7ac::12
harpyja  80.67.190.196   2a00:5884:8214::16

/etc/tinydns/rr.mx

A list of hostnames that run a mail server. Each domain in "rr.domain" gets one MX record per mail server listed here, with the form: hostname.technical.dom as generated by the "rr.host" list.

We now have matching MX, A, AAAA and PTR entries.

kuntur

/etc/tinydns/rr.ns

A list of hostnames that run a DNS name server. Like for "rr.mx", each domain in "rr.domain" gets one NS record per name server listed here.

kuntur   ns1
harpyja  ns2

/etc/tinydns/rr.alias

A list of regular domain records for your various servers and services. You may

harpyja  www.josuah.net
harpyja  git.josuah.net
kuntur   josuah.z0.is

Uploading data.cdb to nameservers

"make push" update all necessary parts to build data.cdb as seen above, then calls push.awk.

push.awk copies data.cdb to each nameserver in rr.ns, using the IP found in rr.host (so even if your DNS is down, you can still update it from remote). This example sends about 10KB over SSH in total, about 1.50 second over a DSL line for 2 nameservers.