RPi WiFi Networking for FOMOphobia 3

Glancing again at my network configuration, it depends on the Raspberry Pi’s taking advantage of WiFi. So I figured the time was right to get the WiFi working on the RPi. I’m going to go into it in some detail here, both for the benefit of others doing the same thing, and for myself when I have to configure a half dozen of these things for the completed project.

IMG_1880

Earlier, I had shopped around for a mini USB WiFi adaptor, checking the Raspberry Pi compatibility pages to ensure that the chipset was easily compatible with wheezy-raspbian, the Pi’s flavor of Debian.  I found the Edimax EW-7811Un wifi adapter based on the Realtek RTL8188CUS chipset reputed to be compatible with RPi.  It was a tiny little thing.

IMG_1883

I also had been warned that I needed a 1 amp or greater power supply for the RPi since the WiFi sucked up the juice. Many people had gotten very weird and inconsistent results with underpowered power supplies.

I plugged the little WiFi adapter in and watched /var/log/messages. I could tell that the system recognized it and attempted to auto configure it. Lots and lots of log messages, attempted, failed, succeeded this and that. I don’t speak the dialect of either the USB or  WiFi subsystem, so it was greek to me.

Right away, though, I could scan the wireless networks from the command line and see Eduroam and Cruznet, the two wifi networks we have on campus.

root@raspberrypi:~# iwlist scan
lo        Interface doesn't support scanning.
eth0      Interface doesn't support scanning.
wlan0     Scan completed :
          Cell 01 - Address: 00:27:0D:71:5B:32
                    ESSID:"eduroam"
                    Protocol:IEEE 802.11g
                    Mode:Master
                    Frequency:2.437 GHz (Channel 6)
                    Encryption key:on
                    Bit Rates:54 Mb/s
                    Extra:rsn_ie=30140100000fac040100000fac040100000fac012800
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : 802.1x
                    Quality=100/100  Signal level=97/100  
          Cell 02 - Address: 00:27:0D:71:5C:70
                    ESSID:"cruznet"
                    Protocol:IEEE 802.11g
                    Mode:Master
                    Frequency:2.412 GHz (Channel 1)
                    Encryption key:off
                    Bit Rates:54 Mb/s
                    Quality=37/100  Signal level=58/100  
          Cell 03 - Address: 00:27:0D:71:5C:72
                    ESSID:"eduroam"
                    Protocol:IEEE 802.11g
                    Mode:Master
                    Frequency:2.412 GHz (Channel 1)
                    Encryption key:on
                    Bit Rates:54 Mb/s
                    Extra:rsn_ie=30140100000fac040100000fac040100000fac012800
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : 802.1x
                    Quality=54/100  Signal level=60/100

Sweet.  But according to debian.org, to authenticate with a WPA2 Enterprise network like Eduroam, I needed to install another package called wpa_supplicant.

root@raspberrypi:~# aptitude update
root@raspberrypi:~# aptitude install wpasupplicant

Then I had to configure the network interfaces.

root@raspberrypi:~# vi /etc/network/interfaces

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
        wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

root@raspberrypi:~# vi /etc/wpa_supplicant/wpa_supplicant.conf

# WPA2-EAP/CCMP using EAP-TLS

ctrl_interface=/var/run/wpa_supplicant

network={
        ssid="eduroam"
        key_mgmt=WPA-EAP
        eap=PEAP
        phase2="MSCHAPV2"
        anonymous_identity="anonymous@ucsc.edu"
        identity="wmodes@ucsc.edu"
        password="xxxxxxxxxxxxxxx"
}

Then for security’s sake, we batten down the hatches:

root@raspberrypi:~# chmod 0600 /etc/network/interfaces /etc/wpa_supplicant/wpa_supplicant.conf

What happens when I powerup the network interface?

root@raspberrypi:~# ifup wlan0
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
Internet Systems Consortium DHCP Client 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/80:1f:02:be:dd:be
Sending on   LPF/wlan0/80:1f:02:be:dd:be
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPOFFER from 1.1.1.1
DHCPACK from 1.1.1.1
bound to 169.233.224.75 -- renewal in 6579 seconds.

That looks hopeful.  Checking network connections:

Screen Shot 2013-11-09 at 4.20.19 PM

Oh snap! I have an IP address assigned through DHCP on the Eduroam wireless.

At this point, I unplugged the ethernet cable (eth0 in the above config) but was unable to see out to the world or ping from the outside.  But when I rebooted with the ethernet cable unplugged, the wireless networking connection became the active ethernet.

At that point I was able to ping and ssh from the outside.

Screen Shot 2013-11-09 at 4.19.54 PM

This is kind of a BFD because a lot of people have struggled with getting the RPi to do wireless, let along connecting to Eduroam, the most notoriously hard to configure network on Earth.

3 thoughts on “RPi WiFi Networking for FOMOphobia

  1. Reply kai Nov 9,2013 6:22 pm

    Thanks for letting me help test your ping-ability :)

  2. Reply Robert Dec 9,2013 5:23 pm

    Thank you so much for this!!!! I have been trying to get my pi to connect to eduroam for hours now!! This post was exactly what I needed. Now I just need to get my XBee connected to it and start logging data. Have you ever done this?

Leave a Reply to Robert Cancel Reply