A short time ago, my MacBook Pro developed a new and annoying habit. After putting it to sleep by closing the clamshell, and then waking it, the WiFi network wasn’t working.
Safari would report “You are not connected to the Internet” and DNS queries via dig in Terminal would fail with an “Unknown host” error message. Interestingly enough, ifconfig reported that I did in fact have an IP address:
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 60:33:4b:XX:YY:ZZ
inet6 fe80::6233:4bff:fe0a:d552%en1 prefixlen 64 scopeid 0x5
inet 10.0.1.43 netmask 0xffffff00 broadcast 10.0.1.255
media: autoselect
status: active
And netstat reported that I had a default route which pointed at my default network gateway:
$ netstat -rn
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 10.0.1.1 UGSc 7 0 en1
10.0.1/24 link#5 UCS 4 0 en1
Upon further examination, I was also able to ping the default gateway. And I was able to send DNS queries (dig example.com. @10.0.1.1 syntax) to the gateway and get them resolved. But attempts to resolve hosts using Snow Leopard’s DNS recursion failed.
The workaround was turning WiFi off and then back on. Voila, problem solved until the next time I put my laptop so sleep. Today I decided to find and fix the problem. The solution was disabling IPv6 support on the WiFi network interface (in Network control panel). Voila, problem solved.