22 C
Texas

How To Configure Slave BIND DNS Server On Ubuntu 20.04

- Advertisement -
- Advertisement -

In our previous guide we covered the setup of Master(Primary) DNS Server. Here we’ll learn that how to configure slave bind dns server on Ubuntu 20.04 . As the name defined, slave obtains the data from the master & keeps this data in the zones for particular time & from there response to the DNS queries. So, let’s move towards the installation process.

Setup

Master DNS Server IP: 172.16.10.2
Master domain name:ns1.osradar.local
Slave DNS Server IP:172.16.10.10
Slave domain name:ns2.osradar.local

Step 1: Configure Master DNS Server On Ubuntu 20.04

The configuration procedure of slave DNS server is similar to the Master server. The main difference b/w is that slave gets it’s data from the Master DNS.

Edit the /etc/bind/named.conf.local file on primary server & add the allow-transfer & also-notify commands. Add this to both zones (forward & reverse).

- Advertisement -
sudo nano /etc/bind/named.conf.local
##Forward zone
zone "osradar.local" IN { // Domain name

type master; // Primary DNS

file "/etc/bind/forward.osradar.local.db"; // Forward lookup file

allow-update { none; }; // Since this is the primary DNS, it should be none.
allow-transfer { 172.16.10.10; }; //Allow Transfer of zone from the master server

also-notify { 172.16.10.10; }; //Notify slave for zone changes

};

##Reverse zone

zone "10.16.172.in-addr.arpa" IN { //Reverse lookup name, should match your network in reverse order

type master; // Primary DNS

file "/etc/bind/reverse.osradar.local.db"; //Reverse lookup file

allow-update { none; }; //Since this is the primary DNS, it should be none.

allow-transfer { 172.16.10.10; }; //Allow Transfer of zone from the master server

also-notify { 172.16.10.10; }; //Notify slave for zone changes

};

allow-transfer will help you to transfer data from Primary to secondary server.
also-notify helps you to notify the slave when update is available.

And after making these changes, restart the bind services.

sudo systemctl restart bind9

Step 2: Configure Slave DNS Server On Ubuntu 20.04

Install the following packages required for slave DNS server by typing

sudo apt-get install -y bind9 bind9utils bind9-doc dnsutils

Once packages are installed, edit the /etc/bind/named.conf.local file & update the forward & reverse DNS records.

sudo nano /etc/bind/named.conf.local
##Forward Zone

zone "osradar.local" IN { //Domain name

type slave; //Secondary Slave DNS

file "/var/cache/bind/forward.osradar.local.db"; //Forward Zone Cache file

masters { 172.16.10.2; }; //Master Server IP

};

##Reverse zone

zone "10.16.172.in-addr.arpa" IN { //Reverse lookup name. Should match your network in reverse order

type slave; // Secondary/Slave DNS

file "/var/cache/bind/reverse.osradar.local.db"; //Reverse Zone Cache file

masters { 172.16.10.2; }; //Master Server IP

};

And then restart the DNS services on slave.

sudo systemctl restart bind9

Step 3: Testing Slave DNS Server On Ubuntu 20.04

In order to test the working of slave DNS server, create a client machine on the slave server and hit.

sudo echo "nameserver 172.16.10.10" >> /etc/resolv.conf

Finally use the dig command to verify the DNS.

[email protected]:~# dig www.osradar.local

; <<>> DiG 9.16.1-Ubuntu <<>> www.osradar.local
;; global options: +cmd
;; Got answer:
;; WARNING: .local is reserved for Multicast DNS
;; You are currently testing what happens when an mDNS query is leaked to DNS
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24401
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: b1e287dd1d118ad6010000005f8c88233ef562a7063e7a15 (good)
;; QUESTION SECTION:
;www.osradar.local. IN A

;; ANSWER SECTION:
www.osradar.local. 604800 IN A 172.16.10.3

;; Query time: 0 msec
;; SERVER: 172.16.10.10#53(172.16.10.10)
;; WHEN: Sat Nov 18 18:23:31 UTC 2020
;; MSG SIZE rcvd: 100

So, this is how you can configure DNS Slave Server on Ubuntu 20.04

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article