Thursday, 7 February 2013

Setting Up Wireless Networking - Part 1

Some of the more recent distributions of Raspbian "Wheezy" already include the necessary apps for managing WiFi networking - look for an icon called "Wifi Config" (or "wpa_gui") on your LXDE desktop, or an application called "wpa_gui" under the "Internet" sub-menu of the "Start Menu". If you have this icon on your desktop (or in your start menu) you can probably skip the rest of this post and go on to "Setting Up Wireless Networking - Part 2".

To install the wireless network software type the following at the command line prompt and press Enter:

pi@raspberrypi ~ $ sudo apt-get install wpasupplicant_

You may already have this package on your system, but entering this command won't do any harm even if you do. Then type the following and press Enter:

pi@raspberrypi ~ $ sudo apt-get install wpagui_

Once these packages have been downloaded and installed go to the LXDE GUI and you should have an application called "wpa_gui" under the "Internet" sub-menu of the "Start Menu". If you right click on this menu item and then click on "Add to Desktop" a shortcut to this app will be placed on your LXDE desktop for future reference.

Now we need to configure wireless networking. Double click on the "File Manager" icon on the LXDE dessktop, or go open the "Start Menu" by clicking on the strange looking icon on the bottom left corner of the screen and select "Assessories>File Manager". Go to the /etc/network folder and click on the "Tools" menu and select "Open Current Folder as Root":

This will open a new "File Manager" window. Now right click on the "interfaces" file and click on "Leafpad", or if this option isn't available, click on "Open with..." and choose "Accessories>Leafpad" and click "OK":

This should open a new "Leafpad" window containing the "interfaces" file. Go to the end (bottom) of the file and then edit the file by typing in the following lines of text:

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

The "interfaces" file should now look like the following screenshot:

Now click "File>Save" and then "File>Quit". Go back to the "File Manager" window that you opened as "Root"  (this is the one with "root" at the top of the list of "Places" on the left side of the window). Go to the /etc/wpa_supplicant folder. Right click anywhere in the window and select "Create New...>Blank File"

Enter the name "wpa_supplicant.conf" and click "OK".

You should now have a new file called "wpa_supplicant.conf" in the /etc/wpa_supplicant folder:

Right click on the new file and open it in "Leafpad", and then enter the following text into the blank file:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

Save the file by clicking on "File>Save" and then close "Leafpad". You can also now close both "File Manager" windows that are open.

Finally, open a "LXTerminal" window and type the following at the command prompt and press Enter:

pi@raspberrypi ~ $ sudo chmod 600 /etc/wpa_supplicant/wpa_supplicant.conf_

Please note that the above command should all be entered on one line, but there was insufficient space to do so here. Then enter the following command and press Enter:

pi@raspberrypi ~ $ sudo adduser pi netdev_

You should get confirmation that user "pi" has been added to group "netdev":

Now close the LXDE GUI and shut down your Raspberry Pi. The changes you have made will take effect next time your Raspberry Pi is botted up.

1 comment: