Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

After I installed Mountain Lion the other day I've noticed something very annoying. Almost every time I wake my iMac (27", mid-2010, CI7) from sleep: it seems that something DNS-related is broken. When I try connecting to other machines using their IP (v4 & v6) addresses I can SSH and send pings, but resolving host names isn't working very well.

Now I have not yet tried checking my DNS server logs to see if the requests are even making it there. Though I suspect that the DNS request are not making it to the DNS server since a quick reboot of the client machine or using another client machine works ok.

I've seen a couple of mentions of similar problems on other sites but no credible answers to why this problem appears, one user who was using WiFi apparently "fixed" it by toggling some random seemingly unrelated WiFi and sleep settings which just makes me suspect that this issue is some setting that got broken.

I'd love to find a reliable workaround/solution to this problem but I've double-checked all settings in the power management and network preference panes and it all looks fine. I have also tried re-saving the settings after making some changes and then reverting to the original settings just to see if that fixed it for me as well, no such luck. How to fix DNS resolving after wake from sleep?

Edit: I am only using wired networking myself and wifi is completely turned off. Both IPv4 and IPv6 settings have been made manually.

The network is a plain old 192.168.1.0/24 subnet with all machines connected to a fairly cheap managed gigE switch, 100/100 Mbps FTTH connection that goes to a FreeBSD box which acts as the gateway, dhcp (isc-dhcp for 192.168.1.1-72) and DNS (bind) server. IPv6 connectivity is through a Sixxs tunnel. Pretty standard setup that hasn't caused any problems in the past.

share|improve this question
    
Please, could you add a little more detail? You mention other people's use of Wi-Fi, but it's not clear whether your own issues are with wired or wireless networking, or both. –  Graham Perrin Jul 30 '12 at 23:18
    
@GrahamPerrin The network is a plain old 192.168.1.0/24 subnet with all machines connected to a fairly cheap managed gigE switch, 100/100 Mbps FTTH connection that goes to a FreeBSD box which acts as the gateway, dhcp (isc-dhcp for 192.168.1.1-72) and DNS (bind) server. IPv6 connectivity is through a Sixxs tunnel. Pretty standard setup that hasn't caused any problems in the past. –  mludd Aug 17 '12 at 4:09
    
@mludd Can you reproduce it (and if so, under what conditions?) I recommend running Console, (and ideally monitoring system.log), and then trying to reproduce the issue. When the machine wakes up, clear the console display and/or set a marker, and then try to browse. See what happens in the logs - it might indicate what's going on with DNS. –  Harv Aug 17 '12 at 4:57
    
Good ways to troubleshoot this: on your FreeBSD router, - turn on DNS logging and review the logs using 'tail' and/or - run tcpdump e.g. sudo tcpdump -vv -i en1 port 53 –  Matthew Elvey Apr 3 '13 at 21:50
add comment

2 Answers

I've had this exact same experience, though not every time. Sometimes it means sites that I have visited recently are unavailable but other sites I haven't visited in ages load just fine.

Usually flushing the DNS cache resolves it.

sudo killall -HUP mDNSResponder
share|improve this answer
1  
It seems restarting mDNSResponder doesn't help, networking still ends up half-dead most times I wake my machine from sleep. –  mludd Aug 3 '12 at 8:56
add comment

Occasionally I get this as well. When it happens, I tell the system to flush the DNS:

# As root or sudo it
dscacheutil -flushcache

In the power settings, to avoid sleep/wake related issues, I've disabled the system's "put disk to sleep" option, as apparently, it can cause issues with SSD equiped boxes.

share|improve this answer
add comment

protected by Community Jul 31 '12 at 14:40

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.