[root@ypser ~]# rpm -qa |grep bind //
查看
Bind
是否安装
bind-utils- 9.3.4 -10.P1.el5
bind- 9.3.4 -10.P1.el5
bind-libs- 9.3.4 -10.P1.el5
ypbind-1.19-11.el5
bind-chroot- 9.3.4 -10.P1.el5
[root@ypser ~]#
[root@ypser ~]# rpm -qa|grep caching-nameserver //
查看
caching-nameserver
是否安装
caching-nameserver- 9.3.4 -10.P1.el5
[root@ypser ~]#
[root@ypser ~]# rpm -ql caching-nameserver //
查看
caching-nameserver
所有安装文件
/etc/named.caching-nameserver.conf
/etc/named.conf
/etc/named.rfc1912.zones
/usr/share/doc/caching-nameserver- 9.3.4
/usr/share/doc/caching-nameserver- 9.3.4 /Copyright
/usr/share/doc/caching-nameserver- 9.3.4 /rfc1912.txt
/var/named/chroot/etc/named.caching-nameserver.conf
/var/named/chroot/etc/named.conf
/var/named/chroot/etc/named.rfc1912.zones
/var/named/chroot/var/named/localdomain.zone
/var/named/chroot/var/named/localhost.zone
/var/named/chroot/var/named/named.broadcast
/var/named/chroot/var/named/named.ca
[root@ypser ~]# vi /etc/named.rfc1912.zones //RedHat 5
或
Fedora 5
以上的版本
named..conf
被分为
named.caching-nameserver.conf
和
named.rfc1912.zones
options {
dirctory "/var/named";
};
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
zone "." IN {
type hint;
file "named.ca"; //
删除其他不要的文件只保留三个文件并修改
};
zone "test.net" IN {
type master;
file "test.net.zone";
allow-update { none; };
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "test.net.rev";
allow-update { none; };
};
[root@ypser ~]# cd /var/named/chroot//var/named/
[root@ypser named]# pwd
/var/named/chroot/var/named
[root@ypser named]# ll
drwxrwx--- 2 named named 1024 06-12 12:03 data
-rw-r----- 1 root named 198 2009-01-21 localdomain.zone
-rw-r----- 1 root named 195 2009-01-21 localhost.zone
-rw-r----- 1 root named 427 2009-01-21 named.broadcast
-rw-r----- 1 root named 1892 2009-01-21 named.ca
-rw-r----- 1 root named 424 2009-01-21 named.ip6.local
-rw-r----- 1 root named 426 2009-01-21 named.local
-rw-r----- 1 root named 427 2009-01-21 named.zero
drwxrwx--- 2 named named 1024 2004-07-27 slaves
[root@ypser named]#
[root@ypser named]#cp �Cp localhost.zone test.net.zone //
创建正向域文件
[root@ypser named]#cp �Cp named.local test.net.rev //
创建反向域文件
[root@ypser named]# vi test.net.zone
$TTL 86400
@ IN SOA dns.tset.net. root.test.net. (
42 ; serial (d. adams )
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS dns.test.net.
IN MX 5 mail.test.net.
dns IN A 192.168.0.99
mail IN A 192.168.0.100
www IN A 192.168.0.100
[root@ypser named]#
[root@ypser named]#
[root@ypser named]# vi test.net.rev
$TTL 86400
@ IN SOA dns.test.net. root.test.net. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS dns.test.net.
99 IN
PTR dns.test.net.
100 IN
PTR mail.test.net.
100 IN
PTR www.test.net.
[root@ypser named]#
[root@ypser ~]# ln -s /var/named/chroot//var/named/test.net.zone /var/named/test.net.zone
[root@ypser ~]# ln -s /var/named/chroot//var/named/test.net.rev /var/named/test.net.rev
[root@ypser ~]# service named restart
停止
named
:
[
确定
]
启动
named
:
named
配置错误:
:
/etc/named.rfc1912.zones:10: unknown option 'options'
[
失败
]
[root@ypser ~]# vi /etc/named.rfc1912.zones //冒号+10找到错误并修正
options {
dirctory "/var/named";
};
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
zone "." IN {
type hint;
file "named.ca";
};
zone "test.net" IN {
type master;
file "test.net.zone";
allow-update { none; };
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "test.net.rev";
allow-update { none; };
};
~
~
~
~
~
~
~
~
~
"/etc/named.rfc1912.zones" 27L , 520C written
[root@ypser ~]# service named restart
停止
named
:
[
确定
]
启动
named
:
[
确定
]
[root@ypser ~]# nslookup
> service 192.168.0.99
;; connection timed out; no servers could be reached //
命令错误应为
server192.168.0.99
修改服务器地址
[root@ypser ~]# rndc reload
server reload successful
[root@ypser ~]#
[root@ypser ~]# netstat -an |grep 53 //
检查
DNS
服务是否正常
tcp 0 0 127.0.0.1:53 0.0.0 .0:* LISTEN
tcp 0 0 127.0.0.1:953 0.0.0 .0:* LISTEN
tcp 0 0 ::1:53 :::* LISTEN
tcp 0 0 ::1:953 :::* LISTEN
udp 0 0 127.0.0.1:53 0.0.0 .0:*
udp 0 0 192.168.0.99:49614 202.96.128.86:53 ESTABLISHED
udp 0 0 0.0.0 .0:5353 0.0.0 .0:*
udp 0 0 ::1:53 :::*
udp 0 0 :::5353 :::*
unix 3 [ ] STREAM CONNECTED 10539 /var/run/acpid.socket
[root@ypser ~]# ping dns.test.net
PING
dns.test.net (192.168.0.99) 56(84) bytes of data.
64 bytes from dns.test.net (192.168.0.99): icmp_seq=1 ttl=64 time=0.026 ms
64 bytes from dns.test.net (192.168.0.99): icmp_seq=2 ttl=64 time=0.037 ms
64 bytes from dns.test.net (192.168.0.99): icmp_seq=3 ttl=64 time=0.026 ms
64 bytes from dns.test.net (192.168.0.99): icmp_seq=4 ttl=64 time=0.315 ms
64 bytes from dns.test.net (192.168.0.99): icmp_seq=5 ttl=64 time=0.025 ms
--- dns.test.net ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4001ms
rtt min/avg/max/mdev = 0.025/0.085/0.315/0.115 ms
[root@ypser ~]#
[root@ypser ~]# nslookup
> www.test.net
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: www.test.net
Address: 192.168.0.100
> dns.test.net
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: dns.test.net
Address: 192.168.0.99