Troubleshoot network connectivity issues with your Raspberry Pi
Learn how to check and diagnose internet connection problems on your Raspberry Pi. …
Updated September 17, 2023
Learn how to check and diagnose internet connection problems on your Raspberry Pi.
Check if the LEDs are lit up:
- The power LED should be solid green.
- The activity LED should be flashing white, indicating that the Raspberry Pi is booting up.
Connect to your Raspberry Pi via SSH or VNC (if you have a monitor and keyboard attached).
Check the network interface status:
$ ifconfig -a
This command will display all available network interfaces on your Raspberry Pi. Look for
eth0
orwlan0
, depending on whether you’re using an ethernet cable or Wi-Fi. Make sure the interface is UP and RUNNING, and has an IP address assigned to it (something like 192.168.x.x).Check the default gateway:
$ route -n
This command will show you the routing table for your Raspberry Pi. Make sure there’s a
default
entry with the correct IP address of your router (usually 192.168.x.1). If not, try setting it manually:$ sudo route add default gw <gateway_ip> eth0
Replace
<gateway_ip>
with the actual IP address of your router.Check DNS configuration:
$ cat /etc/resolv.conf
This file should contain at least one nameserver entry (e.g.,
nameserver 8.8.8.8.8
). If it’s empty, try adding Google’s public DNS server:$ echo "nameserver 8.8.8.8.8" | sudo tee -a /etc/resolv.conf
Ping a known IP address:
$ ping -c 3 8.8.8.8.8
If you can’t ping Google’s DNS server, check your network cable or Wi-Fi connection.
Ping a domain name:
$ ping -c 3 www.google.com
If you can’t resolve the domain name, try restarting the networking service:
$ sudo systemctl restart networking
Test your internet connection:
$ curl http://example.com
This command will download the content of a sample website (example.com) and display it in your terminal. If this doesn’t work, try rebooting your Raspberry Pi:
$ sudo reboot
After following these steps, you should have a better idea of what’s causing your Raspberry Pi’s network connectivity issues. Don’t hesitate to ask for help if you need further assistance!