josuah.net | panoramix-labs.fr
cv | links | blog | quotes | ascii | tgtimes | gopher | mail | rss
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]].
A list of top and second level domain names. The first one listed is the "technical" domain name.
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 184.108.40.206 2001:19f0:5001:7ac::12 harpyja 220.127.116.11 2a00:5884:8214::16
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.
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
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
"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.