Well, I got myself a nano wifi dongle from Amazon, plugged it into my Pi, followed an on-line tutorial, and then.....Nothing!
It was one of those jobs I thought was gonna be real easy, because everyone was doing it.
So I just had to pour myself a glass of red, then decide on a logical approach to diagnose the problem.
I bought an Edimax EW-7811Un USB nano wireless adaptor as I'd read that it worked on the Pi without the need for a powered hub. I'd also seen a few tutorials that all looked remarkably similar and remarkably straight forward.
But once I'd followed all the steps and edited a couple of files, it was clear something was dreadfully wrong.
The Diagnostic Plan
So I sipped my wine while I listed a few steps, and drew up a plan.- Check that wifi adaptor is attached and recognised by system
- Check that adaptor driver has loaded
- Check network interfaces
- Check that wifi adaptor is functioning as a wireless transceiver
- Check that security settings are correct for my access point
Running the Tests
So with the wifi thingy plugged in, I ran a few tests.1. Is adaptor attached & recognised?
This just involves starting terminal and typing:-
lsusb
Output looks like this:-
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:00002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0dc6:3412 Precision Squared Technology Corp.
Bus 001 Device 005: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
This looks OK as we can see the Edimax device.
2. Is the driver loaded?
Again in terminal:-
lsmod
output includes:-
8192cu
...which I understand is the driver for this adaptor.
3. Do we have a wireless network interface?
I decided to edit the file /etc/network/interfaces to create a simple initial configuration. This can be edited later to set a static IP or for any other refinements you require.
My test file looks like this:-
auto lo
iface lo inet loopback
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Now in terminal I run:-
ifconfig
output:-
eth0 Link encap:Ethernet HWaddr b8:27:eb:ed:eb:24
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
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:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:100 (100.0 B) TX bytes:100 (100.0 B)
wlan0 Link encap:Ethernet HWaddr 80:1f:02:82:a9:a6
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
So eth0 is the ethernet interface and wlan0 the wifi. But neither have been assigned IP addresses so far. Likewise, running iwconfig does not reveal anything useful.
4. Is the adaptor working as a transceiver?
This is the point where many people get confused. A wifi adaptor does not have to become associated with (or "connected to" as some will say) a wifi access point to communicate with the outside world.
So lets see if it can see local access points:-
sudo iwlist wlan0 scan
output:-
wlan0 Interface doesn't support scanning
There is something very wrong here, but we believe this adaptor should work with the Pi.
Although there are differences between versions of PI, the main variables are: software (kernel & other stuff), peripherals (e.g. keyboard/mouse), and power supply.
Any one of these could be causing problems. but the easiest thing to try is swapping USB ports. So I move the adaptor from the top USB socket to the bottom one, and once again try:-
sudo iwlist wlan0 scan
Straight away (no reboot required) I get output which lists 7 cells (local access points). Extract:-
wlan0 Scan completed :
Cell 01 - Address: FF:6F:FE:6D:F1:AF
ESSID:"BIG PENGUIN"
Protocol:IEEE 802.11bgn
Mode:Master
Frequency:2.472 GHz (Channel 13)
Encryption key:on
Bit Rates:144 Mb/s
Extra:rsn_ie=30140100000fac040100000fac020c00
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
IE: Unknown: DD7D00230307633100800023C000101
Quality=100/100 Signal level=49/100
Cell 02 - Address: 00:81:D8:50:87:42
ESSID:"BTHub3-W4JS"
Protocol:IEEE 802.11bgn
Mode:Master
Frequency:2.412 GHz (Channel 1)
Encryption key:on
Bit Rates:144 Mb/s
Extra:wpa_ie=dd1a0050f20101000050f2
IE: WPA Version 1
Group Cipher : TKIP
Pairwise Ciphers (2) : CCMP TKIP
Authentication Suites (1) : PSK
Extra:rsn_ie=30180100000fac02020
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : TKIP
Pairwise Ciphers (2) : CCMP TKIP
Authentication Suites (1) : PSK
Quality=90/100 Signal level=43/100
Cell 03 - Address: 02:81:D8:50:87:42
ESSID:"BTWiFi"
Protocol:IEEE 802.11bgn
Mode:Master
Frequency:2.412 GHz (Channel 1)
Encryption key:off
Bit Rates:144 Mb/s
Quality=97/100 Signal level=46/100
Cell 04 - Address: 12:81:D8:50:87:42
ESSID:"BTWiFi-with-FON"
Protocol:IEEE 802.11bgn
Mode:Master
Frequency:2.412 GHz (Channel 1)
Encryption key:off
Bit Rates:144 Mb/s
Quality=93/100 Signal level=43/100
For some reason my Pi was not happy with the Edimax adaptor fitted to the top USB port (the one with the longer connections to the circuit board) and with my combined keyboard/mouse connected to the lower socket.
5. Can I connect to my wifi?
No, not yet. I need to provide security information to suit my wireless router.
This info is added to the file /etc/wpa_supplicant/wpa_supplicant.conf
Open this file with root privileges and you should find it just contains:-
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
We need to add a section like this:-
network={
ssid=yourSSID
psk=yourEncryptedPassphrase
}
You cannot just use your router passphrase, as you would normally type it in. It must be encrypted, and you can generate this by running in terminal:-
sudo wpa_passphrase yourSSID yourPassword
Example:-
sudo wpa_passphrase "BIG PENGUIN" "ticklemepink"
...the output from this can then be pasted into /etc/wpa_supplicant/wpa_supplicant.conf
Example:-
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="BIG PENGUIN"
#psk="ticklemepink psk=3a1faecd6fa5681991c85c44cb73ab44cc729ad442ae2ee4124db7e7e970a1d8
}
Now its time to run in a terminal:-
iwconfig
...to confirm that we are connected to our access point.
Success! I can now access my home network, surf the net, and update my Pi!
See also: RaspberryPi Slow To Connect
***Jan 2016 Note:-
The configuration method described above worked fine for Raspbian Wheezy versions which used "network-manager" to manage wireless networking.
This method also works on recent Wheezy and Jessie images, but the new default network manager Wicd does not recognise this configuration. So use the wpagui manager instead, and just disable or remove wicd***
No comments:
Post a Comment