I have OS X Mountain Lion, latest updates installed.
Randomly after boot, I have no network connectivity from a user perspective. Web browsers are unable to display pages, no mail to tweets, no dropbox, no nothing.
What is broken is actually the name resolution (DNS) as I can ping local and remote IP address. The service which does the name resolution, mDNSResponder, correctly sends the DNS query, but does not see the DNS response, although one can see the paquets on the network.
How do I fix mDNSResponder (or what is blocking the DNS response) so that name resolution is always working?
My current investigation and detailed analysis
After investigation, I can ping local and remote IP address. Not names. I cannot use
dns-sd, even when I specify my local DNS resolver or a remote one (like 188.8.131.52 which I can ping). I always time out. The
Network Utility tool behave similarly to command line tools.
What is working is ping or traceroute of IP addresses.
Furthermore, sending the
mDNSResponder did log packets in
system.log. Only the queries are log, no answer are seen by mDNSResponder. However a simple network packets listening shows that both the DNS request and DNS response are properly received and sent. When I do the same thing with proper name resolution, I can see both the queries and answer in
Therefore, I disabled completely OS X firewall, and did the
launchctl unload/load sequence for mDNSResponder but this did not solve the problem. The service was still deaf and was not seeing any answer!
A "simple" reboot does often fix the problem (I had once to reboot twice to get it back working).
Normaly, I use DHCP for IP, router and DNS server. But even manually setting the network settings does not work. Although after a reboot those manual settings do work!
When this happens, other devices on the network continue to work as usual: iPad, NAS and a Linux box all work fine! Name resolution works wonder on those at the same time. Restarting the router does not solve the problem and after such a restart (when in this particular non-working mode) I often end-up having an automatic IP address in the case DHCP was configured (one of 169.254..) and a request for a new IP lease does not seem to get through with the same apparent deaf as the mDNSResponder.
When in this weird state, if I start a VM on the non-connected OS X box with a NAT network interface, the VM guest does behave like the OS X host, name resolution is unidirectional. However, if I start a VM with a bridge network interface, the guest does work properly receiving the DNS response!
Last but not least,
scutil --dns output when name resolution is failing is exactly identical to the same output when name resolution is working!