Why will the Mac only load Google and Facebook

dnsNetwork

I'm running into this really strange problem on my 2013 iMac at home (running Mavericks): the internet will work for a while, then at some point it will stop being able to load any websites except for Facebook and Google (and Google-owned sites, like Gmail and YouTube). These sites work fine, but attempting to access any other site will get stuck on "Connecting…" and eventually time out.

This applies to all browsers. It also applies whether I'm connected via ethernet or WiFi.

Attempting to ping other sites like amazon.com, bing.com, etc. via ping just shows a string of timeouts. nslookup does seem to give back IP addresses, but even plugging these directly into a browser's address bar, I still get nothing.

So I guess that means it's not a DNS issue? All the same, I've tried my ISP's default DNS, Google DNS, and OpenDNS — no difference.

I can confirm the problem is just with my iMac. Other devices on the same network can connect to any website just fine. Furthermore, if I actually start up a Windows VM on the iMac, the VM can also connect to any website!

Rebooting the computer fixes things for a while. But eventually the problem comes back.

Does anyone know what the issue might be? I've Googled around a bit, and it does seem that some people have encountered similar issues; but I wasn't able to find any solutions that worked for me.

EDIT: Maybe this is the same issue as in this question. However, bouncing mDNSResponder as prescribed in the top answer to that question didn't solve the problem for me.

Best Answer

In my case the problem was IPv6. Websites like Facebook, Google.com and Youtube use IPv6 and work fine while other's don't support it yet.

I couldn't figure out the issue exactly (and the right configuration for IPv6) but I disabled IPv6 and the issue was resolved. This is all I care at this point.

The commands for El Capitan:

Turning off IPv6 support for ethernet:

networksetup -setv6off Ethernet

Disabling IPv6 for wireless:

networksetup -setv6off Wi-Fi

If you ever need to re-enable:

networksetup -setv6automatic Wi-Fi
networksetup -setv6automatic Ethernet

I will edit this if I ever find the correct setting for IPv6 instead of a full disable.