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

Need help with your Raspberry Pi?
Contact Me!

Do you love silly Raspberry Pi Projects?
Check out my this YouTube Channel!


Learn how to check and diagnose internet connection problems on your Raspberry Pi.

  1. 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.
  2. Connect to your Raspberry Pi via SSH or VNC (if you have a monitor and keyboard attached).

  3. Check the network interface status:

    $ ifconfig -a
    

    This command will display all available network interfaces on your Raspberry Pi. Look for eth0 or wlan0, 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).

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

  5. 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
    
  6. 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.

  7. 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
    
  8. 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!