Linux WiFi configuration

Software

On most computers with a GUI, configuring WiFi is easy. However, on a headless Linux box—often a Raspberry Pi in my case—it often strikes me as a painfully baroque task.

Part of the problem is simply that Linux’s WiFi stack supports a very wide range of different configurations, but I just want to connect to a particular WiFi network with a given password. As is often the case, it’s actually very easy to do this, once you’ve worked out what you don’t need.

Only two files matter: /etc/network/interfaces and /etc/wpa_supplicant/wpa_supplicant.conf.

/etc/wpa_supplicant/wpa_supplicant.conf

This splendidly named file contains the WiFi configuration data. I’m happy to rely on the defaults, but obviously I need to specify the name (SSID) and password (PSK) for the WiFi network I want to use. My file looks like this:

Raspberry Pi Hardware

Sadly the Raspberry Pi doesn’t come with Wi-Fi. However it does have USB ports, and USB Wi-Fi adaptors are cheap. In the UK, Amazon sell the Edimax EW-7811UN1 for less than ten pounds. It seems to work reliably if you just plug it into the Raspberry Pi’s USB socket: no hub required.

Six months’ ago, we had to fettle the kernel drivers to make all this work, but in the 2013-02-09 release of Raspbian it all just works.