Wireless Networking with Raspberry Pi

The Raspberry Pi is great and I really enjoy it, but I couldn’t help to think that it would greatly benefit from wireless capabilities. I can only assume for cost reasons they didn’t ship it with onboard wireless networking (the newly announced Raspberry Pi 2 does not have wireless either).

This morning I received the Edimax EW-7811Un Wi-fi USB Adapter in the mail that I ordered a few days ago. (Thanks Amazon for the free Sunday delivery!) A little bit about this USB Adapter – it’s a super tiny thumb-sized USB-based Wifi adapter that is capable of connecting to b/g/n networks that doesn’t require external power. It also runs the Realtek RTL8188CUS chipset which is widely supported by many Raspberry Pi distros, including Raspbian 2014-09-09, the OS that I am running.

Adding the Edimax Nano Wireless USB Adapter doesn't add too much bulk.

Adding the Edimax Nano Wireless USB Adapter doesn’t add too much bulk.

Side shot with the USB adapter installed.

Side shot with the USB adapter installed.

Setup is easy.

Plug in the USB adapter into an available USB port on the Pi, and power on the Pi. You will need a keyboard at the very least, or if you’re running in headless mode, you will need it to be plugged into a network cable so you can SSH remotely into it.

Edit the network interfaces file like so in your editor of choice (emacs, obviously, being the best choice):

You’ll see some configuration in here by default, you’ll want to replace it with the configuration below. You’ll want to type your Wireless SSID and Password in for where I’ve put placeholders (you will want to retain the double quotes):

At this point you will want to restart networking, you can do so by issuing the following command:

From here, running ifconfig will list all of the active network interfaces – if you see a valid IP next to wlan0 then we’re in business; you can disconnect your ethernet cable and congratulations, you’ve cut one more cord from the awesomeness that is the Pi!

As a side note, as normally, ethernet will continue to work as a separate interface. i.e. Raspbian will assign through DHCP an IP to eth0, as well as an IP to wlan0 if both a Wireless connection and Ethernet connection is made. This is redundant so it’s discouraged, but useful in case you are having trouble with wireless and need to fall back onto Ethernet to do some troubleshooting.