Raspberry Pi Wireless Network Setup

This article will demonstrate how you can set up a wireless network using your Raspberry Pi and explain how to manage and use the various networking options that are available.

Plug in your wireless device/dongle directly into your Raspberry Pi or a USB hub. Plugging devices into a USB hub will save the Raspberry Pi from wear and tear, but they are cheap so I just plug them in directly.

Before you are able to use the wireless device, you must first identify the name of your wireless device so that you can find the necessary drivers. Enter the following command: lsusb.

This command will list all the usb devices attached to your Raspberry Pi. You will be looking for something that resembles your wireless device. Search through the list of USB devices for a wireless adapter. The result may differ depending on the devices you have attached.

Bus 001 Device 005: ID 0bda:8189 Realtek Semiconductor Corp. RTL8187B Wireless 802.11g Network adapter.

I have highlighted the ID in the information listed above in bold font. This ID is what you will be searching for when looking for the drivers needed to use your adapter.

Before you continue, you will need to update your package information. Be sure that you're network cable is plugged in as we need to get some udpates from Debian. Enter the following: apt-get update.

When the updates have finished downloading, enter:

apt-cache search RTL818

Remember that your device may be different, so you will be entering the device ID for your device. You may have noticed that I only entered RTL818 instead of the whole ID. This is because it did not find the adapter when using the apt-cache command. You may need to shorten your description. The result returned for my device was:

Firmware-realtek - Binary firmware for Realtek wired and wireless network adapters

Enter the following command:

sudo apt-get install firmware-realtek

After a few minutes of updating, you will be back at your command prompt. Enter the following command to see if your adapter is listed: lsmod.

You will see the same ID of your device listed.

Module		Size	Used by
rtl8187		44897	0

You can ignore the above information. All we need to make not of is that the ID of the wireless device is mentioned when you typed lsmod.

Now you just need to create a configuration file for the wireless adapter. You are going to do this by using nano to create a file, so enter the following command:

sudo nano /etc/wpa.config

Now enter the following, save the file and exit back to the command prompt:

network={
ssid="YOUR_SSID"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="WPA-PASSWORD"
}

The last part of this configuration is to add a reference to the interfaces. enter sudo nano /etc/network/interfaces and add the following:

auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa.config

Save the file and exit.

The final stage of this process is to unplug your network cable as you would want to test that the wireless device is actually working.

Restart the network by entering:

sudo /etc/init.d/networking restart