Linux操作系統(tǒng)下配置DNS服務(wù)器的方法介紹 |
發(fā)布時(shí)間: 2012/8/11 11:09:53 |
有兩臺(tái)郵件服務(wù)器分別為192.168.1.1(windows下主機(jī)名為b.test.cn)和192.168.1.3(linux下主機(jī)名為a.test.com)。
在linux下配置DNS服務(wù)器,下面是配置過(guò)程中設(shè)置過(guò)的一些文件, /etc/hosts文件的具體內(nèi)容如下: #Donotremovethefollowingline,orvariousprograms #thatrequirenetworkfunctionalitywillfail. 127.0.0.1localhost.localdomainlocalhostfc4 192.168.1.3a.test.coma 192.168.1.1b.test.cnb /etc/host.conf文件: orderhosts,bind 表示先用hosts文件做解析,在用DNS解析 /etc/resolv.conf文件: ;generatedbyNetworkManager,donotedit! searchtest.com nameserver127.0.0.1 searchtest.cn nameserver192.168.1.1 nameserver61.144.56.100 /etc/named.conf文件: // //named.confforRedHatcaching-nameserver // options{ directory"/var/named"; dump-file"/var/named/data/cache_dump.db"; statistics-file"/var/named/data/named_stats.txt"; /* *Ifthereisafirewallbetweenyouandnameserversyouwant *totalkto,youmightneedtouncommentthequery-source *directivebelow.PreviousversionsofBINDalwaysasked *questionsusingport53,butBIND8.1usesanunprivileged *portbydefault. */ //query-sourceaddress*port53; }; // //acachingonlynameserverconfig // controls{ inet127.0.0.1allow{localhost;}keys{rndckey;}; }; zone"."IN{ typehint; file"named.ca"; }; zone"test.com"IN{ typemaster; file"test.com"; allow-update{none;}; }; zone"1.168.192.in-addr.arpa"IN{ typemaster; file"192.168.1.rev"; allow-update{none;}; }; zone"test.cn"IN{ typemaster; file"test.cn"; allow-update{none;}; }; zone"0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"IN{ typemaster; file"named.ip6.local"; allow-update{none;}; }; zone"255.in-addr.arpa"IN{ typemaster; file"named.broadcast"; allow-update{none;}; }; zone"0.in-addr.arpa"IN{ typemaster; file"named.zero"; allow-update{none;}; }; include"/etc/rndc.key"; 在/var/name/test.com文件下: $TTL86400 @INSOAa.test.com.root.a.test.com( 42;serial(d.adams) 3H;refresh 15M;retry 1W;expiry 1D);minimum INNSa.test.com. INMX10mail.test.com. aINA192.168.1.3 mailINA192.168.1.3 //其中root.a.test.com的含義是管理員的郵箱 /var/name/test.cn文件下: $TTL86400 @INSOAb.test.cn.root.a.test.com( 42;serial(d.adams) 3H;refresh 15M;retry 1W;expiry 1D);minimum INNSb.test.cn. INMX10mail.test.cn. bINA192.168.1.1 mailINA192.168.1.1 /var/name/192.168.1.rev文件下: $TTL86400 @INSOA1.168.192.in-addr.arpa.root.test.com.( 1997022700;Serial 28800;Refresh 14400;Retry 3600000;Expire 86400);Minimum INNSa.test.com. INNSb.test.cn. INMX10mail.test.com. INMX10mail.test.cn. 3INPTRa.test.com. 3INPTRmail.test.com. 1INPTRb.test.cn. 1INPTRmail.test.cn. 然后用/etc/init.d/namedrestart重啟DNS服務(wù),在重啟過(guò)程中,我曾經(jīng)出現(xiàn)過(guò)好幾次的錯(cuò)誤,按照出錯(cuò)的提示,會(huì)提示是named.conf文件第幾行出錯(cuò)的�;蛘咛崾驹谀切┌募鐃est.cn這些文件里面的問(wèn)題,然后一個(gè)一個(gè)排除。 最后還有一些nslookup的命令比較有用: setall用于顯示使用nslookup工具這臺(tái)機(jī)器上的DNS服務(wù)器的一些信息 settype=any會(huì)顯示完整信息包括域中郵件服務(wù)器和主從DNS服務(wù)器的名字和IP地址 server192.168.0.1更換查詢(xún)的DNS服務(wù)器地址。 本文出自:億恩科技【www.allwellnessguide.com】 服務(wù)器租用/服務(wù)器托管中國(guó)五強(qiáng)!虛擬主機(jī)域名注冊(cè)頂級(jí)提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM] |