CentOS5.2安装配置DNS服务器
? ? ? ? type master;
? ? ? ? file "ooxx.com.zone";
? ? ? ? allow-update { none; };
};
zone "80.168.192.in-addr.arpa" IN {
? ? ? ? type master;
? ? ? ? file "192.168.80.zone";
? ? ? ? allow-update { none; };
};
//*请在此文件末尾追加以上内容。可以看见有这个配置文件里又引用了两个新的文件。
[root@CentOS ~]#cd /var/named/chroot/var/named/
[root@CentOS named]#cp -p localdomain.zone ooxx.com.zone
[root@CentOS named]#cp -p named.local 192.168.80.zone
?
编辑ooxx.com.zone:
[root@CentOS named]#vi ooxx.com.zone
$TTL ? ?86400
@ ? ? ? ? ? ? ? IN SOA ?localhost root (
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 42 ? ? ? ? ? ? ?; serial (d. adams)
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3H ? ? ? ? ? ? ?; refresh
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 15M ? ? ? ? ? ? ; retry
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1W ? ? ? ? ? ? ?; expiry
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1D ) ? ? ? ? ? ?; minimum
? ? ? ? ? ? ? ? IN NS ? ? ? ? ? localhost
www ? ? ? IN A ? ? ? ? ? ?192.168.80.198
?
编辑192.168.80.zone:
[root@CentOS named]#vi 192.168.80.zone
$TTL ? ?86400
@ ? ? ? IN ? ? ?SOA ? ? localhost. root.localhost. ?(
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1997022700 ; Serial
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 28800 ? ? ?; Refresh
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 14400 ? ? ?; Retry
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3600000 ? ?; Expire
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 86400 ) ? ?; Minimum
? ? ? ? IN ? ? ?NS ? ? ?ooxx.com.
198 ? IN ? ? ?PTR ? ?www.ooxx.com.
//注:最后一行198代表IP地址的最后一位,此行末尾有一句点“.”。
?
其中test.com.zone为正向解析文件,192.168.80.zone为反向解析文件。
?
以上即是配置主域名服务器过程。
下面谈一下从域名服务器的配置,其实只需要改动named.rfc1912.zones文件就可以,将此文件的如下部分:
zone "ooxx.com" IN {
? ? ? ? type master;
? ? ? ? file "ooxx.com.zone";
? ? ? ? allow-update { none; };
};
zone "80.168.192.in-addr.arpa" IN {
? ? ? ? type master;
? ? ? ? file "192.168.80.zone";
? ? ? ? allow-update { none; };
};
?
修改为:zone "ooxx.com" IN {
? ? ? ? type slave;
? ? ? ? file "slaves/ooxx.com.zone";
? ? ? ? masters { 192.168.80.198; };
};
zone "80.168.192.in-addr.arpa" IN {
? ? ? ? type slave;
? ? ? ? file "slaves/192.168.80.zone";
? ? ? ? masters { 192.168.80.198; };
};
?
三、测试
只有修改/etc/resolv.conf文件了,将DNS指向192.168.80.198以后,才能使以上的域名解析(测试)生效。
[root@CentOS ~]#vi /etc/resolv.conf
nameserver 192.168.80.198
[root@CentOS ~]#nslookup
>www.ooxx.com
Server: 192.168.80.198
Address: 192.168.80.198:53
?
?
?
?