How to Configure Master and Slave DNS Servers on Rocky Linux 8

Introduction

In any production environment, DNS (Domain Name System) is a critical service. A single DNS server can become a single point of failure.
That’s why Linux administrators set up Master (Primary) and Slave (Secondary) DNS servers to ensure redundancy and load balancing.
This setup provides high availability and ensures that DNS service remains available even if one server goes down.


What is Master and Slave DNS?

  • Master DNS: The primary DNS server that holds the original zone files with authoritative data for a domain.
  • Slave DNS: A backup DNS server that gets zone data from the master server using zone transfer.
  • This setup provides fault tolerance and load distribution.

Lab Setup

  • Master DNS Server: 192.168.1.10
  • Slave DNS Server: 192.168.1.11
  • Domain Name: bitscentric.local

Step 1: Install BIND on Both Servers

sudo dnf install bind bind-utils -y

Enable and start the service:

sudo systemctl enable named
sudo systemctl start named

Step 2: Configure Master DNS Server (192.168.1.10)

Edit the /etc/named.conf file and allow queries and transfers:

options {
    directory     "/var/named";
    allow-query   { any; };
    allow-transfer { 192.168.1.11; };
};

Now, define the zone for bitscentric.local:

zone "bitscentric.local" IN {
    type master;
    file "bitscentric.local.db";
    allow-update { none; };
};

Create the zone file:

sudo nano /var/named/bitscentric.local.db

Add the following:

$TTL 86400
@   IN  SOA     ns1.bitscentric.local. root.bitscentric.local. (
        2024090201 ; Serial
        3600       ; Refresh
        1800       ; Retry
        1209600    ; Expire
        86400 )    ; Minimum TTL

; Name servers
    IN  NS      ns1.bitscentric.local.
    IN  NS      ns2.bitscentric.local.

; A Records
ns1 IN  A       192.168.1.10
ns2 IN  A       192.168.1.11
www IN  A       192.168.1.100

Restart service:

sudo systemctl restart named

Step 3: Configure Slave DNS Server (192.168.1.11)

Edit /etc/named.conf:

options {
    directory     "/var/named";
    allow-query   { any; };
};

Define slave zone:

zone "bitscentric.local" IN {
    type slave;
    masters { 192.168.1.10; };
    file "slaves/bitscentric.local.db";
};

Restart service:

sudo systemctl restart named

Step 4: Configure Firewall on Both Servers

sudo firewall-cmd --permanent --add-service=dns
sudo firewall-cmd --reload

Step 5: Test Configuration

On client machine, set DNS to use both servers:

nameserver 192.168.1.10
nameserver 192.168.1.11

Test DNS resolution:

dig @192.168.1.10 www.bitscentric.local
dig @192.168.1.11 www.bitscentric.local

You should get responses from both servers.


Key Points for Linux Administrators

  • Always increment the Serial Number in zone files after making changes.
  • Slave servers periodically check the Master for updates.
  • Configure at least two DNS servers in production for redundancy.
  • Use dig and named-checkconf to troubleshoot configuration issues.

Conclusion

Setting up a Master and Slave DNS server in Rocky Linux 8 ensures high availability and load balancing of DNS services.
This is a recommended practice for any Linux Server Administrator handling enterprise infrastructure.
With this setup, if the master goes down, the slave can still serve DNS queries without downtime.

Leave a Reply

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