'dnsmasq' : Can't ping client by name

1

This is intriguing. I would love to know what is going on.

On my DNS I have two definitions that fix the name and IP-address on a given MAC:

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

Pinging them by IP-address works:

$ 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

Pinging them by name doesn't work for one but does work for the other:

$ 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

The relevant part of the log from dnsmasq isn't very revealing:

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

Mausy5043

Posted 2017-12-16T09:10:19.097

Reputation: 157

What is 192.167.178.15 and 149.112.112.112? – Tero Kilkanen – 2017-12-16T10:21:56.227

192.167.178.15 is the IP-address of a client doing the pinging. 149.112.112.112 is the IP-address of an upstream (external) DNS-server. – Mausy5043 – 2017-12-16T11:09:57.877

Answers

1

Make sure switch0 is listed in /var/lib/misc/dnsmasq.leases. If not, switch0 has not yet been assigned a valid DHCP lease. This could be the case if the switch is configured with a static IP.

tuntap

Posted 2017-12-16T09:10:19.097

Reputation: 156

The switch is set to acquire an IP via DHCP. – Mausy5043 – 2017-12-17T09:27:22.117

I'm guessing the switch doesn't re-acquire it's IP-address once it has expired. Thus, dnsmasq forgets about it, but pinging it by IP will then still work. – Mausy5043 – 2017-12-17T09:29:04.303

After powercycling the switch I could ping it by both name and IP. – Mausy5043 – 2017-12-17T09:29:56.470