MacOS – Internet stopped working on OS X 10.8.2

macosNetwork

I have a MacBook Air with OS X 10.8.2 on it. Suddenly the browsers (Safari, Firefox and Chrome) all stopped working although the MacBook is still connected to the internet via WLAN.

Funnily enough Google still works (i.e. I can search for something, I just can't take a look at the results), Facebook as well (I'm even able to receive chat messages). Other webpages don't work…

  • ping – works
  • nslookup – works
  • traceroot – works
  • curl – doesn't work

I've tried to use Google's DNS servers, to type in the IP of an website instead of its URL, restarting mDNSResponder and I've rebooted the Macbook more often than I can count.

I'm running out of ideas…
Any guesses what the problem might be?


Update: Output: netstat -i

Metalhamsters-MacBook-Air:~ Metalhamster$ netstat -i 
Name  Mtu     Network            Address            Ipkts  Ierrs  Opkts  Oerrs  Coll 
lo0   16384   <Link#1>                              53920  0      53920  0      0 
lo0   16384   localhost          fe80:1::1          53920  -      53920  -      - 
lo0   16384   127                localhost          53920  -      53920  -      - 
lo0   16384   localhost          ::1                53920  -      53920  -      -
gif0* 1280    <Link#2>                              0      0      0      0      0 
stf0* 1280    <Link#3>                              0      0      0      0      0 
en0   1500    <Link#4>           94:94:26:04:98:dc  351    0      468    0      0 
en0   1500    metalhamsters-mac  fe80:4::9694:26ff  351    -      468    -      - 
en0   1500    192.168.1          192.168.1.130      351    -      468    -      - 
p2p0  2304    <Link#5>           06:94:26:04:98:dc  0      0      0      0      0

Update2: I think I need to clarify what I mean with "other webpages don't work":

  • When I try to load a website I get a blank tab with 'Connecting…' and after a few minutes the browser shows 'Error: server not found'.
  • curl returns '(52) Empty reply from server' after a few minutes.

Cheers,
metalhamster

Best Answer

It appears you might have installed some software that would block access to those web sites.

If not keep reading:

In some cases there is a possible modification to your HOST file.

In the assumption that you have no software installed that would explicitly block those sites here is how to block and unblock web sites.

A Mac’s hosts file is a simple text file that dictates what the system should do when specific domains or IP addresses are accessed.

You can trigger a “page cannot be displayed” error or even redirect them to other domains/IPs of your choice.

For the sake of this tutorial, all blocked websites will be pointed to 127.0.0.1, which is the localhost or system itself.

  • To get started, Copy and paste the following code in Terminal:
sudo /bin/cp /etc/hosts /etc/hosts-original

Terminal will ask for your password.

Now we can start editing the hosts file. Copy and paste this code in Terminal (all one line)

sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts

The hosts file will open in TextEdit.

Notice the following lines and do not delete them under any circumstances:

127.0.0.1 localhost

255.255.255.255 broadcasthost

::1 localhost

fe80::1%lo0 localhost

You should not have any further data here.

Create a new line directly under the last one shown above. Type the following, replacing the sample domain with the domain or IP address you want to block:

    127.0.0.1 sample.com www.sample.com

Continue adding lines following the format in step 6 for each website you want to block. When you’re done, quit TextEdit and save the hosts file when prompted.

Back in Terminal, run the following command to flush the computer’s DNS and put the new hosts file into effect. Or you can restart your Mac instead, if you prefer.

sudo killall -HUP mDNSResponder

That’s all there is to it! Websites added to the hosts file will no longer be accessible from any user account on that Mac.

In your case look for the blocked IP's

  • re-enable access to blocked websites, just repeat this process and remove the lines you added in the hosts file. Just remember not to delete the original 4 lines!

In some cases the sshuttle (an VPN over ssh) cloud changed my /etc/hosts file.