Table of Contents

djbdns

  • dnsip - simple lookup that returns IP address
  • dnsmx - print MX records of a domain
  • dnsname - lookup reverse ptr of an IP address
  • dnstxt - print ouf the TXT records of a domain

djbdns also ships with a number of user tools that make life easier.

Setup

Emerging djbdns on Gentoo will automatically setup the user accounts (dnscache, dnslog, tinydns) for you.

First, create a tinydns service:

mkdir /var/djbdns
tinydns-conf tinydns dnslog /var/djbdns/tinydns <nameserver IP>

You can add a DNS local cache if you want, but it won't be used in this configuration.

Create a symlink for the service, and start service scan:

ln -s /var/djbdns/tinydns /service/tinydns
/etc/init.d/svscan start

Initial DNS Setup

The documentation says that you will need to use ./add-ns to claim in-addr.arpa names and serve reverse DNS names, but that is only necessary if you are in charge of an entire IP block.

Usage

Adding A Domain

Nameserver records (NS)

Add a domain's NS records (a.ns.domain.com, b.ns.domain.com)

cd /service/tinydns/root
./add-ns domain.com 209.177.158.152
./add-ns domain.com 209.177.157.176
make
Host record (A)

Add the domain's first A record, also called the “host record”.

Note that this is only run once per IP address, so run it for the FQDN.

cd /service/tinydns/root
./add-host domain.com <IP address>
make

DNS Scenarios

Domain Alias (A Record)
cd /service/tinydns/root
./add-alias foo.domain.com <IP address>
make
Two Domains, One IP Address

Decide which hostname is going to be the FQDN and add the host record and aliases as normal:

cd /service/tinydns/root
./add-host domain.com <IP address>
./add-alias foo.domain.com <IP address>
make

Any extra domain names will be an alias A record. There can only be one host record per IP address.

cd /service/tinydns/root
./add-alias domain.com <IP address>
./add-alias foo.domain.com <IP address>
make
Wildcard DNS (A Record)
cd /service/tinydns/root
./add-alias *.domain.com <IP address>
make
CNAME Record

You have to add it manually to the data file. The syntax is:

Csub.domain.com:server.com.:<TTL>

Run make when finished.