Wednesday 18 November 2015

Linux: network OK, but no internet connection

I've performed the Raspberry Pi upgrade from Wheezy to Jessie a few times without any real issues.


But a recent attempt left me with an unusual networking problem.


I know I won't remember the details the next time I have this problem, so I need to write it down.

Since writing an earlier post 12 months ago on the Wheezy to Jessie upgrade, Raspbian Jessie has now been released and can be downloaded from the Foundation.

However, I wanted to take an existing Wheezy web server image as a starting point for a new server and then upgrade it to Jessie.

Don't upgrade via a remote session


The upgrade seemed to go well on a Pi2 board, but I rather stupidly did this while remoting in via xrdp. With rdp the remote session is a different instance to the local session. So when I lost remote access, I had no idea how far through the upgrade part of the process I was, and had to re-boot via the local screen, and repeat the stage I was at just before contact was lost.

Anyway, when the upgrade was complete (after "sudo apt-get dist-upgrade") I found that I had lost access to the internet, although I could ping across my local network and remote back in using xrdp.

I decided to compare a good Raspberry Pi server with this broken one, and when using the "route" command on the good server, this was returned:-

pi@jessiepi1 ~ $ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0


While on the bad one I got this:-

pi@webbie-do ~ $ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0


I've never used "route" before, but I found an article describing its basic use and tried the "show" option on the good server:-

pi@jessiepi1 ~ $ ip route show
default via 192.168.0.1 dev eth0
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.22


...and then on the bad one:-

pi@webbie-do ~ $ ip route show
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.22


It seemed from this that I needed to add the missing information, so I tried this:-

pi@webbie-do ~ $ sudo route add default gw 192.168.0.1 dev eth0

Success! This fixed the problem.

No comments:

Post a Comment