How to Configure Raspberry PI for WiFi using Edimax EW-7811Un

I have updated this article to embrace use of the WPA Supplicant with a Raspberry Pi.

The EW-7811Un works very well with a combination of using  wpa-supplicant software and settings in “/etc/network/interfaces” file. Add the following in the /etc/interfaces file. WARNING:  Make sure that you know what you’re doing, and advising that any messup here will render your network inaccessible and will require entering the Raspberry Pi thru a serial console.

 

 

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
pre-up wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B -P /var/run/wpa_supplicant.wlan0.pid
post-down killall -q wpa_supplicant

 

 

Edit a file in /etc/wpa_supplicant/wpa_supplicant.conf and add the following, which will contain one or more SSID’s including one to connect to an open router:

 

ctrl_interface=DIR=/var/log/wpa_supplicant GROUP=netdev
update_config=1

network={
key_mgmt=NONE
}

network={
ssid=”YOURSSIDHERE”
scan_ssid=1
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk=”YOURPASSWORDHERE”
}

 

Below is the original article using the wpa-supplicat software if desired.


The Edimax EW-7811Un will only work using WPA-PSK security. In Netgear, I chose in my security options to have both WPA and WPA2:  WPA-PSK [TKIP] + WPA2-PSK [AES]

To configure wifi in a few easy steps. Login to Linux. Follow steps as described in reference 1 link below.

Launch a repository update:  $ sudo apt-get update
Run a system upgrade: $ sudo apt-get upgrade
Make sure that the latest Raspberry Pi firmware version is installed:  $ sudo apt-get install raspberrypi-bootloader
Install the wpa_supplicant utility: $ apt-get install wpasupplicant

Generate a PSK version of your WLAN password with wpa_passphrase utility: $ sudo wpa_passphrase YOURSSID YOURPASSWORD

It will generate something like this:

network={
ssid=”YOURSSID
#psk=”YOURPASSWORD
psk=b7d90db3ddbd11d5ddb3dbfd81de3da6dd0dbcd53d0aa21a5ba8aac5a6faf9a5
}

Add the generated information to the bottom of the file: /etc/wpa_supplicant/wpa_supplicant.conf

Use WinSCP to copy, edit, and copy it back if nano or vi are too much.

network={
ssid=”YOURSSID
scan_ssid=1
key_mgmt=WPA-PSK
proto=WPA
psk=”YOURPASSWORD
}

With the ethernet cable connected, issue this command:

sudo ifdown wlan0; ifup wlan0

Your router should be issuing an IP address to the wlan0 via DHCP.

You should see an IP address (in red below) assigned to the wlan0 interface and the blue light blinking on the Edimax:

pi@raspberrypi:~# sudo ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:ea:53:80:dc
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9976 errors:0 dropped:0 overruns:0 frame:0
TX packets:3785 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8296190 (7.9 MiB) TX bytes:449405 (438.8 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1248 (1.2 KiB) TX bytes:1248 (1.2 KiB)

wlan0 Link encap:Ethernet HWaddr 80:1f:02:86:ea:a1
inet addr:192.168.1.69 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:339 errors:0 dropped:467 overruns:0 frame:0
TX packets:57 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:102962 (100.5 KiB) TX bytes:13933 (13.6 KiB)

 

Now you can disconnect the ethernet cable, and login again to the PI wirelessly using putty using the IP address assigned by your router via DHCP.

 

References