我创建了一个基于bind9的DNS服务器,只在转发模式下工作:
这是我的named.conf.options文件:
#acl goodclients {
# localhost;
# 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.
recursion yes;
#allow-query { goodclients; };
forwarders {
8.8.8.8;
8.8.4.4;
};
forward only;
//========================================================================
// 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; };
};我配置了客户机,一切正常,但我得到了如下错误:
May 15 08:54:49 digitalocean named[3294]: client x.x.x.x#8137 (unix.stackexchange.com): query (cache) 'unix.stackexchange.com/A/IN' denied其中x.x是我的公共IP地址。
请注意,DNS服务器是公共的,我在客户端配置中使用它的公共IP。
我应该忽略错误消息吗?
当我使用DNS服务器(Y.Y)的公共IP挖掘google.com时:
dig @y.y.y.y google.com
; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> @y.y.y.y google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 28091
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;google.com. IN A
;; Query time: 15 msec
;; SERVER: y.y.y.y#53(y.y.y.y)
;; WHEN: Sun May 15 14:57:56 CEST 2016
;; MSG SIZE rcvd: 39这太让人困惑了。
发布于 2016-05-15 14:06:53
找到了。解决办法是增加:
allow-query {
any;
};编辑: Ribeiro的解决方案有效,但我需要创建一个公共服务器。如果您想避免安全问题,请参阅评论。
发布于 2016-05-15 14:09:10
它无法工作,因为您已经注释掉了allow-query和goodclients指令。您应该取消对它们的注释,并使用is /networks来填充goodclients以回答查询。
acl goodclients {
localhost;
x.x.x.0/24;
};
options {
...
allow-query { goodclients; };
}来自http://www.zytrax.com/books/dns/ch7/queries.html#allow-query
允许查询定义了IP地址(Es)的匹配列表,该列表允许向服务器发出查询。
另外,请注意,从BIND 9.4.1-P1开始,allow-query的默认行为从允许变为禁止。
https://unix.stackexchange.com/questions/283276
复制相似问题