Patrick Tudor
(This is from around 2003. In 2011 I switched to NSD and unbound. Consider that a suggestion.)

The transition from BIND to tinydns is quite simple. If you have unique zone files with varying SOA TTLs you might need to clean up the resulting data files by hand later to use advanced djbdns features like automatic serial numbers.

I assume your named.conf is similar to this. If it isn't, you'll have to write your own script to parse it. I once wrote a more elegant script that would check to make sure a zone was marked as master; at least remove the . hint if you use my quick script.

zone "packetexport.com" in {
        type master;
        file "zones/packetexport.com";
};

Now I'll test it out.

% grep ^zone named.conf | cut -f2 -d'"' | wc -l
    2143 
% grep ^zone named.conf | cut -f2 -d'"' | head -8
0.0.127.in-addr.arpa
0.168.192.in-addr.arpa
54.21.66.in-addr.arpa
56.21.66.in-addr.arpa
58.21.66.in-addr.arpa
123pht.com
pht123.com
pht666.com
% 

Instead of keeping my actual dns data inside the tinydns file 'data' I'll keep info organized by domain inside a letter directory. The files in the subdomains are editted and make is updated to simply cat them all together.

cd /var/services/tinydns/root
mkdir a b c d e f g h i j k l m n o p q r s t u v w x y z
mkdir 0 1 2 3 4 5 6 7 8 9

From DJB's site, here is a sample zone transfer.

tcpclient dns1.panic.mil 53 axfr-get panic.mil zone-panic zone-panic.tmp
I combined that line with the list of domain names from my copy of named.conf and the machine starts humming:
% bash
$ for i in `grep ^zone named.conf | cut -f2 -d'"' | sort `; do \
  mybind=157.91.1.1 ; basepath=`echo $i | cut -c1` ; \
  tcpclient $mybind 53 axfr-get $i $basepath/$i.data $i.tmp ; \
  echo $basepath/$i.data ; \
  done

You'll notice that above with axfr-get and below in the Makefile I've suffixed the individual files with a common string, .data. This allows me to disable a domain just by renaming it and to have .bak files without duplicate records.

Makefile (before)

data.cdb: data
        /usr/local/bin/tinydns-data
Makefile (after)
data.cdb: data
        cat ?/*.data > data
        /usr/local/bin/tinydns-data
	touch -r /etc/passwd data.cdb
Because the data file is created as part of the make process, I send the data.cdb file travelling back in time to when the passwd file was last updated. This prevents make from assuming data and data.cdb are both up to date and exiting. If your password file is updated very often, you might have to manually remove data.cdb if you see "already up to date" errors.
Copyright © 2004 Patrick Tudor