In cases like this it helps to break the problem down – which in turn means knowing something about the pieces that need to line up for a network connection to succeed. Much of this information isn't specific to the Pi or it's OS, but it will be helpful to know the tools and foibles of the particular hardware and OS that you are using.
This question and its answers may help: How do I set up networking/WiFi/static IP address?.
Testing with other devices on the same network may also help pinpoint where the problem lies. Rebooting often works wonders.
In general you want to start close and expand as you test, so you might:
- Check that your network is up and basically working by trying to ping a machine on your local net by IP address (
ping 10.0.0.42
).
- Check that you can talk to your router by attempting to ping the internal interface of your router by IP address (
ping 10.0.0.1
).
- Check that your router is routing by doing a ping to the external interface of your router by IP address (
ping 1.2.4.192
).
- Now try to reach your router's router by attempting to ping your router's default route by IP address (
ping 1.2.4.8
). Success means that you can reach a remote machine – specifically the machine that your router will be forwarding all of your Internet traffic to
- Now verify that it is all working with a to ping something far away by IP address (
ping 8.8.8.8
).
If those all work then you have a network connection that is working at the IP level. If any of them fail, then that is the spot to start investigating further.
Next test that DNS works. You could:
- Use
dig
to check it DNS requests are getting resolved. Use a well known server by IP address (e.g., 8.8.8.8 or 1.1.1.1) – dig google.com @1.1.1.1
- Then try the same thing using the DNS server that you have configured.
- Then try pinging a "new" host (one that you're confident isn't in your local resolver cache.
If you don't have dig
or nslookup
or a similar tool you can use ping
instead.
apt-get
downloads trees, then hangs on 0%.