Setting up MASTER SLAVE DNS setup with BIND

Hello, Linux-fanatics. Earlier we learned to create a DNS server for our environment using BIND with single or Master server setup. Now, in this tutorial we will discuss how we can create a master slave DNS server setup.

In Master Slave DNS setup when a slave is created, it obtains an identical copy of all master records using zone transfer method.  Master-slave have easy replication mechanism,  as soon as a change is made on Master server, it notifies the slave & slave then fetches the data. All process taking mere seconds.


Master server                        Slave server

IP address                              IP address


We have already discussed how we can create a Master server. If you have not done that already, please do that by following this tutorial. We will then make some changes to Master server.


Configuring MASTER server

On master DNS, we will make changes to /etc/named.conf file to allow zone transfer to slave server & also to notify slave server when changes have been made to  master.

Open /etc/named.conf & add the following lines

allow-transfer { localhost;;};

this will allow the zone transfer to slave server. Next we will make changes to allow master to notify of changes made  to slave server by adding following lines in named.conf only

zone “” IN {
type master;
file “”;
allow-update { none; };
notify yes;
also-notify {; };

Here, notify yes  & also-notify {; }; will allow notification to be sent to slave server (  & slave will then fetch the updated information.

Next, we will update the slave DNS information in our forward zone file. Open “/var/named/” & make the following changes

$TTL 86400
@ IN SOA (
2014112512 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
;Name Server Information
Secondary Name server
;IP address of Name Server
primary IN A
;IP address of secondary server
secondary IN A
;Mail exchanger IN MX 10
;A – Record HostName To Ip Address
www IN A
mail IN A
;CNAME record

After these changes are made, restart your BIND service for changes to take effect.

systemctl restart named.service


Configuring Slave server

Configurations on Master server are now complete, we will now configure our slave server to receive zone transfers from Master DNS. Firstly, we will install BIND on slave

$ yum install bind bind-utils

After the package has been installed, we will now edit /etc/named.conf . Open named.conf & comment the following  lines

#listen-on port 53 {; };
#listen-on-v6 port 53 { :!! };

Then we will add our network, to allow clients from our network to make query to DNS. So add the following line

allow-query { localhost;; };

& lastly we will add a slave zone in configuration file

zone “” IN {
type slave;
masters {; };
file “slaves/”;

Where, – Domain name

slave – Secondary DNS – Slave forward lookup file

master slave dns

Now, restart BIND services on our slave

systemctl restart named.service

Verifying zone for Slave server

Lastly , we will verify our zone file with “dig command”, as we did for our master DNS server

master slave dns

We now have our Master Slave DNS setup  ready. Everytime we make an update to master, master will notify slave which in turn will fetch the update, thus keeping both master-slave in sync.

That’s guys for now, if  having any queries/suggestions please mention them in comment box down below.


If you think we have helped you or just want to support us, please consider these :-

Connect to us: Facebook | Twitter | Google Plus

Become a Supporter – Donate us some of you hard earned money:

Linux TechLab is thankful for your continued support.


Passionate about Linux & open source. Loves to learn, read & write about Linux as well as new technologies.

You may also like...

3 Responses

  1. Sachin Patel says:

    I did the above configuration but when I do changes in master server, it does not reflect in slave server. In short, master-slave is not syncing. What could be issue?

  2. Midhun G Kurup says:

    actaully how can we set up a master and slave dns in our pc. how can we assume client and server . in our pc we have only single ip.

Leave a Reply

Your email address will not be published. Required fields are marked *