djbdns: More Than Just a Mouthful of Consonants

Recently released into the public domain, djbdns is a fast and secure replacement for BIND.

Adding DNS Records

Before we begin, let's see how our DNS data would look in the traditional
BIND zone file format (versions 8.2 and greater). Listing 1 shows
everything needed to configure forward records for example.com and
reverse records for 192.168.10.0/24. This includes the configuration
for named.conf, as well as the zone data for example.com and
10.168.192.in-addr.arpa. This clocks in at 38 lines of configuration
for our two domains.

As I mentioned, tinydns takes a different approach. Instead of defining
records separately for forward and reverse zones, tinydns allows you
to combine them into single records. Listing 2 contains the exact same
configuration from Listing 1, except in tinydns format. Instead of 38
lines of configuration, we now have only ten lines. Let's go over what
these lines do.

The first character of each line is used to specify the type of record
or records that should be created. A period (.) line tells tinydns that it is
authoritative for example.com:

.example.com::linux2.example.com

This creates an SOA (start of authority) record and sets
linux2.example.com as an NS record. If an IP address was provided between
the two colons, an A record also would have been created for
linux2.example.com with that IP address. This one @ line replaces
eight from the BIND zone file:

@example.com:192.168.10.15:mail.example.com:0

This line creates two records. An A record is created for mail.example.com
with an address of 192.168.10.15, and an MX record is created for
example.com pointing to mail.example.com with a distance of 0. Now, let's
start defining our hosts:

These lines each create two records. For example, the first line creates
an A record for linux1.example.com with an address of 192.168.10.10 and a
PTR record (a reverse record) for 10.10.168.192.in-addr.arpa pointing
to linux1.example.com. If you manage both the forward and reverse zones
for your network, you probably already can see what a huge time-saver
this can be.

Finally, we define simple aliases for our hosts. Each host has an alias
that we prefer to use instead of the generic linux{1,2,3} names. To
create alias A records, we use + lines, which are exactly like =
lines, except PTR records are not created:

Although it's discouraged, you also could define an alias with a CNAME using a C line:

Cnoodly-appendage.example.com:linux1.example.com

All these records go in a single file, which in our case is
/service/tinydns/root/data. Save the file, and from that directory
run make. This compiles the text file into data.cdb, a constant
database. If a data.cdb already exists, tinydns will continue
serving from it until the new one is ready, at which point it is moved
into place, and tinydns instantly begins using it. The Makefile simply
calls the tinydns-data command:

data.cdb: data
/usr/local/bin/tinydns-data

You can test that your new records are in the database by using the
tinydns-get utility. tinydns-get accesses the data.cdb file directly, so
you don't need to worry about your test queries being cached anywhere. For
example, you can use tinydns-get to see that your MX record is
configured properly. First, make sure you are in the /service/tinydns/root
directory and that you have run make so that the database is up to date:

1) why using daemon tools if linux has already other tools to lunch daemon and software ?
2) as a sysadmin i neglet to fill my "/" with not standard directories
3) Have You ever got problems trying to stop qmail or a piece of it ? ..(ask google) ..daemontools are simply...too much , sometime.Too much effort to keep daemons running, even when You have to stop them.
4) This is a question: how about speed?
5) Second question: importing zones from bind is possible?

Trending Topics

Webinar: 8 Signs You’re Beyond Cron

Scheduling Crontabs With an Enterprise Scheduler
11am CDT, April 29th

Join Linux Journal and Pat Cameron, Director of Automation Technology at HelpSystems, as they discuss the eight primary advantages of moving beyond cron job scheduling. In this webinar, you’ll learn about integrating cron with an enterprise scheduler.