我花了很多时间来解决我的问题,但我没有完成我需要解决的问题。我认为可能是文件权限存在一些问题。我改变了我想使用以下命令从主服务器验证区域传输:
dig ns.insec -t axfr
这是来自主服务器的错误消息
Mar 16 03:49:30 ip-172-31-22-11 named[5395]: client 127.0.0.1#37251
(ns.insec): zone transfer 'ns.insec/AXFR/IN' denied
文件如下named.conf.options
:
acl "trusted" {
localhost;
172.31.0.0/20;
localnets;
};
options {
directory "/var/cache/bind";
// If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See http://www.kb.cert.org/vuls/id/800113
// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0's placeholder.
forwarders {
8.8.8.8;
};
//========================================================================
// If BIND logs error messages about the root key being expired,
// you will need to update your keys. See https://www.isc.org/bind-keys
//========================================================================
dnssec-validation auto;
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
forward only;
allow-query-cache { trusted; };
allow-query { trusted; };
allow-recursion { trusted; };
recursion yes;
allow-transfer { 172.31.31.48; 127.0.0.1; };
//also-notify { trusted; };
};
这是我的named.conf.local
文件:
//
// Do any local configuration here
//
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
zone "ns.insec" {
type master;
file "/etc/bind/zones/db.ns.insec";
allow-transfer { 172.31.31.48; };
also-notify { 172.31.31.48; };
};
// 172.31.31.48 is the IP for slave
// 172.31.22.11 is the IP for the master
zone "22.31.172.in-addr.arpa" {
type master;
file "/etc/bind/zones/db.172.31.22";
allow-transfer { 172.31.31.48; };
also-notify { 172.31.31.48; };
};
这是主服务器的文件权限快照,对于从属服务器也一样:
N:BI 可以dig ns.insec -t axfr
从从服务器运行,但不能从主服务器运行
答案1
任何选项的全局声明(在 中)都可以被同一选项的局部声明(例如在 中)覆盖options
。zone
view
您的情况也发生了同样的事情。
您有一个全局选项allow-transfer { 172.31.31.48; 127.0.0.1; };
,该选项被区域定义中的声明覆盖。zone "ns.insec"
因此allow-transfer { 172.31.31.48; };
,您将无法将区域转移到本地主机。
zone "ns.insec"
为了解决这个问题,请在以下位置进行声明
allow-transfer { 172.31.31.48; 127.0.0.1; };
或者,如果您想使用全局的(这并不总是一个好主意),请从定义中删除该allow-transfer
指令。zone "ns.insec"