绑定9.10视图中的指令不起作用

命名版本: BIND 9.10.3-P4 (最新版本),操作系统版本: CentOS 6.3CentOS 6.7

从9.10开始,我需要在不同的视图中使用共享区域.ISC Bind不支持在不同视图中为同一区域使用相同的文件。 试图这样做会导致错误:

/etc/named.conf:21: writeable file 'slaves/example.db': already in use: /etc/named.conf:8 

文档build议使用视图中的语句。 serverfault中的Brandon Xavierbuild议一样的。 但是,我失败了。 这里是我试图加载的简化的configuration文件:

 view "internal" { zone example.com { type slave; file "slaves/example.db"; masters { 192.168.1.1; }; }; }; view "external" { zone example.com { in-view "internal"; }; }; 

从外部视图中删除区域example.com允许启动。 configuration它到单独的文件也可以工作:

 zone example.com { type slave; file "slaves/example2.db"; masters { 192.168.1.1; }; }; 

但指向一个不同的文件是不是一个选项 – 在此我只提供了实际configuration的例子。 另外当绑定试图启动时,没有错误信息的输出,也没有任何日志:

 # /etc/init.d/named restart Stopping named: [ OK ] Starting named: Error in named configuration: [FAILED] 

这不是很好吗? 名为checkconf不显示任何错误(我删除了逗号或括号 – checkconf工程)。 我也从9.10.3-P4 sources.tar.gz(bin / test / system / ..)取得configuration文件,结果是一样的。 我应该报告一个错误?

让我们来看看/ usr / sbin / named-checkconf做了什么并返回。 该男子说:“如果检测到错误,named-checkconf返回退出状态1,否则返回0。 很好,让我们编写一个脚本来检查有效的命名configuration的返回值:

 #!/bin/bash /usr/sbin/named-checkconf -z /etc/named.conf >/dev/null 2>&1 echo $? /usr/sbin/named-checkconf /etc/named.conf >/dev/null 2>&1 echo $? 

输出将是10 。 如果我们在named.conf中input一个错误(例如缺less分号),结果将会是11 。 这是什么意思? 这意味着即使configuration中没有错误,返回代码也是1,但使用了-z密钥 – 任何输出都被视为错误 。 删除2>&1只保留stderr没有任何作用,因此对于这个问题,最简单的临时解决方法是通过在/etc/sysconfig/named以下指令来删除-z选项

 DISABLE_ZONE_CHECKING="yes" 

PS在BIND 9.10.1-RedHat-9.10.1-0.el6上运行上述脚本,会在有效的命名configuration上生成00 。 并得出一个结论:这是一个在named-checkconf返回值的bug,当正常输出结果1返回代码时。 错误与解释,testing和configuration将被提交给ISC。

NB! 这个解决scheme是暂时的,直到修复实施。 禁用区域检查将不会在区域中发现错误,缺less声明文件等。仅在使用in-view指令时禁用它。

在CentOS 6上没有任何问题

 # ./named -v BIND 9.10.3-P4 <id:ebd72b3> # ./named -V BIND 9.10.3-P4 <id:ebd72b3> built by make with '--prefix=/opt/bind-9.10.3-P4' '--with-libtool' '--with-dlz-stub' '--with-dlz-filesystem' '--with-dlopen' '--without-idn' compiled by GCC 4.4.7 20120313 (Red Hat 4.4.7-16) compiled with OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013 linked to OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013 compiled with libxml2 version: 2.7.6 linked to libxml2 version: 20706 # ./rndc status version: BIND 9.10.3-P4 <id:ebd72b3> boot time: Mon, 21 Mar 2016 11:44:26 GMT last configured: Mon, 21 Mar 2016 11:44:26 GMT CPUs found: 4 worker threads: 4 UDP listeners per interface: 2 number of zones: 3 debug level: 3 xfers running: 0 xfers deferred: 0 soa queries in progress: 0 query logging is OFF recursive clients: 0/0/1000 tcp clients: 0/100 server is up and running 

PS

 # lsb_release -a LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch Distributor ID: CentOS Description: CentOS release 6.7 (Final) Release: 6.7 Codename: Final