在上一篇中我们成功的配置了主DNS服务器(Centos Bind配置完整版),这篇文章让我们来配置一下辅助dns。
定义如下: 主DNS服务器:192.168.1.250 辅助DNS服务器:192.168.1.251
1:修改主DNS的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";
allow-transfer { 192.168.1.251; };
allow-query { 192.168.1.0/24; };
recursion yes;
0
1
2
3
4
5
6
7
8
9
options{
listen-onport53{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";
allow-transfer{192.168.1.251;};
allow-query{192.168.1.0/24;};
recursionyes;
主要是增加allow-transfer { 192.168.1.251; };这个内容。
2:修改主DNS的a.com.zone(和《Centos Bind配置完整版》文章关联)
$TTL 600
@ IN SOA ns.a.com admin.a.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns
IN A 192.168.1.250
IN AAAA ::1
www IN A 192.168.1.191
ns IN A 192.168.1.250
ns1 IN A 192.168.1.251
qwer IN A 4.3.2.1
0
1
2
3
4
5
6
7
8
9
10
11
12
13
$TTL600
@INSOAns.a.comadmin.a.com.(
0;serial
1D;refresh
1H;retry
1W;expire
3H);minimum
INNSns
INA192.168.1.250
INAAAA::1
wwwINA192.168.1.191
nsINA192.168.1.250
ns1INA192.168.1.251
qwerINA4.3.2.1
3:修改主DNS的反向[root@localhost named]# vi /var/named/192.168.1.zone
$TTL 1D
@ IN SOA a.com admin.a.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 127.0.0.1
AAAA ::1
250 IN PTR ns.a.com.
1.2.3.4 IN PTR qwer.a.com.
251 IN PTR ns1.a.com.
0
1
2
3
4
5
6
7
8
9
10
11
12
$TTL1D
@INSOAa.comadmin.a.com.(
0;serial
1D;refresh
1H;retry
1W;expire
3H);minimum
NS@
A127.0.0.1
AAAA::1
250INPTRns.a.com.
1.2.3.4INPTRqwer.a.com.
251INPTRns1.a.com.
4:递归配置
zone "a.com" IN { #这个是正向
type master;
file "a.com.zone";
allow-transfer { 192.168.1.251; };
};
zone "1.168.192.in-addr.arpa" IN { #这个是反向
type master;
file "192.168.1.zone";
allow-transfer { 192.168.1.251; };
};
0
1
2
3
4
5
6
7
8
9
zone"a.com"IN{#这个是正向
typemaster;
file"a.com.zone";
allow-transfer{192.168.1.251;};
};
zone"1.168.192.in-addr.arpa"IN{#这个是反向
typemaster;
file"192.168.1.zone";
allow-transfer{192.168.1.251;};
};
到此主DNS需要修改的已经完成,下面我们来修改一下辅助DNS的相关配置。
首先和配置主DNS一样,首选需要安装BIND的相关组件,如何安装请参考《Centos Bind配置完整版》。
1:named.conf参考主DNS配置。
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";
allow-query { 192.168.1.0/24; };
recursion yes;
。。。。。。
0
1
2
3
4
5
6
7
8
9
options{
listen-onport53{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";
allow-query{192.168.1.0/24;};
recursionyes;
。。。。。。
2:修改[root@localhost etc]# vi /var/named/chroot/etc/named.rfc1912.zones
zone "a.com" IN {
type slave;
file "slaves/a.com.zone";
allow-update { none; };
};
zone "1.168.192.in-addr.arpa" IN {
type slave;
file "slaves/192.168.1.zone";
allow-update { none; };
};
0
1
2
3
4
5
6
7
8
9
zone"a.com"IN{
typeslave;
file"slaves/a.com.zone";
allow-update{none;};
};
zone"1.168.192.in-addr.arpa"IN{
typeslave;
file"slaves/192.168.1.zone";
allow-update{none;};
};
[root@localhost etc]# service named restart
主、辅dns的bind都重新启动一下。然后查看一下
[root@localhost /]# cd /var/named/slaves/目录下是否把192.168.1.zone和a.com.zone同步过来了。
[root@localhost slaves]# tail /var/log/messages 查看日志也可以。
[root@localhost data]# dig -t axfr a.com @192.168.1.250 可在192.168.1.251上测试传送是否正常。
到此基本就算是配置完成了。若有不当之处,请指正。谢谢。
申明:本文由BYRD原创(基于Centos6.4 X64),未经许可禁止转载!