Creating a Slave DNS Server on Bind9

I couldn’t find a quick and dirty list of commands for setting up a slave DNS server so I figured I would just throw it together.

Starting with a fully working primary name server, we are going to set up a slave name server. We are going to make the following assumptions:
primary – 1.2.3.4
slave – 4.5.6.7
* We want to have the domain example.com have a slave name server

On the primary (or master) name server, add the following lines to the options section.

options {
    allow-transfer { 4.5.6.7; };
    notify yes;
};

Ensure that you update the serial number in the SOA on the master. Then run:

# rndc reload

On the slave name server, add the following entry to the named.conf file (or whichever file houses your zone entries). Ensure that the path leading up to the zone file exists and that bind has write access to that directory.

 zone "example.com"  { type slave; file "/etc/bind9/zones/example.com.slave"; masters { 1.2.3.4; }; };

Then once you made the changes to the slave, you will need to reload the configuration. Do this the same way you did on the master:

# rndc reload

If you watch your DNS log, you should see the transfer happen as soon as you restart both named servers.