采用yum 安装
#yum install -y bind bind-chroot ypbind bind-utils caching-nameserver-9.3.*
主区域配置文件:
# cd /var/named/chroot/etc
新建一个named.conf
#touch named.conf
编辑: # vim named.conf
options {
directory "/var/named";
};
zone "." {
type hint;
file "named.ca";
};
zone "tech.org" {
type master;
file "tech.org.zone";
};
zone "31.168.192.in-addr.arpa" {
type master;
file "192.168.31.zone";
};
区域文件配置:
#cd /var/name/chroot/var/name
# vim tech.org.zone
$TTL 86400
@ IN SOA dns.tech.org. root (
2009091000
3H
1H
1W
0)
@ IN NS dns.tech.org.
dns IN A 192.168.31.132
client1 IN A 192.168.31.133
client2 IN A 192.168.31.134
client3 IN A 192.168.31.135
# vim 192.168.31.zone
$TTL 86400
@ IN SOA dns.tech.org. root.tech.org. (
2009091000
3H
1H
1W
0)
@ IN NS dns.tech.org.
132.31.168.192.in-addr.arpa. IN PTR dns.tech.org.
133 IN PTR client1.tech.org.
134 IN PTR client2.tech.org.
135 IN PTR client3.tech.org.
测试:
修改本机的:/etc/resolv.conf nameserver 127.0.0.1
#host 192.168.31.132
132.31.168.192.in-addr.arpa domain name pointer dns.tech.org.
#nslookup 192.168.31.133
Server: 127.0.0.1
Address: 127.0.0.1#53
133.31.168.192.in-addr.arpa name = client1.tech.org.
# dig -x 192.168.31.134
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-20.P1.el5_8.5 <<>> -x 192.168.31.134
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23985
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;134.31.168.192.in-addr.arpa. IN PTR
;; ANSWER SECTION:
134.31.168.192.in-addr.arpa. 86400 IN PTR client2.tech.org.
;; AUTHORITY SECTION:
31.168.192.in-addr.arpa. 86400 IN NS dns.tech.org.
;; ADDITIONAL SECTION:
dns.tech.org. 86400 IN A 192.168.31.132
;; Query time: 2 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sat Dec 29 21:32:10 2012
;; MSG SIZE rcvd: 109
通过以上测试,如果是和以上结果类似说明安装和配置已经成功