Learn how to set up a wireless network using your Raspberry Pi and learn how to manage and use the various networking options that are available.
Plug in your wireless device into your Raspberry Pi or a USB hub. I prefer to plug my devices into a USB hub to save the Raspberry Pi from wear and tear.
Before we can use the wireless device, we must first find out the name of our device so we can find the necessary drivers. Enter the following command:
This will list all the usb devices attached to our 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.
The key information listed above has been bolded. This ID is what we will be searching for when looking for the drivers needed to use the adapter.
Before we 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. Just enter:
$ apt-get update
When the updates have finished downloading, enter:
$ apt-cache search RTL818
Remember your device may be different, so you will be entering your device ID for your device. You may have noticed that I only entered RTL818 instead of the whole ID. This is because it didn’t 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
$ sudo apt-get install firmware-realtek
After a few minutes of updating you will be back at your $ prompt. Enter the following command to see if your adapter is listed.
You will see the same ID of your device listed.
Module Size Used by
rtl8187 44897 0
You can ignore the above details. All we need to know is that the ID of your device is mentioned when you typed lsmod.
Now we just need to create a configuration file for the wireless adapter. We are going to do this by create a file. Enter the following command:
$ sudo nano /etc/wpa.config
Now enter the following, save the file and exit back to the $ prompt
The last part of this configuration is to add a reference to the interfaces. Issue the command:
$ sudo nano /etc/network/interfaces
Add the following
iface wlan0 inet dhcp
Save this file and exit.
The final stage of this process is to unplug your network cable as we want to test that the wireless device is actually working, so restart the network by entering:
$ sudo /etc/init.d/networking restart