How to connect your Raspberry Pi 3 to a WiFi network using the terminal

Share on Facebook1Share on Google+0Tweet about this on TwitterShare on Reddit0Share on StumbleUpon0Pin on Pinterest0

About: I recently purchased a Raspberry Pi 3 and was excited to learn that it comes with Bluetooth and WiFi built-in. Since I will be using this Raspberry Pi as a server I will be running it headless so it will not have a monitor. I will connect to the Raspberry Pi over SSH. The Raspberry Pi I will be using is running Raspbian Lite but will also work on the GUI version of Raspbian.

Objective: To connect your headless Raspberry Pi 3 to your WiFi network.

Material: You will need the following:

  • Raspberry Pi (Click the link to check out the price on Amazon. Usually around $36 with free shipping)

Instructions: Go ahead and connect to the Raspberry Pi over SSH and login to the Raspberry Pi. The default username and password is ‘pi’ and ‘raspberry’. 

You can scan for networks using the following command:

You should see a bunch of networks popping up. The “ESSID” is the name of the network you will need. Find the ESSID of the network you want to connect to and remember it.

Next we will configure the WPA Supplicant configuration file. Open the configuration file in nano using the following command:

This will open the WPA Supplicant configuration file. Your configuration file should look like this:

wifi
Your initial WPA Supplicant configuration file should look like this.

Scroll down to the bottom of the file and add the following:

Go ahead and edit the SSID and the PSK. The SSID is the ESSID that you got earlier and the PSK will be the network password. You can see in the example below I will be setting up to connect to the SSID “dayz” with the PSK “password”. Make sure you keep the quotation marks when entering the SSID and PSK.

wifi2
The edited WPA Supplicant configuration file.

After this hit CTRL+X and then Y to save the configuration file. After you do this restart your Raspberry Pi with the following command:

You can verify if it has successfully connected using the following command:

If theinet addr field has an address beside it, the Pi has connected to the network. If it does not have an IP Address next to it verify your configuration file and verify the SSID and PSK are correct.

wifi3
You can see my Raspberry Pi is connected to my network and has an assigned IP Address of 192.168.1.45
Share on Facebook1Share on Google+0Tweet about this on TwitterShare on Reddit0Share on StumbleUpon0Pin on Pinterest0

Leave a Reply