Dns

使用 Bind9 進行正向反向查找

  • January 30, 2020

我有一個安裝了 Bind9 的 DNS 伺服器,它有 IP 192.168.145.119。這可以作為 IP 上的 DNS 伺服器的解析器192.168.145.1

ping我已經設置,所以它在使用、使用等時作為轉發器工作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";

域.conf

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

db.domain

;
; 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.

在其中一種配置中,我有很多空白區域。我不得不添加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";

引用自:https://unix.stackexchange.com/questions/564958