Master and Slave DNS server Bind9 Ubuntu Server 14.0.4 LTS

DNS 1 Master 93.155.130.14

Инсталиране на DNS сървъра

sudo apt-get install bind9 dnsutils

Създаване на файл за зоната която ще обслужваме

sudo nano /etc/bind/pri.itservice-bg.net

Описваме хостовете в зоната и значението им

$TTL        86400
@       IN      SOA     ns1.itservice-bg.net. support.itservice-bg.net. (
                        2016030201       ; serial, todays date + todays serial #
                        28800              ; refresh, seconds
                        7200              ; retry, seconds
                        604800              ; expire, seconds
                        86400 )            ; minimum, seconds
;
 
ns1               86400      A         93.155.130.14
ns2               86400      A         93.155.130.11
host              86400      A         93.155.130.14
host2             86400      A         93.155.130.11
mail              86400      A         93.155.130.14
www               86400      A         93.155.130.14
itservice-bg.net. 86400      A         93.155.130.14
itservice-bg.net. 86400      MX    10  mail.itservice-bg.net.
itservice-bg.net. 86400      MX    20  host2.itservice-bg.net.
itservice-bg.net. 86400      NS        ns1.itservice-bg.net.
itservice-bg.net. 86400      NS        ns2.itservice-bg.net.

Отваряме главния конфигурационен файл на DNS сървъра /etc/bind/named.conf.local и описваме в него създадената зона /etc/bind/pri.itservice-bg.net като главна която може да прави трансфери към второстепенната 93.155.130.11

nano /etc/bind/named.conf.local
};
zone "itservice-bg.net" {
        type master;
        allow-transfer {93.155.130.11;};
        file "/etc/bind/pri.itservice-bg.net";
};

Рестартираме DNS сървъра за влязат промените в сила

sudo service bind9 restart

DNS 2 Slave 93.155.130.11

sudo nano /etc/bind/named.conf.local
zone "itservice-bg.net" {
        type slave;
        allow-query { any; };
        file "/etc/bind/slave/sec.itservice-bg.net";
        masters { 93.155.130.14; };
};
sudo mkdir /etc/bind/slave
sudo chown bind.bind /etc/bind/slave
sudo service bind9 restart

За да проверим отговаря ли ни на зоната DNS сървъра ще използваме следната команда: dig @93.155.130.14 itservice-bg.net

samyil@host2:~$ dig @93.155.130.14 itservice-bg.net
 
; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> @93.155.130.14 itservice-bg.net
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19052
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3
 
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;itservice-bg.net.		IN	A
 
;; ANSWER SECTION:
itservice-bg.net.	86400	IN	A	93.155.130.14
 
;; AUTHORITY SECTION:
itservice-bg.net.	86400	IN	NS	ns2.itservice-bg.net.
itservice-bg.net.	86400	IN	NS	ns1.itservice-bg.net.
 
;; ADDITIONAL SECTION:
ns1.itservice-bg.net.	86400	IN	A	93.155.130.14
ns2.itservice-bg.net.	86400	IN	A	93.155.130.11
 
;; Query time: 0 msec
;; SERVER: 93.155.130.14#53(93.155.130.14)
;; WHEN: Tue Apr 05 10:49:56 EEST 2016
;; MSG SIZE  rcvd: 129

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.