Consumer routers are usually configured to issue an IP address to your devices via DHCP as soon as they are connected. This means that in most cases, connecting your Pi to the internet via a wired Ethernet connection is as simple as connecting your Raspberry Pi to your internet router/switch with a standard Ethernet cable.
Raspberry Pi connected to a switch
Should you run into an issue on a wired Ethernet connection you should test the connection on your PC/laptop first. If your PC can get an internet connection on a wired Ethernet cable, typically the Pi can too.
Possible issues may include:
- A damaged Ethernet cable. This is pretty rare but it can happen.
- DHCP may be turned off on your router and because of that your device is not being issued an IP address. Most consumer routers have DHCP enabled by default, so if it is disabled it's quite likely that you have a special networking setup that you are aware of which may require a static address be assigned to your Pi.
- If you're connecting through a USB-to-Ethernet adapter instead of default Ethernet port you might run into driver issues if your USB device is not natively supported in your chosen operating system. You may wish to try using the standard Pi Ethernet port first to establish if the issue is general, or is specific to the particular USB device you are using.
- A router or general internet fault. If you can't get any internet access via your router (including to your PC/laptop), you may need to replace the router and/or raise the issue with your ISP. They will probably ask the typical quesiton 'have you power cycled it?', so it's worth giving that a shot too.
At the time of writing, only Raspberry Pi 3 devices have built in Wifi. For older devices, The WiPy USB Wireless module is available from the Raspberry Pi Store.
Raspberry Pi using WiFi module
WiPy on Raspberry Pi version 1 devices
In some very early Raspberry Pi devices (model 1), the power supply was in some cases insufficient to properly power the WiPy device and brownouts and dropped connections would result. We recommend you use at least a Raspberry Pi version 2 if you require a WiFi connection to your Pi.
Open a terminal emulator and type in the command below to get a list of networks visible to your Pi:
sudo iw dev wlan0 scan | grep SSID
In our case, we set up a network named DATAPLICIT and we will now configure our Pi to connect to it after boot up.
Open up network interfaces file using text editor such as nano.
sudo nano /etc/network/interfaces
When you open this file it should look similar to the one shown below.
Default network interfaces configuration file
Modify wlan0 above to match that which is shown below. You will need to supply your own network name and password instead of
Modified network interfaces configuration file
Exit the text editor by pressing CTRL + X then y and then ENTER.
Last thing to do is to reboot the system.
You can try to 'ping google.com' to check that your internet connection is working. If this fails, either google.com is broken or your internet connection isn't working, needless to say the latter is more likely. :)
The command below will send 5 packet to google and return connection statistics.
sudo ping -c 5 www.google.com
On successful ping you will see a result similar to the one below.
Successful ping result
If your connection isn't working, you will see something similar to the below (or some other error).
To find the IP of the interfaces on your Raspberry Pi use the command below.
You should see a result similar to the one below. To find your IP you have to look at the interface you're currently using e.g. Wlan0 and then look at the inet (IPv4) section.
Information about network interfaces
Updated 4 months ago
|Terminal for Raspberry Pi|