Saturday, December 12, 2015

WiFi on Raspberry Pi 2 Raspbian Linux

Basically, all wireless networks that your Raspberry Pi 2 connects to automatically on Raspbian are listed in
/etc/wpa_supplicant/wpa_supplicant.conf
 For example, here is my wpa_supplicant.conf file with the networks and passphrases masked out.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="simplenetwork-ssid"
    psk="your-key"
    key_mgmt=WPA-PSK
}

network={
    ssid="hiddenssid-wpa2-TKIP"
    scan_ssid=1
    psk="your-key"
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=TKIP
    auth_alg=OPEN
}
Look at the two network entries there. The first one is a simple guest network like the kind you'd find at a hotel lobby. It just has a wireless password ("your-key") to it.

The latter is my home network. The SSID is hidden (therefore: scan_ssid=1). The key_mgmt, pairwise, and auth_alg are parameters for WPA2-Personal security with TKIP (usually this is CCMP but I set my router up with TKIP).

PS: if you use Ubuntu MATE for the Raspberry Pi 2 ( https://ubuntu-mate.org/raspberry-pi/ ) rather than Raspbian, you have GUI wireless tools.

This web page: http://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/ was the reference I used to figure out my wireless woes on Raspbian before I switched to Ubuntu-MATE.

Now note above that the passphrase is stored in plain text. Raspbian makes it so only the root user can see the wpa_supplicant.conf file by default, but is that good enough for you? If not, you can set up masking of the passphrase by using the command
wpa_passphrase [ssid] [passphrase]
then you can update /etc/wpa_supplicant/wpa_supplicant.conf
and change
psk="your-key"
to
psk=your-key's-masked-string
This encrypts the key with an encryption algorithm using the SSID as a seed to the encryption. So a simple glance at the psk value won't give you the key.

.

No comments: