MacBook can't use internet, but nslookup and ping both work

Is mDNSResponder running? Even if it is, try doing a sudo killall mDNSResponder and let launchd auto-relaunch it. (If you'd already tried rebooting the system and the problem persisted, then this probably isn't the cause.)

mDNSResponder is a critical part of Mac OS X's DNS resolver infrastructure nowadays. A few tools like nslookup contain their own DNS resolver code or call low-level APIs that avoid mDNSResponder and use a more traditional Unix DNS resolver library, but most apps and tools that just call the normal APIs will be relying on mDNSResponder to do name resolution.

You may also want to check how you have DNS configured in the Network panel of System Preferences, and look at /etc/resolv.conf (note: no 'e' in "resolv"). ipconfig getpacket en0 (replace en0 with your primary network interface's BSD-layer identifier) can be useful to see what DNS server information your machine is getting from DHCP. See also the "LOGGING" section of the mDNSResponder(8) man page for more tips on getting troubleshooting/debugging information out of mDNSResponder.


I found that the root cause of this problem on many of my Macs (well, Hackintoshes) was sleeping/suspending to disk. If this fails, on next boot the mDNSResponder is in a corrupt state, and the sudo killall mDNSResponder command fixes it.