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

來源:互聯網
上載者:User

標籤:dns   bind   

DNS從服務的搭建

一、安裝

        

 [[email protected]~]# yum install bind

二、修改主設定檔

        

 [[email protected]~]# cat /etc/named.conf

    將以下三行注釋掉

   

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

三、將DNS指向本機

        

[[email protected]~]# 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; };

     檢查設定檔

    

[[email protected]~]# named-checkconf

五、修改主DNS伺服器的/var/named/test.com.zone檔案,添加從伺服器資訊

                         

               IN              NS               ns2ns2            IN              A                192.168.1.107

     儲存退出

     檢查設定檔

        

[[email protected]~]#named-checkzone  “test.com”  test.com.zone[[email protected]~]#rndc reload[[email protected]~]#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.103ns2.test.com.           600     IN     A       192.168.1.107

六、啟動從伺服器DNS服務

        

[[email protected]~]# service named startGenerating/etc/rndc.key:  [  OK  ]Starting named:[  OK ]

    啟動成功後,發現在/var/named/slaves檔案夾下有個test.com.zone檔案

        

[[email protected]]# lstest.com.zone

    該檔案就是從主伺服器同步過來的    

 

七、完成一次同步傳輸

        

[[email protected]~]# 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: +cmdtest.com.               600     IN     SOA     dns.test.com.admin.test.com. 2014061601 7200 600 604800 21600test.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.103ftp.test.com.           600     IN     CNAME   www.test.com.imap.test.com.          600     IN     A       192.168.1.101mail.test.com.          600     IN     A       192.168.1.103ns2.test.com.           600     IN     A       192.168.1.107www.test.com.           600     IN     A       192.168.1.100www.test.com.           600     IN     A       192.168.1.102test.com.               600     IN     SOA     dns.test.com.admin.test.com. 2014061601 7200 600 604800 21600

 

 


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.