反向 DNS 不正确(BIND9 DNS + ISC DHCP)

反向 DNS 不正确(BIND9 DNS + ISC DHCP)

在 Ubuntu 下的家庭网络中,我使用带有 Webmin 的 BIND9 DNS 服务器和 ISC DHCP 服务器。

这是我的设置:

DNS 主区域:

Foward: home.local
Reverse: 192.168.5

/etc/bind/named.conf.local:

// Key
key "DHCP_UPDATER" {
 algorithm hmac-sha256;  
 secret "xxx";
};

// Forward DNS Zone
zone "home.local" {
 type master;
 file "/var/lib/bind/home.local.hosts";
 update-policy {
 grant DHCP_UPDATER zonesub any;
 };
};

// Reverse DNS Zone
zone "5.168.192.in-addr.arpa" {
 type master;
 file "/var/lib/bind/192.168.5.rev";
 update-policy {
 grant DHCP_UPDATER zonesub any;
 };
};

/etc/dhcp/dhcpd.conf:

ddns-updates on;
ddns-update-style standard;
allow unknown-clients;
allow client-updates;
ddns-rev-domainname "5.168.192.in-addr.arpa";
ddns-domainname "home.local";
option domain-search "home.local";
option subnet-mask 255.255.255.0;
authoritative;
default-lease-time 600;
max-lease-time 7200;

## Key
key "DHCP_UPDATER" {
 algorithm hmac-sha256;  
 secret "xxx";
}

## Forward DNS Zone
zone home.local. {
 primary 192.168.5.2;
 key DHCP_UPDATER;
}

## Reverse DNS Zone
zone 5.168.192.in-addr.arpa. {
 primary 192.168.5.2;
 key DHCP_UPDATER;
}


# HOME
subnet 192.168.5.0 netmask 255.255.255.0 {
 option domain-name "home.local";
 option domain-name-servers 192.168.5.2 , 8.8.8.8;
 option broadcast-address 192.168.5.255;
 option routers 192.168.5.1;
 range 192.168.5.130 192.168.5.199;
}

如果我手动创建一个新的 DNS 条目,则一切都正常:

home.local(转发):

nas.home.local.   A   3600   192.168.5.254

192.168.5 (反向):

254.5.168.192.in-addr.arpa.  PTR   3600   nas.home.local.

如果是动态创建的,那么就会出现错误:

home.local(转发):

raspi01.home.local.   A   300   192.168.5.140
raspi01.home.local.   DHCID  300   xxx

192.168.5 (反向):[问题就在这里]

140.5.168.192.5.168.192.in-addr.arpa.   PTR   300   raspi01.home.local.

我做错了什么?

答案1

您的设置ddns-rev-domainname "5.168.192.in-addr.arpa"似乎不正确。它应该始终设置为"in-addr.arpa"。(请注意 dhcpd 始终添加满的将 IP 地址反转为提供的域名 - 它不会尝试猜测或计算;您提供的任何域名实际上都只是地址的后缀。)

相关内容