"Network is unreachable" when attempting to ping google, but internal addresses work

26

14

I can get to other PCs in my house on the 192 network, but trying to go outside gives me the "network is unreachable" message. p3p1 is up with a good IP Address. Running Fedora 16. What should I do next to troubleshoot?

All other PCs in the house are working (Windows, Mac).

Scott C Wilson

Posted 2013-10-31T01:54:16.447

Reputation: 2 210

Does any other PCs in your house have external internet access? (Can other PC ping google?) Restarted your house ADSL/cable/? modem? – Darius – 2013-10-31T02:19:26.807

1Can you try pinging 8.8.4.4? – MariusMatutiae – 2013-10-31T04:04:09.053

Can you ping your gateway? Can you ping the external interface of the gateway? – brandonscript – 2013-10-31T04:48:03.920

Ping 8.8.4.4 fails @MariusMatutiae - same error, "connect: Network is unreachable." But then I did a "route -n" and realized I had no gateway, added one ("route add -net 0.0.0.0 gw 192.168.1.1 p3p1") and now I can ping 8.8.4.4 but still not 74.125.229.194 (google). – Scott C Wilson – 2013-10-31T08:02:56.537

Yes @r3mus I can ping 192.168.1.1. On a working machine I go to "whatismyipaddress.com" and get my external address, and can ping that successfully as well from my failing machine. – Scott C Wilson – 2013-10-31T08:16:53.357

Then problem solved. Congratulations – MariusMatutiae – 2013-10-31T08:20:28.250

@MariusMatutiae I think I see what you're saying - I added the 2 google nameservers to my /etc/resolv.conf and things started working again - but what the heck happened? – Scott C Wilson – 2013-10-31T08:21:23.803

bug in network manager, happens to the best of us, and quite often too. Just drop yourself a note so that next time it happens you know where to look. – MariusMatutiae – 2013-10-31T08:33:52.260

LOL first time for me. Thanks guys for your help! Cardiac arrest averted! – Scott C Wilson – 2013-10-31T08:41:13.167

Answers

39

You say all other pcs in your house have a connection. Then the problem lies only with your linux machine. There are several possibilities:

  1. You do have a connection, but you cannot reach your DNS; you can diagnose this by

    ping -c1 8.8.4.4
    

    if you can reach Google, then you have a connection, and you only need to update your DNS servers. Edit (as sudo) your /etc/resolv.conf file and add these two lines:

    nameserver 8.8.8.8
    nameserver 8.8.4.4
    

    and now you are good to go.

  2. You cannot ping Google, but you can ping your router, or any other pc in your LAN. In this case case, it is possible that you also have problem 1, so you will have to check for that, but first, you need to check your routing table. Print it with

    ip route show default
    

    and check that there is a reply, like this one:

    default via 192.168.11.1 dev wlan0 proto dhcp metric 600
    

    (this is for my laptop). What is important is that the correct IP address of your router is shown exactly where mine (192.168.11.1) is shown. If an incorrect IP address is shown, or, worse, if the ip route show default command receives no reply, then your routing table has been corrupted. You may simply restore it by means of:

    sudo ip route del default (only if the wrong IP address appears)
    sudo ip route add default via IP.address.OfYour.Router
    

    and now we may go step 1.

  3. If you cannot ping any pc on your LAN, then there is another kind of problem, and more questions will need to be asked. But we'll cross that bridge when we get there.

MariusMatutiae

Posted 2013-10-31T01:54:16.447

Reputation: 41 321

1I can't for the life of me figure out how to make this persist when I reboot. I've tried a lot of different things in /etc/network/interfaces, but can't get it to work. – thouliha – 2016-03-30T18:09:05.797

@thouliha Your question has many different answers, in part depending on your distro. If you ask it as a separate question, including the name of your distro, I will be happy to answer it. – MariusMatutiae – 2016-03-31T15:04:22.903

I had a corrupt routing table. Thanks so much for you're clear advice – Rich Standbrook – 2017-02-11T10:19:08.023

3Worked! I suspect you're right that the issue was flakiness in NetworkManager. – Scott C Wilson – 2013-10-31T15:18:25.183