style-light-choice
style-dark-choice 
Avatar
Gary
Vollink.com

7 November 2005
Last Update: 22 Apr 2007

PROGRESS, NOT PROGRESSION

In the last few months several things have happened to make this page less useful.  First, my access to a wireless Centrino laptop has disappeared, due to my having a new job.  Also, my personal laptop (a very old system) simply stopped working.  The first two conditions make me blind to the WiFi on Debian issue (for a while). 
During the same time, I was recently told, the Debian project announced that the wpa_supplicant package will no longer include a service startup script.  My ability to properly re-write this page is diminished, and currently, this page relies on the startup script provided by the wpa_supplicant package.

Details on this change can be found at the Debian WPA Wiki.

THE KINDNESS OF STRANGERS
As you read through this, keep in mind that some things won't make sense.  Then, check the CREDITS section. Several people have written descriptions of how they got it to work despite recent changes.  There are at least two ways to tackle the problem represented, so be sure to check all of the credits from May 3, 2006 on.

WiFi with WEP and Even WPA on Debian

I've recently been trying to find out how to get WiFi access working smoothly on my Linux laptops.  There are numerous packages that deal with agile networking (the ability to disconnect from one network, and connect to another without rebooting).  However, some of them are no longer actively maintained, and many do not support the higher security WiFi options, like WPA.  Because of this (and the advise left behind on the waproamd web site), I have chosen to use wpa_supplicant.

I do not cover the actual installation of a wireless network driver.  There are numerous wireless drivers, and numerous web sites that deal with that task.  On the other hand, I could not find any resource that put together the steps to use after the wireless device is installed.  If you don't have the 'wireless-tools' package yet, install it now.  The rest of this document assumes that you can type 'iwlist scan' at a root/su command shell, and see at least one wireless router.

Tested On These Distributions:

I initially set this up on Debian Sarge stable, on Ubuntu, Debian Testing, and finally I installed it against Debian unstable - (current as of the above "Major Update").  There were very few differences between these, so the steps should be the same on any Debian variant.

If you find out this works on a any distribution not listed below, E-mail me*, and I'll note it here. 

x86 - Ubuntu 5.10 (Breezy Badger): Works
x86 - Debian Sarge (Stable): Works
x86 - Debian Etch (Testing): Worked (Read the top paragraph)
x86 - Debian Sid (Unstable): Worked (Read the top paragraph)
AMD64 - Debian Etch (Testing): Anonymously Reported as Working* (may no longer)
x86 - Kubuntu 5.10 (Breezy): Anonymously reported as Working*
AMD64 - Kubuntu 5.10 (Breezy): Reported as Working*

* See Credits below.

Procedure

Identifying Your Wireless Driver

Most drivers are named very clearly.  When I find exceptions to this, I'll continue to make notes here:

I found this Email, describing a change in IPW drivers effecting kernels 2.6.13 and higher. If you are running kernel 2.6.13 or higher, and you are using an ipw2100/ipw2200, then you need to use the wext (Linux wireless extensions) interface.  I tested this, and verified it works correctly under Sid. 

Examples Use JavaScript

The examples on this page rely heavily on JavaScript. If JavaScript is not enabled, you will not be able to change the examples from their default settings of a wlan0, hotplug interface, using the hostap driver.  Otherwise, use these drop down boxes to set the examples:

Name:
Pluggable:
Driver:

Installing Ifplugd

Ifplugd is fairly simple.  When a network interface does not have a connection, most network drivers detect this.  Ifplugd waits for a connect state, and enables the interface (more details below).  When a disconnect state occurs, ifplugd disables the interface. 

There are alternative packages, like laptop-net, that can make more complex choices about how to bring up an interface, and those may work fine, too.  No alternative interface plugging managers were tested.  In any case, for wpa_supplicant to work, something has to be able to bring the interface up and down when necessary, and ifplugd works for me and the folks I know personally.

Command Shell:
gavollink@debian:~$ sudo apt-get install ifplugd
Password: ********
Installation under most systems the install asks for network details...
Interfaces to be watched by ifplugd:
eth0

Hotplug interfaces be watched by ifplugd:
wlan0

arguments to ifplugd:
-q -f -u0 -d10 -w -I

Ubuntu doesn't always prompt for configuration parameters as shown above, but the resulting file needs to be the same.  This can be used as comparison.

/etc/default/ifplugd:
INTERFACES="eth0"
HOTPLUG_INTERFACES="wlan0"
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop"

Modify System Networking

Now that ifplugd will take care of the network, the "networking" startup script doesn't have to stop and wait for dhclient to fail for any wires that are not plugged in.  Ifplugd will bring up the interfaces when it's ready.  To get this faster behavior, the /etc/network/interfaces file has to change.


/etc/network/interfaces:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

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

# Wireless... (this section may or may not already exist)
allow-hotplug wlan0
iface wlan0 inet dhcp

Installing WPA_Supplicant

The following is what the install looks like for wpa_supplicant.

Command Shell:
gavollink@debian:~$ sudo apt-get install wpasupplicant
Password: ********
Reading package lists... Done
Building dependency tree... Done
The following NEW packages will be installed:
  wpasupplicant
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 150kB of archives.
After unpacking 397kB of additional disk space will be used.
Get:1 http://ftp.us.debian.org testing/main wpasupplicant 0.4.4-1 [150kB]
Fetched 150kB in 1s (134kB/s)
Selecting previously deselected package wpasupplicant.
(Reading database ... 168411 files and directories currently installed.)
Unpacking wpasupplicant (from .../wpasupplicant_0.4.4-1_i386.deb) ...
Setting up wpasupplicant (0.4.4-1) ...
wpasupplicant: disabled, see /etc/default/wpasupplicant

Configuring /etc/default/wpasupplicant

As the install notes, configuration of wpasupplicant must be done manually.  The following is a functional /etc/default/wpasupplicant file.

/etc/default/wpasupplicant:
ENABLED=1
OPTIONS="-w -i wlan0 -D hostap -c /etc/wpa_supplicant.conf"

Configuring /etc/wpa_supplicant.conf

The importance of creating (or editing) the /etc/wpa_supplicant.conf file cannot be under-estimated. Note: Debian stable did not install one at all, where Debian testing and Ubuntu install a very basic version.

This is a basic wpa_supplicant.conf file for moving between a home wireless using 128bit WEP, a corporate office using WPA-PSK (TKIP), and a "coffee shop" type open wireless.  Note: The higher priority networks are tried first, so OPEN/unsecured networks (if you choose to use them) should always have a low priority.

Note: Most of the values within the 'network=' sections will require modifications for any specific set of environments. 
/etc/wpa_supplicant.conf:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0

eapol_version=1
ap_scan=2
fast_reauth=1

# Single key 128bit WEP
network={
        ssid="My-Home"
        key_mgmt=NONE
	wep_key0=ABCDEF01234567890123456789
	wep_tx_keyidx=0
	priority=5
}

# WPA-PSK
network={
        ssid="Corporate Office"
	proto=WPA
        key_mgmt=WPA-PSK
	pairwise=TKIP
	psk="very_secret"
	priority=4
}

# Coffee shop / Open
network={
        ssid=""
        key_mgmt=NONE
	priority=2
}

Start Wpasupplicant

Once the files above have been organized, start wpasupplicant:

Command Shell:
gavollink@debian:~$ sudo /etc/init.d/ifplugd start
Starting Network Interface Plugging Daemon eth0 wlan0: done.
gavollink@debian:~$ sudo /etc/init.d/wpasupplicant start
Starting wpa_supplicant: done.

The wireless network interface should enable automatically.  On a removable interface, it may be necessary to remove and insert it the first time. 

Wireless Routers; Apply, Wait, Apply Again and Wait

This paragraph is totally non-scientific.  However, it wasted two hours of my time while setting up a used Netgear wireless router.  I have heard complaints of this elsewhere, with other brands, but never understood the significance. It usually goes like this, "I had given up, and the next day, it was working!"

The configuration on some wireless routers (specifically home-networking class), takes time to "stick".  If you think it should work, and your files follow the examples above, and it basically just looks like it should work, but it doesn't work, it might not be broken.  Shut off your wpa_supplicant configuration, or even your whole computer.  Walk away without chaning anything on the router for ten minutes.  Try to connect again.  If it's not working, go to the Access Point's Interface, and apply the same wireless settings again (don't actually change them though).  Wait 10 minutes.  Try connecting again.

By this time, if it still doesn't work, resume fiddling.

Credits

If you decide to Email me, PLEASE let me know how you would like to be credited. I will accept Names, Emails, Links (to your home page or business, but only Safe For Work links), or combinations of these.

22 Apr 2007:
Anonymous (Currently Waiting for User Attribution information) noted that this information successful for Debian Etch under PowerPC Architecture (iBook).  No specific Kernel or Card/Driver information.

11 Nov 2006:
Jesse Murphy sent an updated HowTo, for a recent 'testing' version.  It also has info on roaming!

01 Jun 2006:
Steve McCullough sent a MadWifi site link, but says it should apply to any driver.

30 May 2006:
Tony D'Amato sent a set of corrections.

27 May 2006:
David Wainberg sent a set of corrections, and gave me permission to include his Email address.

03 May 2006:
Kevin Bewley: Noted:

...It was working beautifully as you described, but recently the wpa_supplicant maintainers in Debian have *broken* the package in unstable and testing(etch) so that there is no longer a startup script in /etc/init.d/.. I don't know if you aware of this but it might be an idea to put a note on your page saying that if they want to use your method in a testing or unstable (stable is still working fine) environment they should _pin_ their wpa_supplicant package at the stable build. Upgrading to testing or unstable will break their working set ups.

25 March 2006:
Marcin Jaworski: Noted:

Acer Aspire 5024WLMi (wifi card is from broadcomm - I had to use ndiswrapper to enable interface and acer_acpi to enable it's radio circuits first)
Kubuntu Breezy 5.10 (AMD64 version, 2.6.12-10-amd64-generic kernel)

2 February 2006:
Bjarke Rose Fjeldsted: Noted that in the /etc/default/wpasupplicant detail window, if the ATMEL card is selected, that the "-D" driver name was spelled wrong.

30 January 2006:
L.V.Gandhi: Noted that after (below) correction, verified "working" on Kubuntu (Breezy) 5.10.

30 January 2006:
L.V.Gandhi: Noted that /etc/default/wpasupplicant, line "OPTIONS=" needs to specify "-c" configuration file.  This is essential for Kubuntu.

27 December 2005:
(User that did not respond to request for attribution information): Noted that this information successful for Debian Etch under AMD64 Architecture.  Kernel, 2.6.12-2, no information on specific card/driver.

More Information

For details on WPA and WPA2 logins using the wpasupplicant package, see the official wpa_supplicant homepage.  Caution: The wpa_supplicant, official example configuration file is for the latest development release, and may include options that are not available in your distribution's packaged release.

Valid CSS!