How to Configure WiFi on Raspberry Pi?


This post may contain affiliate links/ads and I may earn a small commission when you click on the links/ads at no additional cost to you. As an Amazon Affiliate, I earn from qualifying purchases. You can read my full disclaimer here.

Raspberry Pi now ships with onboard WiFi and Bluetooth connectivity. In this guide, I will show you how to configure WiFi using various methods including how to do it on a headless installation.

Connecting to WiFi is one of the basic things you do while setting up your Pi. Once connected to a network, you can do many things with your Pi such as connecting to it remotely via SSH or VNC protocols using other devices on the network.

Equipment Needed

Alternatively, you can purchase CanaKit Raspberry Pi 4 Extreme Kit that contains all the above-mentioned items.

Pre-Requisites

  • An active WiFi network to connect Raspberry Pi.
  • Access to any other computer (Windows or Linux).
  • Sudo permission on Raspberry Pi.

How to Enable WiFi on Raspberry Pi?

There are various ways to enable WiFi on Raspberry Pi.

  1. Enable WiFi on Raspberry Pi while writing OS image.
  2. Enable WiFi on Raspberry Pi in Headless Mode.
  3. Using GUI Configuration Options to Enable WiFi.
  4. Enable WiFi on Raspberry Pi using the Terminal.

You can use any of the above-mentioned methods to enable WiFi on your Pi.

1. Enable WiFi on Raspberry Pi while Writing OS Image

If you are using the official Raspberry Pi imager tool to write OS image to the SD card, then you can enable WiFi at the time of writing the SD card.

1. Plug in the SD card to your PC or laptop using the SD card reader (Adapter).

2. Open the Raspberry Pi Imager tool.

3. Choose the Operating system and SD card.

4. Before clicking on the “write” button. Press the settings icon or Ctrl+Shift+x key combination to enter into the advanced settings option.

Advanced settings Raspberry Pi Imager

5. Click on the “Configure WiFi” checkbox and fill in the network name (SSID) and password. Also, select your country code from the dropdown.

Configure WiFi Raspberry Pi Imager

6. Click on “Save”.

Now, you can click on the “Write” button to write the image. The WiFi will be enabled automatically.

2. Enable WiFi on Raspberry Pi in Headless Mode

To configure WiFi settings in headless mode follow the steps:

1. Plug the SD card into the PC or laptop using the SD card reader (Adapter).

2. Navigate to the “boot” partition of the SD card. You can use the “File Explorer” on Windows or the “cd” command in Linux to navigate.

3. Create a file called “wpa_supplicant.conf” in the “boot” partition of the SD card. You can do “right-click > New > Text document” on Windows or use the “touch” command on Linux to create the file.

4. Open the newly created “wpa_supplicant.conf” file and add the following lines to it.

country=IN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
    ssid="Network_Name"
    psk="Network_Password"
}

(Replace “Network_Name” and “Network_Password” with the actual WiFi network name and password. Also, change the country code according to your country.)

5. Save and close the file.

That’s it. Now, you can safely remove the SD card and put it back into the Raspberry Pi.

While booting, the Raspberry Pi looks for a file called wpa_supplicant.conf, if found, then the WiFi will be connected automatically using the details provided in the file.

3. Enable WiFi on Raspberry Pi using GUI Configuration Options

If you have a Monitor or Raspberry Pi Screen connected, then you can easily enable WiFi on Raspberry Pi graphically.

1. On the top-right corner of the screen, you will find a WiFi icon there. Click on the WiFi icon.

2. Click on the network name you want to connect from the dropdown.

Connect WiFi Graphically on Raspberry Pi

3. Enter the password for the WiFi network and click on connect.

4. Enable WiFi on Raspberry Pi using the Terminal

You can access the Raspberry Pi configuration settings using the terminal. This is useful if you don’t have a graphical desktop environment or you are using SSH to connect to the Raspberry Pi.

To configure WiFi using Terminal follow the steps:

1. Open the terminal.

2. Run the following command to access Raspberry Pi configuration:

sudo raspi-config

3. Use the up-down arrow keys to navigate and select the “System Options” and hit enter. 

Select System Options

4. Next, select the “Wireless LAN” option and hit enter.

Select Wireless LAN

5. Enter your network’s SSID and click OK.

Enter SSID of WiFi network

6. Enter the password of the WiFi network and click on OK.

Enter password of WiFi network

7. Select “Finish” and hit enter to close the Raspberry Pi configuration screen.

Reboot the system for the changes to take effect. After reboot, your Raspberry Pi will be connected to the WiFi network automatically.

Find IP address of Raspberry Pi

Using Commands (Raspberry Pi)

To find the IP address from the Pi itself follow the steps:

Open the terminal and type any of the following commands:

ip a
ifconfig

By using any of the commands above you can easily find the IP address assigned to the WiFi card (wlan).

Alternatively, you can also use the hostname command to find the IP address assigned to your Raspberry Pi.

hostname -I

Once you know the IP, you can proceed with connecting to Raspberry Pi remotely via VNC or SSH.

Using Angry IP scanner (Windows)

1. Download, install and start Angry IP scanner.

2. Enter IP Range to scan and click on “Start”.

Angry IP scanner

3. Once the scan is complete, you’ll know the IP address of the Raspberry Pi.

Raspberry Pi IP in Angry IP scanner result

Using Nmap (Linux)

1. Install “nmap” utility on Linux to scan the network.

On Ubuntu/Debian based systems run:

sudo apt install nmap
install nmap linux

On RHEL/Fedora based systems run:

sudo dnf install nmap

2. Next, use “nmap” to scan the network:

sudo nmap -sn 192.168.29.0/24

(Replace 192.168.29.0/24 with your IP range and netmask)

nmap scan result for Raspberry Pi

Using the Router Management Console

If you have access to the Router Management console, then you can check the DHCP table to find the IP address assigned to Raspberry Pi.

Conclusion

You’ve seen various methods of enabling WiFi on Raspberry Pi. You can use any method according to your convenience.

I hope the instructions were easy to follow. However, if you encountered any errors, then feel free to ask in the comments.

Also, you can check my other articles related to Raspberry pi here.

If you like this post, then follow Techsphinx on Facebook and Twitter for more reviews, tricks, tips and tutorials.

This article needs update or correction? Report the issue here so I can update it.


Like it? Share with your friends!

Rahul R Nair

Rahul is obsessed with technology and programming. He is also the founder of TechSphinx. Being a technophile, he is always busy doing some techy stuff or learning about the latest technologies. When not busy with his usual routine (staring at the computer screen) he likes to write and share his knowledge with the world.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x