安装所有bind套件以及其依赖的软件包
[root@dnsserver CentOS]# yum install bind*
查看安装了哪些
[root@dnsserver CentOS]# rpm -qa | grep bind
bind-chroot-9.3.6-4.P1.el5
bind-utils-9.3.6-4.P1.el5
bind-libs-9.3.6-4.P1.el5
ypbind-1.19-12.el5
bind-9.3.6-4.P1.el5
bind-libbind-devel-9.3.6-4.P1.el5
kdebindings-3.5.4-6.el5
bind-libbind-devel-9.3.6-4.P1.el5
bind-devel-9.3.6-4.P1.el5
[root@dnsserver CentOS]# yum install caching-nameserver-9.3.6-4.P1.el5.x86_64.rpm
由于chroot技术的使用,咱们BIND的配置文件name.conf还有区域文件都在/var/named/chroot/目录下
配置文件named.conf在/var/named/chroot/etc/下,而区域配置文件在/var/named/chroot/var/named/下
而在以前的默认路径/var/named下都是链接文件
ls -an /var/named/
drwxr-x--- 6 0 25 4096 05-15 17:36 chroot
drwxrwx--- 2 25 25 4096 02-23 06:35 data
lrwxrwxrwx 1 0 25 45 05-15 12:46 localdomain.zone -> /var/named/chroot//var/named/localdomain.zone
lrwxrwxrwx 1 0 25 43 05-15 12:46 localhost.zone -> /var/named/chroot//var/named/localhost.zone
lrwxrwxrwx 1 0 25 44 05-15 12:46 named.broadcast -> /var/named/chroot//var/named/named.broadcast
lrwxrwxrwx 1 0 25 37 05-15 12:46 named.ca -> /var/named/chroot//var/named/named.ca
lrwxrwxrwx 1 0 25 44 05-15 12:46 named.ip6.local -> /var/named/chroot//var/named/named.ip6.local
lrwxrwxrwx 1 0 25 40 05-15 12:46 named.local -> /var/named/chroot//var/named/named.local
lrwxrwxrwx 1 0 25 39 05-15 12:46 named.zero -> /var/named/chroot//var/named/named.zero
配置/var/named/chroot/etc/named.conf 主配置文件
1,cd /var/named/chroot/
2,cp etc/named.caching-nameserver.conf etc/named.conf
3,vim etc/named.conf
//改动地方红色标出
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";
};
修改etc/named.rfc1912.zones文件
vim etc/named.rfc1912.zones
zone "." IN {
type hint;
file "named.ca";
};
zone "localdomain" IN {
type master;
file "localdomain.zone";
allow-update { none; };
};
zone "localhost" IN {
type master;
file "localhost.zone";