![DHCP 定义的本地 DNS 地址没有响应](https://linux22.com/image/803939/DHCP%20%E5%AE%9A%E4%B9%89%E7%9A%84%E6%9C%AC%E5%9C%B0%20DNS%20%E5%9C%B0%E5%9D%80%E6%B2%A1%E6%9C%89%E5%93%8D%E5%BA%94%20.png)
我在我的网络上的 10.0.0.2 上设置了一个绑定 DNS 服务器。named.conf 如下所示:
options {
directory "/var/named";
pid-file "/run/named/named.pid";
auth-nxdomain yes;
datasize default;
listen-on-v6 { any; };
allow-recursion { any; };
allow-transfer { none; };
allow-update { none; };
version none;
hostname none;
server-id none;
forwarders {
8.8.8.8;
8.8.4.4;
};
// samba DLZ key
tkey-gssapi-keytab "/var/lib/samba/private/dns.keytab";
};
//SAMBA: allows automatic update of active directory names
dlz "AD DNS Zone" {
database "dlopen /usr/lib/samba/bind9/dlz_bind9_9.so";
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-transfer { any; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "127.0.0.zone";
allow-transfer { any; };
};
// Lets me do reverse lookups on LAN IPs
zone "0.10.in-addr.arpa" IN {
type master;
file "10.0.zone";
allow-transfer { any; };
};
// Definitions for root name servers
zone "." IN {
type hint;
file "root.hint";
};
当我在另一台机器上执行类似操作时nslookup google.com 10.0.0.2
,DNS 服务器会返回应有的响应。
但是,当我将 10.0.0.2 定义为调制解调器/路由器上的 DNS 服务器时(我认为这是 DHCP 的一部分,但我不是专家,所以我可能错了 - 如果您能提供一些见解,我将不胜感激),nslookup google.com
返回如下内容:
DNS request timed out.
timeout was 2 seconds.
*** Can't find server name for address 10.0.0.1: Timed out
*** Default servers are not available
Server: UnKnown
Address: 10.0.0.1
10.0.0.1 是我的路由器的地址。
作为参考,我将此 DNS 服务器地址放入我的路由器中,其描述如下:
DNS Server Configuration
If 'Enable Automatic Assigned DNS' checkbox is selected, this router will accept the first received DNS assignment from one of the PPPoA, PPPoE or MER/DHCP enabled PVC(s) during the connection establishment. If the checkbox is not selected, enter the primary and optional secondary DNS server IP addresses. Click 'Save' button to save the new configuration. You must reboot the router to make the new configuration effective.
我究竟做错了什么?
答案1
您的路由器(通常)宣布自己是网络中所有 PC 的 DNS 解析器。现在您将其配置为使用 10.0.0.2 进行查找,但似乎不可能这样做 - 它只能在 WAN 接口(“外部”、“内部网络”)上进行查找。
不幸的是,您似乎无法编辑 DHCP 设置,您必须在任何一台机器上手动添加 10.0.0.2 作为 DNS 服务器。
(编辑:如果可能的话,您可以禁用路由器/调制解调器上的 DHCP,并将 DHCP 添加到 10.0.0.2 上的服务器,这样您就可以推送更多设置)