Adventures with a Raspberry Pi (Part 1)

Disclaimer: Most of the text here will serve as a reminder to me of how I did things in case something explodes later.

Prerequisites: This blog post assumes the reader knows how to set up a zone using bind as well as the general syntax of bind’s configuration files.


Recently, I got a Raspberry Pi to play around with and I decided to set up a secondary DNS server. While I have no real need for a secondary DNS server I figured it would be a good exercise to set it up. It also allows me to bring down the server for an upgrade without losing name resolution on the network so there’s really no reason not to do it.

A Raspberry on a bed

To start off I installed Bind9 using

pacman -S bind

Configuring bind

Setting up the Pi as a secondary DNS server was easy.  It was just a matter of adding A-, AAAA-, and NS-records for it and then changing the configuration files of the master and slave to allow transfers between the two.

Which ended up being added as follows (to the zone): 3600 IN NS 3600 IN A 192.168.x.x 3600 IN AAAA

And a number of NS-records for the other zones (DHCP hosts and reverse DNS).

Next, configuring zone transfers was as simple as adding the host to the ACL for transfers I have set up (but it works just as well with addresses).

To add a host to allow-transfer one simply adds the following (between the omitted parts, […] signifies omitted parts of the config) to the zone-declaration in the master’s config file:

zone "" IN {
    type master;
    allow-transfer {

Configuring the Pi as a slave is simply a matter of adding a slave zone-declaration to the config file (one for each zone that it’s supposed to handle), which is done as follows:

zone "" IN {
    type slave;
    file "/var/lib/named/";
    masters {
    allow-transfer { none; };


Verifying that it works is simple, issue a name resolution request and see if the response is positive. To verify that transfers are working one simply adds a host to one of the zones that are configured for transfers, update the serial and reload the zones on the master.

Verifying that transfers work without doing that (assuming bind doesn’t do it automatically upon reloading the configuration file, which it should) can be triggered using (replace with your zone of choice):

dig axfr

Verifying that name resolution works can be done by using:

dig +norecurse @192.168.x.x

Next up

Assuming I manage to find the energy to write something on this  blog sometime soon I’ll put up a post on how to configure MySQL replication using a Raspberry Pi.