SW Designs

Technology and Photography

Wireless Raspberry Pi

I run my Raspberry Pi as a headless server using ArchLinux. This post runs through how-to setup a wireless network interface using the Edimax EW-7811UN (£9.20 from Amazon) and have it connect automatically on boot, all without leaving the command line.

This post is just as much for my benefit as it is for others. It probably won’t be long before I break something and have to install the OS!

Lets get started,

  1. Ensure you have a recent release of Archlinux – I installed archlinux-hf-2012-09-18 which includes Linux 3.2 and the Edimax driver.

  2. Install the wireless management tools

1
sudo pacman -S wireless_tools iwconfig
  1. Create /etc/wpa_supplicant.conf and add your wifi settings,
1
2
3
4
5
6
7
8
9
10
ctrl_interface=/var/run/wpa_supplicant
network={
 ssid="your network name"
 scan_ssid=1
 proto=WPA2
 key_mgmt=WPA-PSK
 pairwise=CCMP
 group=TKIP
 psk=your passphase key
}
  1. Manually bring up your wireless interface to check your settings
1
sudo wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant.conf -d
  1. Then run /sbin/ipconfig wlan0 to check whether it’s connected, if is says ‘not associated’ it failed to connect. Once your connected, you and request an IP address from your router with,
1
sudo dhcpd wlan0

Run ipconfig again and you should see your IP address.

  1. Now we can move onto configuring your RPi to automatically connect on bootup. To do this, we’ll create a network profile using netcfg and configure systemd to start it during bootup.
1
sudo pacman -S netcfg
  1. Define a network profile, create /etc/network.d/wlan and enter the following details
1
2
3
4
5
6
7
8
CONNECTION='wireless'
DESCRIPTION='any description'
INTERFACE='wlan0'
SECURITY='wpa-config'
WPA_CONF='/etc/wpa_supplicant.conf' ; this is the file we created earlier
IP='dhcp'
WPA_DRIVER='wext'
NETCFG_DEBUG=yes
  1. Now register your network profile with netcfg by adding the above filename to the NETWORKS list /etc/conf.d/netcfg,
1
NETWORKS=(wlan)
  1. Finally configure systemd to start netcfg during bootup,
1
systemctl enable netcfg.service

Comments