【问题标题】:DNS Forward based on multiple conditions (Linux Bind)基于多个条件的 DNS 转发(Linux Bind)
【发布时间】:2021-04-02 22:48:10
【问题描述】:

我正在尝试使用 Bind9 (Linux) 部署 dns 转发器。 我希望我的服务器能够分析请求并将其转发到外部 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

谢谢

【问题讨论】:

    标签: linux dns centos bind9


    【解决方案1】:

    您的意思是“公司”还是“公司”?

    试试这些区域配置:

    zone "domain.company" {
            type forward;
            forwarders { IP_internaldns; };
    };
    zone "domain2.company" {
            type forward;
            forwarders { IP_internaldns; };
    };
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-03-16
      • 1970-01-01
      • 2018-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-19
      相关资源
      最近更新 更多