Raspberry Pi WiFi

Looking to learn how to set up the Raspberry Pi WiFi then this is the guide to check out. I go into several topics in this guide that will help anyone grasp an understanding of how the WiFi is set up on the Raspberry Pi.

In this guide, I will show you how to set up the Raspberry Pi WiFi via command line and also how to do it via the GUI within Raspbian. I also touch on setting up the WiFi country and predictable network interface names. It’s pretty straightforward, but for anyone who is entirely new to the Pi, these are vital steps that you will need to undertake to be able to setup your Raspberry Pi correctly.

Ultimate Books of Pi

If you want to see how to do this visually then check out the video I have prepared below. As always if you like what you see, then please subscribe so you can stay up to date with all the latest and greatest Raspberry Pi projects, guides and much more.


I used the following equipment for this guide on the Raspberry Pi setup Wifi.


Raspberry Pi

Micro SD Card if you’re using a Raspberry Pi 2, 3 or B+ or 4GB SD Card (8GB+ Recommended)

Wifi dongle (Raspberry Pi 3 has WiFi has inbuilt)


USB Keyboard

USB Mouse

Raspberry Pi Case

In this guide, I use the default operating system for the Pi. This operating system (OS) is known as Raspbian, and if you haven’t got it installed, then you can follow my guide on how to install Raspberry Pi NOOBS (Raspbian).

Setting up Raspberry Pi WiFi Command Line

If you don’t have the option of setting up the WiFi connection up through the graphical user interface (GUI), then the command line interface (CLI) is the next best thing. It’s a little harder but still relatively easy to set up.

1. While in the terminal on the Raspberry Pi enter the following command.

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

2. At the bottom of this file, add the following lines.

ssid="The SSID of your network (eg. Network name)"
psk="Your Wifi Password"

3. Exit nano by typing ctrl+x and then y to save.

4. The Raspberry Pi should now notice the change in the wpa_supplicant file and attempt to connect to the network. You can force the Pi to check for changes by using either sudo ifdown wlan0 and then sudo ifup wlan0

5. You can check if it has successfully connected by using ifconfig wlan0. The inet addr field should have an IP address in it.

If you’re on Raspbian Stretch the ifup command will likely not work, you will get an error that says something like the following “ifdown: unknown interface wlan0“. As a workaround to this issue, you can use either of the following commands sudo ifconfig wlan0 up or sudo ifconfig wlan0 down

Also, on Stretch, wlan0 may no longer be correct, use ifconfig to see the new name. For more information check out the predictive network names section further down this page.

If you’re having trouble connecting, then be sure to make sure that the Pi supports the WiFi dongle. It is also possible you have the SSID wrong, to scan and check, use sudo iwlist wlan0 scan and check the essid field. This field should be the same as what you entered in the ssid field.

Setting up Raspberry Pi WiFi via GUI

Using the GUI (Graphical User Interface) is the easiest way to set up WiFi for the Raspberry Pi as everything can be done quickly within the interface.

1. You will need to have your Raspberry Pi connected to a monitor with a mouse and keyboard.

2. On the Raspbian desktop locate the WiFi icon in the upper right-hand corner of the desktop.

Raspbian WiFi Icon Location

3. It will now scan for WiFi networks and display any that it can find. Click on the network that you wish to connect to.

Raspbian WiFi Networks

4. If your network is password protected, then you will be prompted to enter a password. Enter the relevant password to connect to the WiFi network.

Raspbian WiFi Password Field

5. The Pi should now connect to the WiFi network, and the icon should have now changed to a blue WiFi logo.

Raspbian WiFi Signal

Updating WiFi Country

It is also a good idea to set the country for your WiFi signal. Selecting the country in the GUI is pretty easy to do.

1. Go to the menu icon, then preferences then select Raspberry Pi configuration.

Raspbian Configuration Menu

2. In this menu, go to the localization tab and select “Set WiFi Country

Raspbian Set WiFi Country

3. Select your country and hit save.

Raspbian Select WiFi Country

4. Your WiFi country should now be updated.

Predictable Network Names

Predictable network names caused quite a bit of confusion when it was first introduced to Raspbian in the Stretch update. Since then, it’s been rolled back and can be activated manually.

You will find that predictable network names are useful when a device has multiple network connections. Instead of naming the interfaces wlan0 or eth0, it instead names them en (ethernet) or wl (wlan) followed by an x. It is lastly followed by a mac address (without any colons). For example, a wlan connection with a predictable network name would be called wlx6c198f049e5c

The naming was rolled back because most Raspberry Pi setups will only use a single Ethernet and WiFi connection. Also, a lot of tutorials rely on the naming of wlan0 or eth0. A lot of these tutorials weren’t updated to reflect the new naming which led to a lot of headaches.

The predictable naming comes in handy if you have three or more network interfaces. For example, on reboot, wlan0 might become wlan1 and vice versa. This switch of interface names may cause a lot of issues for people who rely on the interface names in their programs.

Predictable network names provide a naming convention that makes sense and is easy for a developer to predict.

If you wish to turn predictable network names on for use with the Raspberry Pi WiFi or ethernet, then do the following steps.

1. In the terminal, enter the following command.

sudo raspi-config

2. Go to network options, then select network interface names. In here, select yes to turn on predictable network interface names.

3. Now exit raspi-config. You can test to see if predictable network names are working by entering the following command after you have plugged in a new network device. Devices that are currently connected might still have the old name, and a restart will fix this issue.

sudo ifconfig

Raspbian Network Predictable Names

It is important to note that the onboard WiFi for the Raspberry Pi 3, and zero will continue to use wlan0. Despite whether predictable naming is turned on or off.

Now that you have your WiFi setup you might be interested in doing a bit more with it. For example, setting up a Raspberry Pi WiFi access point is a great way to help extend WiFi coverage throughout your house. You will need to have ethernet connected to the Pi as a WiFi to WiFi setup isn’t great for speed.

If you’re having trouble getting the WiFi to connect, then be sure to check that the Pi supports the dongle. This issue is one of the most common problems when setting up the Raspberry Pi WiFi.

I hope that this guide has been able to show you all the steps to set up WiFi and you haven’t run into any issues. If you require further assistance, I highly recommend that you head over to our forums.

Ultimate Books of Pi Bottom
Pi My Life Up's Crash Course
to the Raspberry Pi

Pi My Life Up's Crash Course

to the Raspberry Pi

Subscribe to our email list to get the

Crash Course delivered straight to your inbox

Please check your inbox for a confirmation email!