歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> CentOs DNS功能的實現

CentOs DNS功能的實現

日期:2017/3/1 16:32:27   编辑:關於Linux
CentOs DNS功能的實現 首先配置好linux的網絡連接! 1、安裝相關的套件 www.2cto.com [root@localhost ~]# yum -y install bind bind-chroot 2、配置實驗的環境 [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.192 mail IN A 192.168.1.192 im IN A 192.168.1.193 c1 IN A 192.168.1.12 c1 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.com 192 IN PTR mail.ethnicity.com 193 IN PTR im.ethnicity.com [root@localhost named]# /etc/init.d/named restart 4、配置驗證環境(在linux本身進行測試) [root@localhost named]# vi /etc/resolv.conf ; generated by /sbin/dhclient-script search ethnicity.com nameserver 192.168.1.192 5、驗證 [root@localhost named]# nslookup > ftp.ethnicity.com Server: 192.168.1.192 Address: 192.168.1.192#53 Name: ftp.ethnicity.com Address: 192.168.1.192 > 192.168.1.193 Server: 192.168.1.192 Address: 192.168.1.192#53 193.1.168.192.in-addr.arpa name = im.ethnicity.com.1.168.192.in-addr.arpa. > mail.ethnicity.com Server: 192.168.1.192 Address: 192.168.1.192#53 Name: mail.ethnicity.com Address: 192.168.1.192 > www.nyist.net Server: 192.168.1.192 Address: 192.168.1.192#53 Non-authoritative answer: Name: www.nyist.net Address: 202.102.240.88 > www.google.com Server: 192.168.1.192 Address: 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.com Address: 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 與郵件服務有關的徽記
Copyright © Linux教程網 All Rights Reserved