一. 软件包安装
[root@centos6 cdrom]# yum install bind
[root@centos6 cdrom]# yum install bind-chroot
1. 把 /etc目录下面的named* 复制到/var/named/chroot/etc/下
[root@centos6 etc]# cp -a named* /var/named/chroot/etc/
[root@centos6 etc]# cd /var/named/chroot/etc
[root@centos6 etc]# cp -p named.conf named.confbak
[root@centos6 etc]# vi named.conf
修改为
listen-on port 53 { any; };
//listen-on-v6 port 53 {::1; };
allow-query { any; };
3. 配置正向反向配置文件[root@centos6 etc]# cd /var/named/chroot/etc
[root@centos6 etc]# cp -p named.rfc1912.zones named.rfc1912.zonesbak
[root@centos6 etc]# vi named.rfc1912.zones
添加一下内容:
zone "example.com" IN{
type master;
file "example.com.zone";
allow-update {none;};
};
zone "48.168.192.in-addr.arpa" IN {
type master;
file "192.168.48.zone";
allow-update {none;};
};
4. 复制
/var/named目录下的文件到
/var/named/chroot/var/named/
[root@centos6 etc]# cd /var/named
[root@centos6 named]# cp -a named* /var/named/chroot/var/named/
5.添加正向文件和反向文件,注意与3中文件名称一致
[root@centos6 named]# cd /var/named/chroot/var/named
[root@centos6 named]# touch example.com.zone
[root@centos6 named]# vi example.com.zone
正向文件内容如下:
[root@centos6 named]# cat example.com.zone
$TTL 86400
@ IN SOA dns.example.com. root.example.com. (
2011091200 ; serial
3H ; refresh
1H ; retry
1W ; expire
0) ; minimum
@ IN NS dns.example.com.
dns IN A 192.168.48.10
www IN A 192.168.48.10
添加反向文件:
[root@centos6 named]# touch 192.168.48.zone
[root@centos6 named]# vi 192.168.48.zone
反向文件内容如下:
[root@centos6 named]# cat 192.168.48.zone
$TTL 86400
@ IN SOA dns.example.com. root.example.com. (
2011091200 ; serial
3H ; refresh
1H ; retry
1W ; expire
0) ; minimum
@ IN NS dns.example.com.
10.48.168.192.in-addr.arpa. IN PTR dns.example.com.
6 IN PTR www.example.com.
6. 检查正向文件和反向文件配置是否有误
[root@centos6 named]# named-checkzone 192.168.48.zone /var/named/chroot/var/named/192.168.48.zone
/var/named/chroot/var/named/192.168.48.zone:10: ignoring out-of-zone data (10.48.168.192.in-addr.arpa)
zone 192.168.48.zone/IN: loaded serial 2011091200
OK
[root@centos6 named]# named-checkzone example.com /var/named/chroot/var/named/example.com.zone
zone example.com/IN: loaded serial 2011091200
OK
ok即为文件配置正确
7. 修改正向文件与反向文件所属组
[root@centos6 named]# chgrp named /var/named/chroot/var/named/192.168.48.zone
[root@centos6 named]# chgrp named /var/named/chroot/var/named/example.com.zone
[root@centos6 named]# service named status
rndc: neither /etc/rndc.conf nor /etc/rndc.key was found
named is stopped
[root@centos6 named]# service named start
Generating /etc/rndc.key:[ OK ]
Starting named: [ OK ]
[root@centos6 named]# nslookup 192.168.48.10
Server: 127.0.0.1
Address: 127.0.0.1#53
10.48.168.192.in-addr.arpa name = dns.example.com.
[root@centos6 named]# nslookup www.example.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: www.example.com
Address: 192.168.48.10
参考文档:
http://wenku.baidu.com/link?url=9vjPqPRvrZ8Np2_B7qzcBZ-R8nToeRX5n5V2FiZn4W_3-Mb6bMp9IlY2Czc-lLlqzUNAYQWDIbMPgH0U5cu7vbUsEehLhNqu30-0Y5n2Ii_
http://blog.163.com/wspjing@126/blog/static/11772053420124210151623/
http://wenku.baidu.com/link?url=kG1MhfGupJw-UMLkRJuE-kJXjTUunwbJ8REsZBJdVrrvTWqYsNf_2FxF1TQP-CNFCIMXMScq4tYPa24TessPuWLYg1hIenfqs_6Xl5mNJYy###
http://blog.csdn.net/guoyjoe/article/details/16982179