[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
.