close

請用yum安裝bind

bind-9.7.3-2.el6_1.P3.2.x86_64
bind-utils-9.7.3-2.el6_1.P3.2.x86_64
bind-chroot-9.7.3-2.el6_1.P3.2.x86_64
bind-libs-9.7.3-2.el6_1.P3.2.x86_64



vim /ect/resolv.conf    (CentOS 6.0一定要設定localhost、5.0不打預設localhost)

nameserver 127.0.0.1



DNS設定檔

vim /etc/named.conf


options {
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        recursion yes;
        dnssec-validation yes;
        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
        type hint;
        file "named.ca";
};

//正解
zone "xcite.idv.tw" IN {
        type master;
        file "/var/named/data/named.xxx.idv.tw"; //自訂的檔案路徑
        };
include "/etc/named.rfc1912.zones";



編輯正解檔

vim /var/named/data/named.xxx.idv.tw

@ 3600                 IN      SOA     xxx.idv.tw. root.xxxx.idv.tw. (
                                2011070505   ; Serial, edited by duncan
                                3600   ; Refresh 1 hours
                                3600    ; Retry   1 hour
                                86400  ; Expire  1 day
                                86400 ) ; Minimum 24 hours
        IN NS dns.xxxx.idv.tw.
        IN A    120.xxx.xxx.xxx
dns             IN A
120.xxx.xxx.xxx
www             IN CNAME dns


將目錄轉至chroot底下

vim /etc/sysconfig/named

ROOTDIR=/var/named/chroot



測試DNS是否成功

nslookup www.google.com.tw

Server:         127.0.0.1
Address:        127.0.0.1#53

Non-authoritative answer:
www.google.com.tw       canonical name = www.google.com.
www.google.com  canonical name = www.l.google.com.
Name:   www.l.google.com
Address: 72.14.203.106
Name:   www.l.google.com
Address: 72.14.203.147
Name:   www.l.google.com
Address: 72.14.203.99
Name:   www.l.google.com
Address: 72.14.203.103
Name:   www.l.google.com
Address: 72.14.203.104
Name:   www.l.google.com
Address: 72.14.203.105


dig www.google.com.tw

 

; <<>> DiG 9.7.3-P3-RedHat-9.7.3-2.el6_1.P3.2 <<>> www.google.com.tw
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18183
;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 4, ADDITIONAL: 4

;; QUESTION SECTION:
;www.google.com.tw.             IN      A

;; ANSWER SECTION:
www.google.com.tw.      345192  IN      CNAME   www.google.com.
www.google.com.         604392  IN      CNAME   www.l.google.com.
www.l.google.com.       244     IN      A       72.14.203.99
www.l.google.com.       244     IN      A       72.14.203.103
www.l.google.com.       244     IN      A       72.14.203.104
www.l.google.com.       244     IN      A       72.14.203.105
www.l.google.com.       244     IN      A       72.14.203.106
www.l.google.com.       244     IN      A       72.14.203.147

;; AUTHORITY SECTION:

google.com.             172335  IN      NS      ns2.google.com.
google.com.             172335  IN      NS      ns3.google.com.
google.com.             172335  IN      NS      ns1.google.com.
google.com.             172335  IN      NS      ns4.google.com.

;; ADDITIONAL SECTION:
ns1.google.com.         345135  IN      A       216.239.32.10
ns2.google.com.         345135  IN      A       216.239.34.10
ns3.google.com.         345135  IN      A       216.239.36.10
ns4.google.com.         345135  IN      A       216.239.38.10

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Oct 19 22:05:34 2011
;; MSG SIZE  rcvd: 315


 

ping www.google.com.tw

PING www.l.google.com (72.14.203.106) 56(84) bytes of data.
64 bytes from tx-in-f106.1e100.net (72.14.203.106): icmp_seq=1 ttl=55 time=11.4 ms
64 bytes from tx-in-f106.1e100.net (72.14.203.106): icmp_seq=2 ttl=55 time=11.1 ms
64 bytes from tx-in-f106.1e100.net (72.14.203.106): icmp_seq=3 ttl=55 time=11.0 ms
--- www.l.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 3947ms
rtt min/avg/max/mdev = 11.085/11.248/11.481/0.189 ms













arrow
arrow
    全站熱搜
    創作者介紹
    創作者 blue sky 的頭像
    blue sky

    blue sky的life

    blue sky 發表在 痞客邦 留言(0) 人氣()