Add Wireless To The Raspberry Pi

I had bit of a nightmare getting wireless to work properly so I put together this howto hoping it will help others. This was done on a raspberry pi running raspbian (wheezy).

sudo apt-get install wireless-tools wpasupplicant

get your psk using the following command where yourssid is your SSID’s name ie HOME and where passphrase is your wireless password ie PASSWORD123 wpa_passphrase yourssid yourpassphrase

Using my examples above this should output the following

network={
ssid="HOME"
#psk="PASSWORD123"
psk=57d9fbb3d0e8eed3bd17d76a61805e2c4b73a81d1686debeaf44559d8bc15800 }

From this copy the psk string then

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

and insert it onto the psk line and edit the SSID name, save and exit.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid=”HOME”
scan_ssid=1
psk=57d9fbb3d0e8eed3bd17d76a61805e2c4b73a81d1686debeaf44559d8bc15800
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}
sudo nano /etc/network/interfaces and add the following (obviously adjust it to your network setup ie static etc), save and exit
auto lo
iface lo inet loopback
iface eth0 inet dhcpallow-hotplug wlan0
iface wlan0 inet dhcp
pre-up wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B
Now I had a problem whereby wirless was only bougth up when the wired conneciton was plugged, obviously this defeats the whole object of wireless so I managed to come up with this fix
sudo nano /etc/default/ifplugd and add the following
# This file may be changed either manually or by running dpkg-reconfigure.
#
# N.B.: dpkg-reconfigure deletes everything from this file except for
# the assignments to variables INTERFACES, HOTPLUG_INTERFACES, ARGS and
# SUSPEND_ACTION. When run it uses the current values of those variables
# as their default values, thus preserving the administrator's changes.
#
# This file is sourced by both the init script /etc/init.d/ifplugd and
# the udev script /lib/udev/ifplugd.agent to give default values.
# The init script starts ifplugd for all interfaces listed in
# INTERFACES, and the udev script starts ifplugd for all interfaces
# listed in HOTPLUG_INTERFACES. The special value all starts one
# ifplugd for all interfaces being present.
INTERFACES=""
HOTPLUG_INTERFACES="wlan0 eth0"
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop"

Save and exit then reboot and hopefully your wireless interface will be bought up and connect successfully.

You may also like

Leave a Reply

Your email address will not be published. Required fields are marked *