Configure WiFi on your Pi

I’m using the “official” Wi-Pi USB WiFi dongle and need to configure it. I’m going to do it via terminal over the wired ethernet port to start with.

GETTING THE NETWORK DETAILS

To scan for WiFi networks, use the command

sudo iwlist wlan0 scan | grep 'ESSID\|IE: IEEE'

This will list all available WiFi network names and their encryption methods. Look for yours in the list:

  1. ESSID:"yournetwork". This is the name of the WiFi network, find the one that you want to use.
  2. IE: IEEE 802.11i/WPA2 Version 1.
    1. This is the authentication used; in this case it is WPA2, the newer and more secure wireless standard which replaces WPA1. This guide should work for WPA or WPA2, but may not work for WPA2 enterprise; for WEP hex keys.

ADDING THE NETWORK TO THE RASPBERRY PI

Open the wpa-supplicant configuration file in nano:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Go to the bottom of the file and add the following:

network={
    ssid="The_ESSID_from_earlier"
    psk="Your_wifi_password"
}

In the case of the example network, we would enter:

network={
    ssid="testing"
    psk="testingPassword"
}

Now save the file by pressing ctrl+x then y, then finally press enter.

At this point, wpa-supplicant will normally notice a change has occurred within a few seconds, and it will try and connect to the network. If it does not, either manually restart the interface with

sudo ifdown wlan0

and

sudo ifup wlan0

or reboot your Raspberry Pi with

sudo reboot

You can verify if it has successfully connected using ifconfig wlan0. If the inet addr field has an address beside it, the Pi has connected to the network. If not, check your password and ESSID are correct.

You can also check your DHCP server to see if it gave out a new IP address.

Advertisements

Author: Helicopter Jeff

I'm a vinyl decal cutting and designing, Astrophotography and general photography capturing, RC helicopter/quad copter pilot, Arduino and Raspberry Pi hardware/software developer, network, scripting and troubleshooting ninja living in the metro NY area. I am passionate about my hobbies so much I do them for a living. There's nothing better than getting paid to do what you love.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s