Network Setup for a Raspberry Pi Running Raspbian


The Raspberry Pi can be used as a stand alone device, but most of the times you will want to connect it to your home router via an Ethernet cable or a USB WiFi adapter so it gets access to the Internet.

By going though this tutorial, you will learn:

  • How to connect your Raspberry Pi to a router using an Ethernet cable
  • How to install and configure a WiFi adapter
  • Find out the IP address of your Raspberry Pi

Connecting to a router using an Ethernet Cable

The fastest way to get your Pi connected to your home network is by using an Ethernet cable like this one:

Network Cable RJ45 Cat 5E 2m - Black
  • Network Cable CAT 5E, 2m Black
  • Connector Type A: RJ45 Plug
  • Connector Type B: RJ45 Plug
  • Cable Length: 2m
  • Conductor Size: 24AWG
$5.00 In stock.

Just connect one end of the cable to the Pi and the other end to the router, like on this image:

Connecting a Raspberry Pi to a Router

If your router is configured with DHCP (Dynamic Host Configuration Protocol) your Pi should be able to connect to the Internet with no problems as the router will automatically assign an IP address to your Pi.

If DHCP is turned off, you have to options: you either enable it back in your router or you will have to enter an IP address and netmask that are part of your network.

Getting a USB WiFi Adapter

To avoid headaches just get an adapter that is compatible with the Raspberry Pi.

The following adapters are compatible:

Could not find any products

WiFi adapters can use as much power as the Raspberry Pi. Just make sure you use a power adapter that can deliver more than 2A if you're going to be using WiFi, a wireless keyboard and a wireless mouse. These power adapters will work just fine:

Could not find any products

Setting up Wifi with the Graphic Interface in Raspbian

Setting up WiFi requires that your router is broadcasting the SSID. Make sure you have "Broadcast SSID" set up on your router! This will not work with "private" SSID setups.

Look in your desktop for an utility called WiFi Config.

WiFi Config

Step 1.

Double-click the icon and this is what you will see.

WiFi Config 1

Step 2.

Click on the Scan button and a second window will open. Find your Wireless access point in the list and double click on it. This will open another window.

WiFi Config Scan

Step 3.

Enter your password in the PSK field and then click Add.

WiFi Config set Passwprd

Step 4.

Close the scan window and you should see in the first window. You can connect or disconnect using the buttons. Notice also the IP address of the Pi is shown at the bottom of the window.

WiFi Config Connected

Setting up Wifi with the Command Line

This tutorial works best if your router is broadcasting the SSID. Make sure you have "Broadcast SSID" set up on your router! This may not work with "private" SSID setups.

Step 1.

Boot the Raspberry Pi without the WiFi adapter plugged in.

Step 2.

Open a Terminal session by clicking on the LXTerminal icon, and enter the following command into it:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Step 3.

This opens an editor screen of the wifi configuration file you need to change.

Enter the following in the configuration file:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


Replace your_wifi_ssid with the name of your WiFi network network and your_wifi_password with your WiFi password. Note that you need to keep the double-quote characters around your wireless network name and password.

This kind of editor does not let you use the mouse. Instead, use the cursor keys to move around the file.

WiFi Setup Using nano

Step 4.

When you have finished press [ctrl]x. This will ask if you want to save the modified files.

Press 'Y' and then Return to save the file with the same name.

Step 5.

Shut down your Raspberry Pi, plug the WiFi adapter in and start it up again. You should find that the Raspberry Pi connects using the WiFi adapter as it boots up.

Finding Your Pi's IP Address in Raspbian

To find the IP address of your Raspberry Pi open a command line terminal bu double clicking LXTerminal window and type the following command:

sudo ifconfig

In this example the Raspberry Pi is connected to both the wired network (eth0) and the wireless network (wlan0) at the same time. You would normally have it connected to one or the other, rarely to both.

  • Next to the eth0 entry you will see inet addr: which is the IP address of the Raspberry Pi in the wired network (ethernet).
  • Next to the wlan0 entry you will see inet addr: which is the IP address of the Raspberry Pi in the WiFi network.
Ifconfig in the Raspberry Pi

Remember! If your IP address starts with 192.168 or 10.0 then its an internal address - that means you can get OUT to the Internet but you cannot have someone outside your home or network reach your Pi via the IP address. This is important if you want to have a webserver running on a Pi that outside people can reach. In general, its much safer to keep your Pi on an internal network so it can't be hacked as easily!

Test Your Connection in Raspbian

Open the Midori web browser and navigate to the URL of your favourite electronics supplier.

If you are using a command line, the ping command can be used to see if you are reaching the internet. Try ping google.com.au or ping openmediacentre.com.au to check if you can reach those sites!

Midori browser in the Raspberry Pi


There are no comments yet, be the first one to write a comment.
Add comment

* - required field


CAPTCHA image for SPAM prevention If you can't read the word, click here.

Continue Shoppping View Cart
Continue Shoppping View Wishlist