How To Install And Use The djbdns Name Server On Debian Etch - Page 2
On this page
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 example.com using these helper scripts. To use these helper scripts, we must go to the /service/tinydns/root directory:
Now I want this server (192.168.0.100) to be a name server for the example.com domain, so I run:
./add-ns example.com 192.168.0.100
The name of the name server is not directly specifiable. Names are automatically assigned by add-ns itself, following the pattern [a-z].ns.name, i.e. the 192.168.0.100 name server is named a.ns.example.com (you don't have to create an A record for a.ns.example.com, this has been created automatically by the previous add-ns command).
Now let's make the server with the IP address 192.168.0.101 our second name server for the example.com domain - this is b.ns.example.com:
./add-ns example.com 192.168.0.101
Next let's create A records for the servers that will host example.com - let's name them server1.example.com and server2.example.com:
./add-host server1.example.com 192.168.0.100
./add-host server2.example.com 192.168.0.101
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:
./add-alias www.example.com 192.168.0.100
./add-alias example.com 192.168.0.100
Let's make 192.168.0.100 the mail exchanger for example.com:
./add-mx example.com 192.168.0.100
The name of the SMTP server is not directly specifiable. Names are automatically assigned by add-mx itself, following the pattern [a-z].mx.name, in this case a.mx.example.com. 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:
[...] 'example.com:v=spf1 a mx ~all:3600 Cftp.example.com:www.example.com
You can use the SPF wizard on http://old.openspf.org/wizard.html 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...
server1:/service/tinydns/root# cat /service/tinydns/root/data
'example.com:v=spf1 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 http://www.fefe.de/djbdns/#recordtypes and http://www.pjvenda.org/linux/doc/tinydns/.
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. ns1.example.com instead of a.ns.example.com:
#define the authoritative nameserver .example.com::ns1.example.com #mail exchanger @example.com::mail.example.com #IP for machine1,2,3,4,5 =machine1.example.com:188.8.131.52 =machine2.example.com:184.108.40.206 =machine3.example.com:220.127.116.11 =machine4.example.com:18.104.22.168 =machine5.example.com:22.214.171.124 #machine5 is also known as ns1 +ns1.example.com:126.96.36.199 #machine1 is our mailserver +mail.example.com:188.8.131.52 #and our webserver +www.example.com:184.108.40.206
To test your records, you can use the dig command, e.g.
dig @192.168.0.100 example.com
dig @192.168.0.100 ns example.com
dig @192.168.0.100 mx example.com
dig @192.168.0.100 txt example.com
dig @192.168.0.100 www.example.com
To learn more about djbdns, you should definitely take a look at the following web sites: