‘dnsmasq’:无法通过名称 ping 客户端

‘dnsmasq’:无法通过名称 ping 客户端

这很有趣。我很想知道发生了什么。

在我的 DNS 上,我有两个定义可以修复给定 MAC 上的名称和 IP 地址:

dhcp-host=08:02:8E:93:12:73,192.168.178.10,switch0
dhcp-host=08:02:8E:8E:D8:2C,192.168.178.11,switch1

通过 IP 地址 ping 它们是可行的:

$ ping 192.168.178.10
PING 192.168.178.10 (192.168.178.10) 56(84) bytes of data.
64 bytes from 192.168.178.10: icmp_seq=1 ttl=64 time=3.12 ms

$ ping 192.168.178.11
PING 192.168.178.11 (192.168.178.11): 56 data bytes
64 bytes from 192.168.178.11: icmp_seq=0 ttl=64 time=3.743 ms

通过名称 ping 它们对其中一个不起作用,但对另一个却有效:

$ ping switch0
ping: switch0: No address associated with hostname

$ ping switch1
PING switch1.fritz.box (192.168.178.11): 56 data bytes
64 bytes from 192.168.178.11: icmp_seq=0 ttl=64 time=2.059 ms

日志的相关部分dnsmasq不太具启发性:

Dec 16 09:52:15 dnsmasq[352]: query[A] switch0.fritz.box from 192.168.178.15
Dec 16 09:52:15 dnsmasq[352]: cached switch0.fritz.box is NXDOMAIN
Dec 16 09:52:15 dnsmasq[352]: query[AAAA] switch0.fritz.box from 192.168.178.15
Dec 16 09:52:15 dnsmasq[352]: forwarded switch0.fritz.box to 149.112.112.112
Dec 16 09:52:15 dnsmasq[352]: reply switch0.fritz.box is NXDOMAIN
Dec 16 09:52:15 dnsmasq[352]: query[A] switch0 from 192.168.178.15
Dec 16 09:52:15 dnsmasq[352]: config switch0 is NODATA-IPv4
Dec 16 09:52:15 dnsmasq[352]: query[AAAA] switch0 from 192.168.178.15
Dec 16 09:52:15 dnsmasq[352]: config switch0 is NODATA-IPv6
Dec 16 09:52:18 dnsmasq[352]: query[A] switch1.fritz.box from 192.168.178.15
Dec 16 09:52:18 dnsmasq[352]: DHCP switch1.fritz.box is 192.168.178.11
Dec 16 09:52:18 dnsmasq[352]: query[AAAA] switch1.fritz.box from 192.168.178.15
Dec 16 09:52:18 dnsmasq[352]: forwarded switch1.fritz.box to 149.112.112.112
Dec 16 09:52:18 dnsmasq[352]: reply switch1.fritz.box is NODATA-IPv6
Dec 16 09:52:18 dnsmasq[352]: query[PTR] 11.178.168.192.in-addr.arpa from 192.168.178.15
Dec 16 09:52:18 dnsmasq[352]: DHCP 192.168.178.11 is switch1.fritz.box

答案1

确保switch0中列出了/var/lib/misc/dnsmasq.leases。如果没有,switch0则尚未分配有效的 DHCP 租约。如果交换机配置了静态 IP,则可能出现这种情况。

相关内容