在这个问题之前,我一直在寻求一些帮助,以找到一种方法来根据他们的 IP 地址向查询客户端返回不同的响应。问题在这里得到了解答:如何选择性地覆盖绑定 DNS 服务器上的一些 A 记录?
我遵循了公认的答案,现在遇到了问题。
当我运行时:
nslookup faq.test.com
我期望这个:
root@dev:/etc/bind# nslookup vaultofsatoshi.com
Server: 172.16.225.132
Address: 172.16.225.132#53
Non-authoritative answer:
Name: faq.test.com
Address: 192.168.1.1
但是,我得到了这个:
root@dev:/etc/bind# nslookup faq.test.com
Server: 172.16.225.132
Address: 172.16.225.132#53
** server can't find faq.test.com: NXDOMAIN
我应该提到,查询 google.com 或任何其他网站都可以正常工作并返回一切正常,只是我覆盖它失败的那些。我在下面包含了我的配置文件,任何帮助将不胜感激。
/etc/bind/named.conf
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";
/etc/bind/named.conf.options
options {
directory "/var/cache/bind";
forwarders {
8.8.8.8;
8.8.4.4;
};
response-policy {
zone "development-overrides";
};
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
allow-query { trusted; };
allow-recursion { trusted; };
recursion yes;
dnssec-enable no;
dnssec-validation no;
};
/etc/bind/named.conf.local
include "/etc/bind/rndc.key";
acl "trusted" {
172.16.225.132;
127.0.0.1;
};
include "/etc/bind/zones.override";
logging {
channel bind_log {
file "/var/log/named/named.log" versions 5 size 30m;
severity info;
print-time yes;
print-severity yes;
print-category yes;
};
category default { bind_log; };
category queries { bind_log; };
};
/etc/bind/named.conf.default-zones
// prime the server with knowledge of the root servers
zone "." {
type hint;
file "/etc/bind/db.root";
};
// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912
zone "localhost" {
type master;
file "/etc/bind/db.local";
};
zone "127.in-addr.arpa" {
type master;
file "/etc/bind/db.127";
};
zone "0.in-addr.arpa" {
type master;
file "/etc/bind/db.0";
};
zone "255.in-addr.arpa" {
type master;
file "/etc/bind/db.255";
};
/etc/bind/development-overrides
$TTL 1H
@ SOA LOCALHOST. test.com (1 1h 15m 30d 2h)
NS LOCALHOST.
support.test.com A 192.168.1.1
faq.test.com A 192.168.1.1
; do not rewrite (PASSTHRU) OK.DOMAIN.COM
* A rpz-passthru.
RPZ 区域中的最后一行在语法上看起来无效。
RPZ 区域的语法与常规区域的语法相同,只是对 RPZ 有特殊的语义。
考虑到这一点,很明显,
A
记录不可能具有rpz-passthru.
它的价值。一条A
记录只能有一个 IPv4 地址作为它的值。如果您查看RPZ 文档,您会发现特殊的 RPZ 指令(如
rpz-passthru.
)使用CNAME
记录类型。named-checkconf -zj
和/或阅读日志通常会有所帮助。我假设,当使用问题中的区域数据时,RPZ 区域将无法加载,并且应该有错误(我预计会出现关于“坏虚线四边形”或类似内容的错误)。作为单独的说明,我不认为最后一行是真正需要的,它似乎只是(尝试)明确定义默认行为。