我知道要在 BIND 中禁用递归查询,我需要将以下行添加到选项部分 /etc/bind/named.conf.options
allow-transfer {"none";};
allow-recursion {"none";};
recursion no;
Run Code Online (Sandbox Code Playgroud)
上述配置是否会禁用所有 DNS 递归查询?
如何仅对外部网络查询禁用 DNS 递归并仅对内部网络保持递归?
如果我禁用递归,那么 BIND 解析名称请求将执行什么过程?迭代还是逆向?
您可以为使用视图的某些客户端启用递归并为其他客户端禁用递归,但不建议这样做,因为您将失去首先关闭递归的一些优势。您应该使用不同的名称服务器进行递归解析和权威服务。(如有必要,两台服务器可以在同一台机器上运行。)不过,这里是如何做到的:
// global options apply to external clients
options {
recursion no;
additional-from-auth no;
additional-from-cache no;
};
view "local" in {
// view options enable recursion only for local clients
match-clients { 172.16.45.80/23; 192.168.12.0/24; 127.0.0.1/8; ::1; };
recursion yes;
additional-from-auth yes;
additional-from-cache yes;
zone "." in {
type hint;
file "/etc/bind/db.root";
};
// put definitions for zones like "localhost" and "127.in-addr.arpa" here
}
// put definitions for real authoritative zones here.
Run Code Online (Sandbox Code Playgroud)
至于你最后一句话中的问题“BIND解析名称请求会执行什么过程?迭代还是逆向?”,我不明白这个问题。配置为不提供递归服务的名称服务器将简单地拒绝回答递归查询。