Wrapping Up DJBDNS

By Brian Hatch, ITworld |  News

At the beginning of this trip down DJBDNS lane, I tagged a challenge at
the end of the message. Unlike my previous [1] challenge, this one had
almost no response, probably because it was lost in obscurity at the
bottom of the email. I'm re-issuing it again this week, and you'll find
it at the end of this article.

Welcome to the home stretch, my last [2] ITworld article on installing
DJBDNS. I'll cover two things here. First, I'll show you how to 'import'
your existing BIND zones into tinydns data format so you don't need to
convert those files by hand. Lastly, I'll show you how to start up the
axfrdns server, which will allow DNS secondaries running BIND to mirror
your DNS zones.

Import Your Existing BIND Zones
First, both of these require another piece of DJB software, ucspi-tcp
(Unix Client Server Program Interface). Run the following to install it:

$ mkdir /tmp/src
$ cd /tmp/src
$ wget http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
$ tar xzvf ucspi-tcp-0.88.tar.gz
$ cd ucspi-tcp-0.88
$ make
# make setup check

This installs a bunch of different TCP client and server programs in
/usr/local/bin, though we'll only be using two of them: tcpserver and
tcpclient.

So, let's see how we can snag our existing BIND zone files. I'll assume
we want to get the 'example.dom' domain. First, make sure that BIND
allows you to perform DNS transfers for our IP address. Assuming you are
doing this on the same machine, localhost should be allowed in
/etc/named.conf:

allow-transfer { 127.0.0.1; };

If you don't have an allow-transfer directive, then create one like the
one above. Test to verify that you can do a transfer using 'host':

$ host -l example.dom
example.dom SOA example.dom. hostmaster.example.dom 10 3600 180
25920 8640
example.dom name server ns1.example.dom
example.dom name server ns2.example.dom
www.example.dom has address 192.168.1.1
...

If you don't get a listing, then check your logs and make sure that
localhost is allowed to perform a transfer. If all's well, then do the
following:

# cd /etc/tinydns/root
# tcpclient -v 127.0.0.1 53 axfr-get example.dom example.dom.zone
tmpfile

This connects to the local BIND server, snags a copy of the zone, and
saves in the proper format as example.dom.zone in the local directory.
You can do this for all the domains that you support, it's that easy.
Once you've got all the zones saved, you can edit them if you want to
make them more tinydns-ish, for example deleting the TTLs, converting Z
and & lines to .domain lines instead, etc.... However, even if you leave
them as is, they'll work exactly as before. All that's left to do is
merge these files into the data file:

# cat *.zone > data
# make
/usr/local/bin/tinydns-data

That's it. You've just taken all your BIND data and turned it into
tinydns data format.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

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
randomness