Master DNS Server – 192.168.1.3
Slave DNS Server – 192.168.1.12
Master DNS Server 的部分已設定完成,這篇文章主要針對 Slave DNS Server 來做設定
參考網頁:
Setup DNS Server On Debian 7 Wheezy | Unixmen
Mind Reference: Debian Slave DNS Server Setup
[@more@]1. 安裝 DNS Server 所須套件
# apt-get install bind9 bind9utils bind9-doc dnsutils
2.修改 Master DNS Server 上的 /etc/bind/named.conf.local 設定檔,加入紅字的部分
# vim /etc/bind/named.conf.local
zone “test.ilc.edu.tw” IN {
type master;
file “/etc/bind/db.test.ilc.edu.tw”;
allow-transfer { 192.168.1.12; };
also-notify { 192.168.1.12; };
};
zone “1.168.192.in-addr.arpa” IN {
type master;
file “/etc/bind/db.1.168.192”;
allow-transfer { 192.168.1.12; };
also-notify { 192.168.1.12; };
};
3. 修改 Slave DNS Server 的 /etc/bind/named.conf.local
# vim /etc/bind/named.conf.local
zone “test.ilc.edu.tw” IN {
type slave;
file “/etc/bind/db.test.ilc.edu.tw”;
masters { 192.168.1.3; };
};
zone “1.168.192.in-addr.arpa” IN {
type slave;
file “/etc/bind/db.1.168.192”;
masters { 192.168.1.3; };
};
4. 重新啟動 Slave DNS Server
# /etc/init.d/bind9 restart
5. 會自動從 Master DNS Server 抓取設定檔
# ls -l /etc/bind/db.*
-rw-rw-r– 1 bind bind 237 Dec 9 04:21 /etc/bind/db.0
-rw-rw-r– 1 bind bind 271 Dec 9 04:21 /etc/bind/db.127
-rw-rw-r– 1 bind bind 237 Dec 9 04:21 /etc/bind/db.255
-rw-r–r– 1 bind bind 17797 Dec 25 14:16 /etc/bind/db.1.168.192
-rw-rw-r– 1 bind bind 353 Dec 9 04:21 /etc/bind/db.empty
-rw-rw-r– 1 bind bind 270 Dec 9 04:21 /etc/bind/db.local
-rw-rw-r– 1 bind bind 3048 Dec 9 04:21 /etc/bind/db.root
-rw-r–r– 1 bind bind 20142 Dec 25 14:17 /etc/bind/db.test.ilc.edu.tw
6. 進行測試
# host 192.168.1.3 192.168.1.12
Using domain server:
Name: 192.168.1.12
Address: 192.168.1.12#53
Aliases:
3.1.168.192.in-addr.arpa domain name pointer ftp.test.ilc.edu.tw.
# host ftp.test.ilc.edu.tw 192.168.1.12
Using domain server:
Name: 192.168.1.12
Address: 192.168.1.12#53
Aliases:
ftp.test.ilc.edu.tw has address 192.168.1.3