I discovered recently an issue on a otherwise working server. It was updated in the past months so there may have been changed between the time when "everything was fine" and today.
This server hosts a dnsmasq
server which provides both DHCP and DNS services to:
- the server itself
- a set of containers running on this server (each with its own IP received from this
dnsmasq
) - clients in the LAN (wired, wireless)
I realized today that when I reboot the server:
- a client cannot resolve names anymore (
Ping request could not find host google.com. Please check the name and try again.
on a Windows box for instance) - an
nginx
server in one of the containers crashes at startup, not being able to resolve a name
The strange points:
dnsmasq
does run on the server and resolves names for that server (# ping google.com
works fine from within the server)- restarting
dnsmasq
fixes all the issues: all clients can now resolve names - at least for containers, the fact that they have an IP address means that
dnsmasq
served it to them, together with the DNS server information (= itself).
My main problem is: why would a restart of dnsmasq
fix the lack of resolution the clients? It is working for the server, the traffic between the clients and the server is not obstructed (even if it was, it is not the restart of dnsmasq
which would have solved that).
The only idea I have is that, maybe, when dnsmasq
is starting all the interfaces are not available yet. This is quite far fetched but maybe. Is there a way to check which interfaces dnsmasq
is bound to? (netstat
or lsof
will just show *.53
so it does not help)
The idea above does not seem correct for another reason: the containers receive their IP from dnsmasq
, so since they have one, dnsmasq
must have bound to their interface.
nameserver 127.0.0.1
dig
and how it behaves? Ifnetstat
shows*:53
that should mean all interfaces