1.Centos5环境下相关BIND包
[root@localhost ~]# rpm -qa|grep bind
bind-libs-9.3.6-16.P1.el5
bind-chroot-9.3.6-16.P1.el5
bind-utils-9.3.6-16.P1.el5
ypbind-1.19-12.el5
bind-9.3.6-16.P1.el5
[root@localhost ~]# rpm -qa|grep caching
caching-nameserver-9.3.6-16.P1.el5
查看配置文件
[root@localhost etc]# ll /etc |grep named
lrwxrwxrwx 1 root named 52 05-07 00:32 named.caching-nameserver.conf -> /var/named/chroot//etc/named.caching-nameserver.conf
lrwxrwxrwx 1 root named 42 05-07 00:32 named.rfc1912.zones -> /var/named/chroot//etc/named.rfc1912.zones
lrwxrwxrwx 1 root named 31 02-28 20:50 rndc.key -> /var/named/chroot//etc/rndc.key
[root@localhost etc]# vi named.rfc1912.zones
// 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 "hbchen.com" IN {
type master;
file "hbchen.com.zone";
allow-update { none; };
};
zone "15.168.192.in-addr.arpa" IN {
type master;
file "192.168.15.zone";
allow-update { none; };
};
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 {
type master;
file "named.ip6.local";
allow-update { none; };
};
zone "255.in-addr.arpa" IN {
type master;
file "named.broadcast";
allow-update { none; };
};
zone "0.in-addr.arpa" IN {
type master;
file "named.zero";
allow-update { none; };
};
[root@localhost etc]# vi named.caching-nameserver.conf
//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver package to configure the
// ISC BIND named(8) DNS server as a caching only nameserver
// (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
// Those options should be used carefully because they disable port
// randomization
// query-source port 53;
// query-source-v6 port 53;
allow-query { any; };
allow-query-cache { localhost; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
match-clients { any; };
match-destinations { any; };
recursion yes;
include "/etc/named.rfc1912.zones";
};
建立正向区域
[root@localhost named]# cd /var/named/chroot/var/named
[root@localhost named]# cp -p localdomain.zone hbchen.com.zone
[root@localhost named]# vi hbchen.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.15.233
建立反向区域
[root@localhost named]# cp -p named.local 192.168.15.zone
[root@localhost named]# vi 192.168.15.zone
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
233 IN PTR www.hbchen.com.
添加dns配置文件
[root@localhost named]# vi /etc/resolv.conf
search localdomain
nameserver 192.168.15.233
注:此处为本机ip
测试dns
[root@localhost named]# nslookup
> www.hbchen.com
Server: 192.168.15.233
Address: 192.168.15.233#53
Name: www.hbchen.com
Address: 192.168.15.233
> 192.168.15.233
Server: 192.168.15.233
Address: 192.168.15.233#53
233.15.168.192.in-addr.arpa name = www.hbchen.com.
>
常见问题汇总
Not permit
切记用户属性和权限问题
chown -Rf named /var/named/chroot/var/named 可执行权限
selinux问题
[root@localhost named]# vi /etc/sysconfig/selinux
SELINUX=disabled
或者setup进入图形界面 ---防火墙---selinux 禁用
Iptables问题
开启dns解析端口53
Setup配置---定制
或者
vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 53 -j ACCEPT