在上一篇中我们成功的配置了主DNS服务器(Centos Bind配置完整版),这篇文章让我们来配置一下辅助dns。
定义如下: 主DNS服务器:192.168.1.250 辅助DNS服务器:192.168.1.251SourceByrd's Weblog-https://note.t4x.org/system/configure-secondary-dns/
1:修改主DNS的named.conf
0 1 2 3 4 5 6 7 8 9 |
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; |
主要是增加allow-transfer { 192.168.1.251; };这个内容。SourceByrd's Weblog-https://note.t4x.org/system/configure-secondary-dns/
2:修改主DNS的a.com.zone(和《Centos Bind配置完整版》文章关联)
0 1 2 3 4 5 6 7 8 9 10 11 12 13 |
$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 |
3:修改主DNS的反向[root@localhost named]# vi /var/named/192.168.1.zone
0 1 2 3 4 5 6 7 8 9 10 11 12 |
$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. |
4:递归配置
0 1 2 3 4 5 6 7 8 9 |
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; }; }; |
到此主DNS需要修改的已经完成,下面我们来修改一下辅助DNS的相关配置。SourceByrd's Weblog-https://note.t4x.org/system/configure-secondary-dns/
首先和配置主DNS一样,首选需要安装BIND的相关组件,如何安装请参考《Centos Bind配置完整版》。SourceByrd's Weblog-https://note.t4x.org/system/configure-secondary-dns/
1:named.conf参考主DNS配置。
0 1 2 3 4 5 6 7 8 9 |
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; 。。。。。。 |
2:修改[root@localhost etc]# vi /var/named/chroot/etc/named.rfc1912.zones
0 1 2 3 4 5 6 7 8 9 |
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; }; }; |
[root@localhost etc]# service named restartSourceByrd's Weblog-https://note.t4x.org/system/configure-secondary-dns/
主、辅dns的bind都重新启动一下。然后查看一下SourceByrd's Weblog-https://note.t4x.org/system/configure-secondary-dns/
[root@localhost /]# cd /var/named/slaves/目录下是否把192.168.1.zone和a.com.zone同步过来了。SourceByrd's Weblog-https://note.t4x.org/system/configure-secondary-dns/
[root@localhost slaves]# tail /var/log/messages 查看日志也可以。SourceByrd's Weblog-https://note.t4x.org/system/configure-secondary-dns/
[root@localhost data]# dig -t axfr a.com @192.168.1.250 可在192.168.1.251上测试传送是否正常。SourceByrd's Weblog-https://note.t4x.org/system/configure-secondary-dns/
到此基本就算是配置完成了。若有不当之处,请指正。谢谢。
申明:本文由BYRD原创(基于Centos6.4 X64),未经许可禁止转载!SourceByrd's Weblog-https://note.t4x.org/system/configure-secondary-dns/
SourceByrd's Weblog-https://note.t4x.org/system/configure-secondary-dns/