本文共 3427 字,大约阅读时间需要 11 分钟。
操作系统版本:
[root@test ~]# cat /etc/issueRed Hat Enterprise Linux AS release 4 (Nahant Update 4)Kernel r on an m内核:
[root@test ~]# uname -aLinux test 2.6.9-42.EL #1 Wed Jul 12 23:16:43 EDT 2006 i686 i686 i386 GNU/Linux[root@test ~]# 需要安装的软件:[root@test ~]# rpm -aq | grep bindbind-9.2.4-16.EL4bind-utils-9.2.4-16.EL4bind-chroot-9.2.4-16.EL4bind-libs-9.2.4-16.EL4ypbind-1.17.2-8[root@test ~]# rpm -aq | grep caching-nameservercaching-nameserver-7.3-3[root@test ~]# 1,修改配置文件:[root@test etc]# pwd/var/named/chroot/etc[root@test etc]# vi named.conf添加如下行到配置文件中
zone "example.com" IN{ type master; file "example.com.zone";};zone "25.172.in-addr.arpa" IN {
type master; file "example.com.local";};2,添加zone文件:
[root@test etc]# cd ../var/named/[root@test named]# pwd/var/named/chroot/var/named[root@test named]# lsdata localdomain.zone localhost.zone named.broadcast named.ca named.ip6.local named.local named.zero slaves[root@test named]# cp localdomain.zone example.com.zone[root@test named]# cp named.local example.com.local[root@test named]#3,修改example.com.zone文件,在文件末尾添加A记录:
. IN A 172.25.1.111bbs IN A 172.25.1.112第一行是完整写法,第二行是省略写法,效果一样。
4,修改example.com.local文件,在文件末尾添加PTR记录:
111.1.25.172.IN-ADDR-ARPA IN PTR .112 IN PTR bbs.example.com.5,修改这个两个文件的权限。
[root@test named]# chmod 644 example.com.*[root@test named]#6,启动named.
[root@test named]# service named startStarting named: [ OK ][root@test named]#启动的日志信息:
Apr 14 13:21:19 test named[22327]: starting BIND 9.2.4 -u named -t /var/named/chrootApr 14 13:21:19 test named[22327]: using 1 CPUApr 14 13:21:19 test named[22327]: loading configuration from '/etc/named.conf'Apr 14 13:21:19 test named[22327]: listening on IPv4 interface lo, 127.0.0.1#53Apr 14 13:21:19 test named[22327]: listening on IPv4 interface eth0, 172.25.1.114#53Apr 14 13:21:19 test named[22327]: command channel listening on 127.0.0.1#953Apr 14 13:21:19 test named[22327]: zone 0.in-addr.arpa/IN: loaded serial 42Apr 14 13:21:19 test named[22327]: zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700Apr 14 13:21:19 test named[22327]: zone 25.172.in-addr.arpa/IN: loaded serial 1997022700Apr 14 13:21:19 test named[22327]: zone 255.in-addr.arpa/IN: loaded serial 42Apr 14 13:21:19 test named[22327]: 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: loaded serial 1997022700Apr 14 13:21:19 test named[22327]: zone example.com/IN: loaded serial 42Apr 14 13:21:19 test named[22327]: zone localdomain/IN: loaded serial 42Apr 14 13:21:19 test named[22327]: zone localhost/IN: loaded serial 42Apr 14 13:21:19 test named[22327]: runningApr 14 13:21:19 test named: named startup succeeded 7, 配置dns客户机.[root@test named]# cat /etc/resolv.conf search example.comnameserver 172.25.1.114[root@test named]#8, 测试:
正向解析可以,逆向解析有问题:[root@test named]# nslookup > 172.25.1.111Server: 172.25.1.114Address: 172.25.1.114#53** server can't find 111.1.25.172.in-addr.arpa: NXDOMAIN
> Server: 172.25.1.114Address: 172.25.1.114#53Name:
Address: 172.25.1.111> exit[root@test named]#
9,修改反向解析的配置文件,把最后两行更改为:111.1 IN PTR .112.1 IN PTR bbs.example.com.这个是简单配置。 重启named服务,然后测试就可以了。[root@test named]# nslookup > 172.25.1.111Server: 172.25.1.114Address: 172.25.1.114#53111.1.25.172.in-addr.arpa name = .
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/312079/viewspace-245868/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/312079/viewspace-245868/