3.vi /etc/named.conf 默認用六個配置。 我們復制 zone"localhsot" IN { type master; file "localhost.zone"; allow-update {nane; }; }; zone "0.0.127.in-addr.arpa" IN { type master; file "localhost.zone"; allow-update {none; }; };
粘貼到下面,修改一下域名和區(qū)域。
zone "xapc.com" IN { type master; file "xapc.com.zone"; allow-update {none; }; }; zone "13.168.192.in-addr.arpa" IN { type master; file "xapc.com.rev"; allow-update {none;}; };
:wq
4.#clear 5.#cd /var/named 6.#ll 7.#cp localhost.zone xapc.com.zone 8.#cp named.local xapc.com.rev 9.#vi xapc.com.zone --我們要修改里面的配置了 @ IN SOA root ( 42 ; serial(d.adams) 3H ; refresh 15M ; retry 1W ; expiry 1D ) ; minimum IN NS @ IN A 172.0.0.1 IN AAAA ::1 ---------------這是系統(tǒng)默認的配置。我們要修改了 @ IN SOA dns1.xapc.com. root.xapc.com. ( 42 ; serial(d.adams) 3H ; refresh 15M ; retry 1W ; expiry 1D ) ; minimum IN NS dns1.xapc.com. IN NS dns2.xapc.com. IN MX 5 mail.xapc.com. dns1 IN A 192.168.13.1 dns2 IN A 192.168.13.2 www IN CNAME dns1.xapc.com. ftp IN CNAME dns2.xapc.com. mail IN CNAME dns2.xapc.com.
:wq
10.#vi xapc.com.rev @ IN SOA localhost.root.localhost. ( 132323232 ; Serial 28808 ; Refresh 14400 ; Retry 3600000 ; Expire 86400 ) ; Mimimum IN NS localhost. 1 IN PTR localhost. -----------以上是默認的配置,我們要修改了 @ IN SOA dns1.xapc.com root.xapc.com. ( 132323232 ; Serial 28808 ; Refresh 14400 ; Retry 3600000 ; Expire 86400 ) ; Mimimum IN NS dns1.xapc.com. IN NS dns2.xapc.com.
1 IN PTR dns1.xapc.com. 1 IN PTR www.xapc.com. 2 IN PTR dns2.xapc.com. 2 IN PTR ftp.xapc.com. :wq 11.# named-checkconf --如果沒有提示說明成功了 12.# named-checkzone xapc.com xapc.com.zone 13.#service named restart
zone"localhsot" IN { type master; file "localhost.zone"; allow-update {nane; }; }; zone "0.0.127.in-addr.arpa" IN { type master; file "localhost.zone"; allow-update {none; }; }; -----這是它默認的配置,我們要添加配置內(nèi)容。 zone "xapc.com" IN { type slave; file "slaves/xapc.com.zone"; masters {192.168.13.1; }; }; zone "13.168.192.in-addr.arpa" IN { type slave; file "slaves/xapc.com.rev"; masters {192.168.13.1;}; }; :wq
9.#ll /var/named/ --可以看到九個文件 10.#ll /var/named/slaves/ total 0 11.#service named start 12.#ll /var/named/slaves -rw---- 1 named named 436 xapc.com.rev -rw---- 1 named named 424 xapc.com.zone 13.#nslookup ftp.xapc.com Server: 192.168.13.2 Address: 192.168.13.2#53
ftp.xapc.com canonical name = dns2.xapc.com. Name: dns2.xapc.com Address: 192.168.13.2
zone "xapc.com" IN { type slave; file "slaves/xapc.com.zone"; masters {192.168.13.1; }; }; zone "13.168.192.in-addr.arpa" IN { type slave; file "slaves/xapc.com.rev"; masters {192.168.13.1;}; }; ---- 這是前面配置好的結果,我們現(xiàn)在要在添加配置。
zone "pcgj.com" IN { type master; file "pcgj.com.zone"; allow-update {none; }; }; :wq
2.# cd /var/named 3.#ll 4.#cp localhost.zone pcgj.com.zone 5.#vi pcgj.com.zone @ IN SOA @ root ( 42 ; serial(d.adams) 3H ; refresh 15M ; retry 1W ; expiry 1D ) ; minimum IN NS @ IN A 172.0.0.1 IN AAAA ::1 ---------------這是系統(tǒng)默認的配置。我們要修改了 @ IN SOA dns.pcgj.com. root.pcgj.com.( 42 ; serial(d.adams) 3H ; refresh 15W ; retry 1W ; expiry 1D ) ; minimum IN NS dns.pcgj.com. dns IN A 192.168.13.2
:wq
6.#service named restart 7.#nslookup dns.pcgj.com Server: 192.168.13.2 Address: 192.168.13.2#53
好了 下面我們在講一個重要的內(nèi)容。 DNS子域的委派。 這兩臺服務器是父子關系。但兩個人各有各得dns服務器來解析。 好了,我們現(xiàn)在從輔助dns上開始吧。 1:#pwd /var/named 2: #vi /etc/named.conf zone "0.in-addr.arpa" IN { type master; file"named.zero"; allow-update{none; }; }; zone "pcgj.com" IN { type master; file "pcgj.com.zone"; allow-update {none; }; }; zone "xapc.com" IN { type forward; forward only; forwarders {192.168.13.1; }; };
----上面是前面修改好的我們要刪除一些配置, 下面在添加一些內(nèi)容。 zone "ca.xapc.com" IN { type master; file "ca.xapc.com.zone"; ailow-update {none; }; }; :ok 我們還要新建一個ca.xapc.com.zone文件
2.#ll 3.#cp pcgj.com.zone ca.xapc.com.zone 4.#vi ca.xapc.com.zone @ IN SOA dns.pcgj.com. root.pcgj.com.( 42 ; serial(d.adams) 3H ; refresh 15W ; retry 1W ; expiry 1D ) ; minimum IN NS dns.pcgj.com. dns IN A 192.168.13.2 ----這是前面我們修改好的文件,我們要修改它。 @ IN SOA dns.ca.xapc.com. root.ca.xapc.com.( 42 ; serial(d.adams) 3H ; refresh 15W ; retry 1W ; expiry 1D ) ; minimum
IN NS dns.ca.xapc.com. dns IN A 192.168.13.2 www IN A 192.168.13.1 :wq 5:# service named restart 6:# nslookup www.ca.xapc.com Server: 192.168.13.2 Address: 192.168.13.2#53
7:#nslookup www.ca.xapc.com ---不能解析的,因為沒有做委派,所以不能解析。 8:#vi /etc/named.conf 做委派是時候不需要修改主配置文件。 我們只需要修改xapc.com.zone這個住配置文件就好了 9:#vi xapc.com.zone @ IN SOA dns1.xapc.com. root.xapc.com. ( 42 ; serial(d.adams) 3H ; refresh 15M ; retry 1W ; expiry 1D ) ; minimum IN NS dns1.xapc.com. IN NS dns2.xapc.com. IN MX 5 mail.xapc.com. dns1 IN A 192.168.13.1 dns2 IN A 192.168.13.2 www IN CNAME dns1.xapc.com. ftp IN CNAME dns2.xapc.com. mail IN CNAME dns2.xapc.com. -------這是前面我們修改好的, 我們還要修改此文件。
@ IN SOA dns1.xapc.com. root.xpac.com.( 42 ; serial(d.adams) 3H ; refresh 15M ; retry 1W ; expiry 1D ) ; minimum IN NS dns.ca.xapc.com. IN NS dns1.xapc.com. IN NS dns2.xapc.com. IN MX 5 mail.xapc.com. dns1 IN A 192.168.13.1 dns2 IN A 192.168.13.2 www IN CNAME dns1.xapc.com. ftp IN CNAME dns2.xapc.com. mail IN CNAME dns2.xapc.com. dns.ca IN A 192.168.13.2
:wq
10:#services named restart 11:#nslookup www.ca.xapc.com Server: 192.168.13.1 Address: 192.168.13.1#53