Enable wireless networking

Assuming the required kernel modules are available then you just need to follow the steps below to enable and configure wireless networking. These instructions were tested using a N150 Nano USB wireless adaptor with both a Raspberry Pi and in intel PC running Raspbian/Debian wheezy, but should work with other types of wireless network and systems as well.

Providing your kernel includes support for your hardware and you install the correct firmware package these instructions should work for other supported devices on system running other versions of Debian as well. I’ve assumed that you have one of the ‘nano’ USB wireless network adapters that use the RT5370 Wireless Adapter chipset so to enable wireless networking you need to start by installing the appropriate firmware from the non-free repository.

To do this you need to be running as root.

$ su
Password: 

OR

$ sudo -i
Password: 

Then you will need to add the non-free repository to the list of repositories that will be used when installing new packages.

# vi /etc/apt/sources.list
# /etc/apt/sources.list
#
deb http://archive.raspbian.org/raspbian/ wheezy main non-free
deb-src http://archive.raspbian.org/raspbian/ wheezy main
#
deb http://archive.raspbian.org/mate wheezy main
#

Then update the package lists and install the required firmware.

# apt-get update
Hit http://archive.raspbian.org wheezy Release.gpg
  :
  :
  :
Reading package lists... Done
# apt-get install firmware-ralink
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  initramfs-tools linux-image
The following NEW packages will be installed:
  firmware-ralink
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/21.4 kB of archives.
After this operation, 96.3 kB of disk space will be used.
  :
  :
  :
#

To connect to a wireless network we also need the following two packages..

# apt-get install wireless-tools wpasupplicant
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libiw30 libnl-3-200 libnl-genl-3-200 libpcsclite1
  libreadline5
Suggested packages:
  pcscd wpagui libengine-pkcs11-openssl
The following NEW packages will be installed:
  libiw30 libnl-3-200 libnl-genl-3-200 libpcsclite1
  libreadline5 wireless-tools wpasupplicant
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 963 kB of archives.
After this operation, 2,168 kB of disk space will be used.
Do you want to continue [Y/n]? y
  :
  :
  :
  :
#

To check that the wireless interface is detected.

# iwconfig
wlan0  IEEE 802.11bgn  ESSID:off/any  
       Mode:Managed  Access Point: Not-Associated  Tx-Power=0 dBm   
       Retry  long limit:7  RTS thr:off  Fragment thr:off
       Encryption key:off
       Power Management:on
          
lo     no wireless extensions.

eth0   no wireless extensions.
#

If there is not an entry corresponding to your wireless network then your wireless device is not supported, you may find that upgrading to a newer kernel (using apt-get upgrade), or newer linux release solves this problem.

Configure the wireless interface

# vi /etc/network/interfaces


# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet dhcp
    wpa-ssid your-ssid
    wpa-psk  your-password

You will need to substitute your real network ssid (the name of your wireless network) and your real network password, sometimes referred to as a pre-shaired key or PSK, in place of your-ssid and your-password in /etc/network/interfaces.

If the connection keeps dropping out for no apparant reason it may help to disable power management on the wireless interface which can be done by modifying the wireless configuration.

# vi /etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet dhcp
    wpa-ssid your-ssid
    wpa-psk  your-password
    wireless-power off


Raspberry Pi is a trademark of the Raspberry Pi Foundation

Advertisements
This entry was posted in Debian, Hardware, Linux, Raspbian, Ubuntu and tagged , . Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s