DNS服務器之二:從服務器的實現

DNS從服務的搭建

一、安裝

        

 [root@localhost~]# yum install bind

二、修改主配置文件

        

 [root@localhost~]# cat /etc/named.conf

    將以下三行註釋掉

   

//               listen-on port 53 { 127.0.0.1; };
//               listen-on-v6 port 53 { ::1; };
//               allow-query     { localhost; };

三、將DNS指向本機

        

[root@localhost~]# vim /etc/resolv.conf
      ;generated by /sbin/dhclient-script
      nameserver 192.168.1.107

四、在/etc/named.rfc1912.zones文件中定義從屬的域

  

zone"test.com" IN {
       type slave;
       file "slave/test.com.zone";
       masters { 192.168.1.109; };

     檢查配置文件

    

[root@localhost~]# named-checkconf

五、修改主DNS服務器的/var/named/test.com.zone文件,添加從服務器信息

                         

               IN              NS               ns2
ns2            IN              A                192.168.1.107

     保存退出

     檢查配置文件

        

[root@localhost~]#named-checkzone  “test.com”  test.com.zone
[root@localhost~]#rndc reload
[root@localhost~]#dig  –t  NS  test.com
         ;<<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> -tNS test.com
;; globaloptions: +cmd
;; Got answer:
;;->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19243
;; flags: qr aard ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 2
 
;; QUESTION SECTION:
;test.com.                      IN      NS
 
;; ANSWERSECTION:
test.com.               600     IN     NS      ns2.test.com.
test.com.               600     IN     NS      dns.test.com.
 
;; ADDITIONALSECTION:
dns.test.com.           600     IN     A       192.168.1.103
ns2.test.com.           600     IN     A       192.168.1.107

六、啓動從服務器DNS服務

        

[root@localhost~]# service named start
Generating/etc/rndc.key:
 
 
[  OK  ]
Starting named:[  OK ]

    啓動成功後,發現在/var/named/slaves文件夾下有個test.com.zone文件

        

[root@localhostslaves]# ls
test.com.zone

    該文件就是從主服務器同步過來的    

 

七、完成一次同步傳輸

        

[root@localhost~]# dig -t axfr test.com @192.168.1.103
 
;<<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> -taxfr test.com @192.168.1.103
;; globaloptions: +cmd
test.com.               600     IN     SOA     dns.test.com.admin.test.com. 2014061601 7200 600 604800 21600
test.com.               600     IN     NS      dns.test.com.
test.com.               600     IN     NS      ns2.test.com.
test.com.               600    IN      MX      10 mail.test.com.
dns.test.com.           600    IN      A      192.168.1.103
ftp.test.com.           600     IN     CNAME   www.test.com.
imap.test.com.          600     IN     A       192.168.1.101
mail.test.com.          600     IN     A       192.168.1.103
ns2.test.com.           600     IN     A       192.168.1.107
www.test.com.           600     IN     A       192.168.1.100
www.test.com.           600     IN     A       192.168.1.102
test.com.               600     IN     SOA     dns.test.com.admin.test.com. 2014061601 7200 600 604800 21600

 

 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章