In testing Yosemite beta, you may come across a DNS failure, so no webpages load in Safari and apps have no internet. This often happens after the Mac wakes from sleep.
After trying to flush the DNS cache it said the mDNSResponder service wasn’t running; so to get things back in action just start the mDNSResponder service again with this command:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
If you don’t fancy tapping away in Terminal, a restart will also get this running again.
Update 19/10/2014: As Foutchy pointed out in the comments, the final version of Yosemite released to the public no longer has the mDNSResponder instead you can use:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist
mDNSResponder is not available on Yosemite final,so you can issue those two command :
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist