使用 Bind9 进行正向反向查找

使用 Bind9 进行正向反向查找

我有一个安装了 Bind9 的 DNS 服务器,它有 IP 192.168.145.119。它充当 IP 上 DNS 服务器的解析器192.168.145.1

ping我已经设置了,因此它在使用、 using等时可以充当转发器。dig我还设置了一个带有 CNAME 的区域。这有效美好的, 如预期。但是,反向查找不起作用。如果我运行nslookup 192.168.145.96我会得到:
** server can't find 96.145.168.192.in-addr.arpa: NXDOMAIN

我该如何解决这个问题?

这是我的named.conf

include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";

options {
   directory "/var/cache/bind";
   recursion yes;
   allow-query { any; };
   allow-transfer {
    localhost;
    # Bind9 slave
    192.168.145.218;
   };

   forwarders {
      192.168.145.1;
   };
   dnssec-enable no;
   dnssec-validation false;
   auth-nxdomain no; # conform to RFC1035
   listen-on-v6 { any; };
};
include "/etc/bind/domain.conf";

域配置文件

zone "domain" {
    type master;
    file "/etc/bind/zones/db.domain";
    allow-transfer {
       192.168.145.218;
    };
    notify yes;
};

数据库域

;
; BIND reverse data file for broadcast zone
;
$TTL    604800
@   IN  SOA ns1.domain admin.domain. (
            202001161   ; Serial
            604800      ; Refresh
            86400       ; Retry
            2419200     ; Expire
            604800  )   ; Negative Cache TTL
;

        IN  NS  ns1.domain.
        IN  NS  ns2.domain.
ns1.domain.    IN  A   192.168.145.119
ns2.domain.    IN  A   192.168.145.218
docker-registry-vm1.domain    IN  CNAME    docker-registry-vm1.internal.
dns-master-vm1.domain.    IN  CNAME    dns-master-vm1.internal.
dns-slave-vm1.domain.    IN  CNAME    dns-slave-vm1.internal.

答案1

在其中一种配置中,我有很多空白区域。我必须添加empty-zones-enable no;到我的named.conf.

现在看起来像这样:

include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";

options {
   directory "/var/cache/bind";
   recursion yes;
   allow-query { any; };
   empty-zones-enable no;
   allow-transfer {
    localhost;
    #Bind9 slave
    192.168.145.167;
   };

   forwarders {
      192.168.145.1;
   };
   dnssec-enable false;
   dnssec-validation false;
   auth-nxdomain yes; # conform to RFC1035
   listen-on-v6 { any; };
};
include "/etc/bind/domain.conf";

相关内容