CentOs DNS功能的實現 首先配置好linux的網路連接!1、安裝相關的套件 www.2cto.com [root@localhost ~]# yum -y install bind bind-chroot2、配置實驗的環境[root@localhost ~]# cd /var/named/chroot[root@localhost chroot]# cp -rv /usr/share/doc/bind-9.3.6/sample/ etc/ var/[root@localhost chroot]# cp -rv /usr/share/doc/bind-9.3.6/sample/etc/* etc/ [root@localhost chroot]# cp -rv /usr/share/doc/bind-9.3.6/sample/var/* var/3、配置相關文檔[root@localhost ~]#cd /var/named/chroot/etc[root@localhost etc]# cp named.conf named.conf.bak [root@localhost etc]# vi named.conf options{ directory "/var/named"; // the default forwarders{202.102.240.65;};(託管)};zone "ethnicity.com"(正解){ type master; file "named.ethnicity";};zone "1.168.192.in-addr.arpa"(反解){ type master; file "192.168.1.zone";};[root@localhost ~]# cd /var/named/chroot/var/named[root@localhost named]# cp localhost.zone named.ethnicity [root@localhost named]# cp localhost.zone 192.168.1.zone[root@localhost named]# vi named.ethnicity $TTL 86400@ IN SOA @ root ( 42 ; serial (d. adams) 3H ; refresh 15M ; retry 1W ; expiry 1D ) ; minimum IN NS @ IN MX 192 mail.ethnicity.com.ftp IN A 192.168.1.192mail IN A 192.168.1.192im IN A 192.168.1.193c1 IN A 192.168.1.12c1 IN A 192.168.1.13[root@localhost named]# vi 192.168.1.zone $TTL 86400@ IN SOA @ root ( 42 ; serial (d. adams) 3H ; refresh 15M ; retry 1W ; expiry 1D ) ; minimum IN NS @192 IN PTR ftp.ethnicity.com192 IN PTR mail.ethnicity.com193 IN PTR im.ethnicity.com[root@localhost named]# /etc/init.d/named restart4、配置驗證環境(在linux本身進行測試)[root@localhost named]# vi /etc/resolv.conf ; generated by /sbin/dhclient-scriptsearch ethnicity.comnameserver 192.168.1.1925、驗證[root@localhost named]# nslookup> ftp.ethnicity.comServer: 192.168.1.192Address: 192.168.1.192#53 Name: ftp.ethnicity.comAddress: 192.168.1.192> 192.168.1.193Server: 192.168.1.192Address: 192.168.1.192#53 193.1.168.192.in-addr.arpa name = im.ethnicity.com.1.168.192.in-addr.arpa.> mail.ethnicity.comServer: 192.168.1.192Address: 192.168.1.192#53 Name: mail.ethnicity.comAddress: 192.168.1.192 > www.nyist.netServer: 192.168.1.192Address: 192.168.1.192#53 Non-authoritative answer:Name: www.nyist.netAddress: 202.102.240.88> www.google.comServer: 192.168.1.192Address: 192.168.1.192#53 Non-authoritative answer:www.google.com canonical name = www-g-com-chn.l.google.com.Name: www-g-com-chn.l.google.comAddress: 66.249.89.104 > exit[root@localhost ~]# dig -t MX mail.ethnicity.com(驗證MX徽記:用於郵件伺服器的網域名稱定義) ; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_5.3 <<>> -t MX mail.ethnicity.com;; global options: printcmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8264;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 ;; QUESTION SECTION:;mail.ethnicity.com. IN MX ;; AUTHORITY SECTION:ethnicity.com. 86400 IN SOA ethnicity.com. root.ethnicity.com. 42 10800 900 604800 86400 ;; Query time: 3 msec;; SERVER: 192.168.1.192#53(192.168.1.192);; WHEN: Tue Feb 8 20:07:16 2011;; MSG SIZE rcvd: 77 成功! 最後名詞解釋SOA 指示該區的權威(以學院的DNS為例,學院的首頁202.102.240.88 學院的主DNS伺服器為202.102.240.65 )NS 列出該區的一個名字伺服器(這個DNS伺服器的名字)A 網域名稱到ip地址的映射(正解)PTR ip地址到網域名稱的映射(反解)CNAME 設定別名MX 與郵件服務有關的徽記