Creating tinydns (djbdns) records
Tinydns records are created using a text configuration file. It also comes with some helper scripts to make it easier to create some basic records. This tutorial will cover each of those helper scripts. If you followed our tutorial on setting up tinydns, these helper scripts should be located in /service/tinydns/root/. After running all these commands you need to run make in order to make the changes come into effect.
add-ns
This should be the first command you run for a new domain. It creates the domain's SOA record, an NS record and an A record for the NS record.
add-ns <domain> <ip>
Replace <domain> with the domain you are setting up.
Replace <ip> with the IP address of the name server you are setting up
The NS record that the command creates will be x.ns.<domain>. x will be the first unused letter of the alphabet. For example:
add-ns professortux.com 1.2.3.4
This command will create the following
- SOA record for the domain professortux.com
- NS record with the name a.ns.professortux.com
- A record pointing a.ns.professortux.com to 1.2.3.4
add-childns
Th add-childns command is exactly the same as add-ns except it does not create the SOA record. For example:
add-childns professortux.com 1.2.3.4
This command will create the following
- NS record with the name a.ns.professortux.com
- A record pointing a.ns.professortux.com to 1.2.3.4
add-host
add-host creates an A record and a PTR record. For example:
add-host www.professortux.com 1.2.3.5
This command will create the following
- A record pointing www.professortux.com to 1.2.3.5
- PTR record pointing 1.2.3.5 to www.professortux.com
add-alias
The add-alias command is similar to add-host except it only creates the A record.
add-host www.professortux.com 1.2.3.5
This command will create the following
- A record pointing www.professortux.com to 1.2.3.5
add-mx
add-mx creates your domain's MX records. It also creates an A record for the mail server.
The MX record that the command creates will be x.mx.<domain>. x will be the first unused letter of the alphabet. The MX records will also have priority 0. For example:
add-mx professortux.com 1.2.3.6
This command will create the following
- MX record with the name a.mx.professortux.com
- A record pointing a.mx.professortux.com to 1.2.3.6
Putting it all together
Let's assume we have a domain that we want to set up from scratch with tinydns. We'll use professortux.com in the example. We need to setup the following servers:
- 2 DNS servers at 1.1.1.1 and 1.1.1.2
- 2 email servers at 1.1.1.3 and 1.1.1.4
- a mail server at 1.1.1.5
We would issue the following commands
add-ns professortux.com 1.1.1.1add-childns professortux.com 1.1.1.2add-mx professortux.com 1.1.1.3add-mx professortux.com 1.1.1.4add-alias www.professortux.com 1.1.1.5make
The end result will be the following DNS records
- SOA for professortux.com
- NS for a.ns.professortux.com
- NS for b.ns.professortux.com
- MX with priority 0 for a.mx.professortux.com
- MX with priority 0 for b.mx.professortux.com
- A pointing a.ns.professortux.com to 1.1.1.1
- A pointing b.ns.professortux.com to 1.1.1.2
- A pointing a.mx.professortux.com to 1.1.1.3
- A pointing b.mx.professortux.com to 1.1.1.4
- A pointing www.professortux.com to 1.1.1.5
Further customization
In order to add other records (such as CNAME records and TXT records) and to customize other settings (such as the MX priority or the name of the MX or NS records) you need to manually edit the data configuration file. You can refer to the tinydns config for detailed reference on the format of that file.




djbdns

Comments
Many thanks professor, it helped me a lot! No other tutorial I could do just fine as it.
Best regard's.