DJBDNS: The pieces

By Brian Hatch, ITworld |  News

DJBDNS has many separate pieces, not all of which you necessarily need.
The separate pieces include:

* dnscache -- This is the recursive caching name server, which
simply looks up the DNS records you request. It consults the
thirteen root DNS servers and winds it's way up to the answer.
You can also associate zones with name servers manually to support
non-official zones, such as internal networks. dnscache listens on
both TCP and UDP port 53.
* tinydns -- This is the DNS server you run to let others resolve
your hostnames and IP addresses. It will only serve the data that
you've given it, so you cannot point to it as your default name
server -- point to a dnscache IP address instead. tinydns listens
on UDP port 53.
* axfrdns -- This server allows authorized BIND secondary DNS
servers to mirror your zone files. The 'official' DJBDNS way to
synchronize zones is to simply rsync the files from the master to
the slaves. However, for compatibility with BIND's zone transfers,
you can run axfrdns. axfrdns listens to TCP port 53.

You may have noticed above that dnscache and tinydns both want to listen
on UDP port 53. That means that you cannot have both of these processes
listening on the same IP address. DJB's official retort is that you
should be using separate machines for this purpose anyway, which is
pretty much true. However, if you want to run both on the same machine,
then you can run each on it's own virtual IP address (eth0:0 vs eth0:1,
etc...) or you could run dnscache on localhost (available only to that
machine) and tinydns on the external interface. The network setup you
pick will depend on your needs.

Each of these servers are run through the supervise/svscan processes we
installed earlier. These processes require a special directory layout to
define the programs to run; however, you can run configuration programs
to handle the grunt work. Let's start off by setting up dnscache:

# dnscache-conf dnscache dnslog /etc/dnscache

The arguments are:

* dnscache -- The user the daemon will run as.
* dnslog -- the user the logging component will run as.
* /etc/dnscache -- The directory to set up for supervise.
* -- The IP address dnscache should listen on.

For now I'm setting the IP address to be because it's a
convenient way to test things.[1] If you already have BIND listening on
localhost ( then using won't conflict and we can
verify all is well before turning off BIND.

This creates the following directories inside /etc/dnscache:

* env/ -- Any files in here are environment variables that will be
set for the dnscache process. For example the file 'IP' contains
'' for our current setup. Dnscache uses environment
variables for all its configuration.

Join us:






Answers - Powered by ITworld

ITworld Answers helps you solve problems and share expertise. Ask a question or take a crack at answering the new questions below.

Ask a Question