我正在尝试使用 Bind9 (Linux) 部署 A dns Forwarder。我希望我的服务器能够分析请求并将其转发到外部 DNS(互联网)或内部使用条件实现。因此,我们将使用: DNS 转发器:将分析请求并将请求转发到内部或外部 DNS 的服务器 内部 DNS:仅解析内部名称(domain.company)的服务器 DNS:8.8.8.8 :解析外部地址
所以目标是当我尝试解析域名/URI 时。如果是内部请求,则应将其转发到内部 DNS,否则应将其转发到 8.8.8.8
Exemple1 : nslookup google.com should be forwarded to 8.8.8.8
Exemple2 : nslookup application.domain.company should be forwarded to internal dnsserver
这里是 /etc/named.conf 的内容
//
// named.conf
options {
listen-on port 53 { 127.0.0.1; };
listen-on-v6 { any; };
auth-nxdomain no;
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
recursion yes;
allow-query { 127.0.0.1; IPCLIENT2; IPclient1; };
forwarders {
8.8.8.8;
};
forward first;
dnssec-enable yes;
dnssec-validation auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.root.key";
managed-keys-directory "/var/named/dynamic";
pid-file "/run/named/named.pid";
session-keyfile "/run/named/session.key";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "domain.compagny" IN {
type forward;
forward only;
forwarders { IP_internaldns; };
};
zone "domain2.compagny" IN {
type forward;
forward only;
forwarders { IP_internaldns; };
};
#include "/etc/named.rfc1912.zones";
#include "/etc/named.root.key";
在这里,如果我执行:nslookup google.com or yahoo
它会正确解析但是如果我执行nslookup application.domain.compagny
它会显示:找不到 XXXXXXXX: SERVFAIL
谢谢