10

I am using a Raspberry Pi that is connected to the router directly with an ethernet cable but the device will not connect to the internet. All the network lights light up but I cannot access the internet and cURL, wget, and ping commands are all unable to resolve host address. When I connect the cable to my laptop my laptop can connect to the internet fine.

The Raspberry Pi worked fine at my house, but now when I am setting it up at a friend's house it is not connecting (even with a fresh image). They have a pretty old router (only one ethernet slot).

My question is how can I debug this further to find the problem? Is there some way (for instance) that I could test TCP/IP or something? I have taken a networking class in college and understand the theory but I don't know how to actually dig into a networking problem.

  • If you want help you need to describe the problem, and what you have tried. What does ifconfig on the Pi say? What are the laptop internet settings? – Milliways Jan 13 '14 at 4:19
8

[Most of this answer is outdated and will not be useful with versions of Raspbian beyond the first one, "jessie".]

If all the ethernet lights are on when the cable is in, and you can connect a monitor and keyboard or a serial line as John suggests, you should be able to get the connection up.

First, just run ifconfig. Possibly eth is not up, and you will just see:

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING 
          [...]

You may also see eth0 listed. If not, don't worry about it for the moment; before doing anything else, it might be worthwhile disabling the network automation since obviously that's not working for you:

sudo service networking stop
sudo service ifplugd stop

These will start again next boot/runlevel change. If you don't want the services to start again at boot, use disable instead of stop, in which case you will have to make your own arrangements or do all this manually every time. The second one (ifplugd) is supposed to raise a connection whenever an ethernet cable is inserted.1

Now that's out of the way, if you did not see eth0 listed earlier, sudo ifconfig eth0 up, otherwise just ifconfig again to make sure it is still up. Next, sudo dhclient -r which should stop any running instances; to be sure, sudo killall -9 dhclient then ps -A | grep dhc to check for other dhcp client software, since I think debian uses dhcpcd (instead of dhclient) by default. If so, you need to kill that off. Beware that if you have not disabled the networking service as above, it will probably keep coming back.

Once that's done, you should be able to get connected with sudo dhclient -v eth0. If that doesn't work, add the output to your question.


1. Which may not be desirable for everyone. It seemed to be very pernicious to me even when the service was supposedly stopped, and I uninstalled it with sudo apt-get remove ifplugd.

  • thanks! I needed a bunch of sudo in there... in my case, dhclient must have died along the way for some reason, just needed a kick.. – ptim Apr 23 '15 at 11:18
  • Is it bad if I get Failed to stop ifplugd.service: Unit ifplugd.service not loaded. – Jack May 22 '18 at 4:16
  • No; this means the service is not enabled. I think ifplugd is not used by default on Raspbian anymore (I'll edit that in above -- thanks!). – goldilocks May 22 '18 at 13:38
  • Actually, most of this answer is not really appropriate to newer versions of Raspbian... – goldilocks May 22 '18 at 13:49
1

I use a $1 usb serial dongle to see the boot screen messages

Of course you can also log in and poke around the shell etc.

You can find these dongles on ebay. Just search for pl2303

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.