Linux and WiFi
Updated: 2006-06-20
Created: 2004-11-07
This document is an incomplete draft.
In general, the newer a technology in computing the lower the
cost and quality of the experience, as the main driving factor
in recent years (writing at the end of 2004) has been cost
reduction, at any cost :-)
.
Also, the base of Linux developers expands with people who are
enthusiastic but not correspondingly skilled or wise, and therefore
prone to creating awkward solutions. This has already been apparent
as to X11, fonts, printing, ALSA, the USB subsystem, and many
distributions, and Linux WiFi is particularly messy because the WiFi
side of things is also particularly messy.
Therefore these notes will contain two types of information,
which summarize a lot of the (extremely messy as a rule) documents
on WiFi that I have read: brief information on what's what in the
hardware side of WiFi, and what's what on the Linux side of
WiFi.
These notes are also oriented towards small, usually home, sites
and users.
Some similar and very good notes, and much more detailed than
these (for now) as to what is and is not easily supported, are
available in
this page by Nicolai Langfeldt.
WiFi in general
WiFi is subset of the general area of wireless
networking, which includes for example Bluetooth, iRDA, and
carrier pigeons. Currently it is by far the largest subset,
because to a large extent WiFi is just Ethernet, actually on the
ether, that is by radio, and the combination of a fairly
familiar mode of operation with the removal of wires is fairly
compelling.
Note: the original research that gave rise to
Ethernet was actually the Aloha radio network at the University
of Hawaii, so the wired version was called Ethernet
even if it was actually wired.
WiFi is based on low power transmitters in unlicensed
regions of the radio spectrum, usually in the 2-3GHz range. Low
power is a necessary consequence of the spectrum being unlicensed
(and it is unlicensed because it is reserved for equipment that
might emit radio noise, like microwave ovens). This is similar
to other local area radio technologies, like DACT for wireless
phones, and walkie-talkies.
Given that even at low power the range (dozens to hundreds of
meters) is such that multiple networks may be in range of each
other, that region of the radio spectrum is subdivided into
channels, and each network is supposed to use just one channels,
but there is a twist, where some turbo
modes use two channels.
Jean Tourrilhes has written some
more detailed overview notes.
Types of WiFi networks
WiFi networks are of several types, depending on:
- They are managed or unmanaged
- A network in managed (also called infrastructure)
mode has an access point that all other nodes
communicate with, a bit like a hub or switch for Ethernet. In
unmanaged (also called ad-hoc) mode WiFi nodes
communicate directly with each other.
- They have one cell or multiple cells
- WiFi defines a cells as being the set of nodes that
communicate over a single channel directly via the same access
point. A logical network (also called a
ESSID or SSID by the attribute that
names it) may contain a single cell or multiple cells.
- Which standard they use
- In practice there are only three relevant standards:
- 802.11b has a raw top bandwidth of 11
megabits/s, runs on a carrier around 2.6GHz,
it is also called just 11b, and is almost
always supported. There is also a double speed variant
called turbo mode or 802.11+.
- 802.11g has a raw bandwidth of 54 megabits/s,
also runs on a carrier around 2.6GHz, it is also called
54g (it is unfortunate that the name of the
standard contains the number 11, which is also the speed
of 802.11b), and is very commonly supported. Almost all
equipment that supports 54g also supports 11b. There
exists at least one double speed turbo or
nitro variant, usually supported by TI
chipsets.
- 802.11a has a raw bandwidth of 54 megabits/s,
runs on a carrier around 5GHz, and therefore has a rather
shorter range than 11b or 54g, but there is much lower
likelyhood of noise around that frequency.
There have been earlier standard, but in practice only the
802.11 family of standards matters.
- Which encryption they use
- Encryption can be:
- disabled, in which case all nodes communicate
in the clear over the radio channels. This at the very
least allows anybody within reception range to analyze the
IP traffic, even if the payload is encrypted. Using IPsec
is the only way to avoid it, but IPsec requires a
dedicated gateway and is another huge hassle.
- open, in which case nodes may communicate
with or without encryption.
- WEP shared static key, with various lengths
of keys (usually 64, 128, 256 bits minus 14) in which
traffic is encrypted with a key that must be known to all
nodes. The encryption is not that strong, the 64 bit key
length is very very weak (it is actually 40 bits too), and
encryption often slows down traffic considerably.
- WPA is stronger than WEP, as it changes the
transmission key periodically, but it is a more recent
standard which is less often supported. It has two modes
of operation, with and without Radius.
Types of WiFi client devices
WiFi devices can be either usually access points or network
interface cards for desktops or laptops, and their main aspects
are:
- The chipset they use
- This is the single most important attribute of a WiFi card,
because Linux drivers are per-chipset, not per-card. Also, the
quality of various chipsets is widely different.
- The Linux driver that supports them
- Usually some chipset has a single driver, but some chipsets
are supported by multiple drivers, and most chipsets have no
native Linux driver. Even where a driver exists it may be only
half-finished.
- Whether firmware has to be downloaded to the card
- Most chipsets are in effect radio softmodems, and like most
softmodems their firmware is often not stored in a flash/ROM
chip on the card, but to save hardware cost it has to be
downloaded on activation.
Cards that don't need firmware to be downloaded are vastly
preferable, for the same reasons as dialup modems, but they are
rather rare nowadays.
- Transmission and encryption standards supported
- Which of the 802.11 standards they implement, and which of the
encryption standard they support.
- Type of connection to the PC
- Wireless cards can usually be attached to a PC in one of
these ways:
- PCMCIA is a 16 bit bus that vaguely resembles
PCI, and physically PCMCIA cards resemble thick credit
cards or small pocket calculators. It is very common on
laptops, and there are a few and rare PCMCIA adapters for
desktop PCs; since wireless is popular with laptop owners,
most WiFi devices come in PCMCIA format. PCMCIA devices
are hot pluggable, unlike PCI ones.
- Cardbus is the 32 bit version of PCMCIA, and
is otherewise identical. Most current laptops have slots
that support both Cardbus and PCMCIA. The 32 bits means it
is faster, but this is largely irrelevant for WiFi cards.
However some WiFi devices are Cardbus only, and some
(old) laptops don't have Cardbus slots, or not all
PCMCIA slots also support Cardbus, so beware.
- mini-PCI is like PCI (and it is not hot
pluggable either), but in a smaller physical form factor,
for cards to be put inside laptops.
- PCI cards are usually mini-PCI cards riding
in an adapter for the full PCI form factor.
- USB or USB2. WiFi devices have
limited bandwidth in practice, so usually USB2 is not
necessary, but sometimes useful, in ideal conditions.
They are hot pluggable. Their huge advantage is that they
are convenient to attach, and the same card can be used
both with laptops and desktops. However sometimes one
needs a powered portable hub to use a USB device with a
laptop, because some laptops supply too little power to
their USB ports.
Some practical hints
As a matter of practical advice, here are some hints:
- As a rule, 802.11a does not matter, and the only standards
that matter are 11b and 54g, which is a pity as these are
subject to microwave oven interference.
- Unless in a medium-to-large corporate environment, a WiFi
network will consist of a single cell.
- The access point will usually be a gateway to a wired
network, and/or to a long distance broadband link, usually
ADSL/cable. Devices with Ethernet, WiFi, and broadband usually
don't cost much more than more specialized ones and are
fairly convenient.
- It is rather involved to achieve security on a WiFi network
(or in any other context, security is a much more difficult and
harder subject than most people realize), and it is usually
pointless. Modest but sufficient degrees of safety are usually
obtained by:
- Not publishing the ESSID of your local network, but this
is almost pointless.
- Using MAC based access control on the access point. This
prevents leeching but listening is only made a little
harder.
- Using 128 bit (actually 114 bit) or higher WEP static
shared encryption to prevent casual listening and some
traffic analysis.
- Lowering the power of your transmitters to reduce the
range in which your radio traffic can be listened to; this
also usually lengthens the battery life of laptops, and
the useful life of cards.
- Using SSH/SSL/IPsec/... for sessions that need some
degree of security (either end-to-end or using the
advanced modes of WPA).
WiFi Under Linux
WiFi devices under Linux need a driver and some configuration,
like all network devices.
The main issues are:
- While the chipsets for wired network cards are usually
fairly well documented and there are Linux drivers for
practically all, this is not the case for wireless network
devices. As a rule, many 11b-only cards are supported, but
very few 54g are.
- The wireless cards need link level configuration
before being configured for IP. To some extent the
wired cards can also be configured for the specific type of link
level parameters, via the MII configuration tools, but usually
this is not necessary. Also, link level WiFi configuration can
be fairly complicated because there are several variants of
WiFi network setups.
- There are at least two different types of WiFi drivers, the
wireless-tools type and the
wlan-ng type. They differ in the
API they offer for link level configuration (and internal
organization). The first type is mostly popular for 11b cards,
the second for (some) 54g cards.
- As a result of there being at least two types of drivers,
there are at least two widely different sets of WiFi
link level configuration utilities, the
iw
tools
and the wlan
tools. They are mostly equivalent,
but each works only with a driver of its type.
- Once configured, a WiFi network card will behave from the
Linux point of view largely like a wired network card, with
two important differences:
- All the traffic will be radio broadcast over the
neighbourhood.
- Performance may strongly depend on distance from the AP,
thickness and type of the walls within, and other
impediments to radio transmission.
Therefore usually traffic will be encrypted, at one level or
another, and some moving around of the AP and the devices may
help to obtain best signal quality, a bit like with mobile
phones.
Another less important difference is that the name of the
network interface will usually not be like
eth
N but the slightly different
wlan
N or similar variants.
Various features of a WiFi Linux driver and chipset
First of all some important details on how WiFi devices work
and their interactions with the Linux drivers:
- A typical WiFi device has three parts: a host bus (USB,
PCI, Cardbus) interface, a signal/protocol processor and a
radio.
- Usually the host bus interfaces and the radio are hardware
based, while usually the signal/protocol processor is
software based (running usually on a MIPS or ARM based
embedded microprocessor, like a mobile phone), and this
software is called the device's firmware. In
other words, almost all WiFi cards are software modems.
- Most cards don't have a ROM or a EEPROM or a Flash ROM
to store the firmware; it has to be downloaded every time
the card is powered up. The Linux kernel contains a firmware
downloader that tries to get the firmware file loaded from
one of a set of hardcoded directories, usually
/lib/firmware
,
/usr/lib/hotplug/firmware
and
/usr/local/lib/firmware
.
- Usually it is the
Linux hotplug scripts
that trigger the loading of the driver and this requests the
loading of the firmware.
- Different products based on the same chipset can use
different radio chips. As a rule there is a different
firmware version for each chipset and radio chip
combination.
The available WiFi chipset drivers differ widely in their
ability to support various types of devices and features.
As to the device and its chipset:
- Support for 11b only or both 11b and 54g.
- Support for
monitor
mode.
- Support for
unmanaged
mode
(without an AP).
- Support for being an access point.
- Socket for plugging in an external antenna.
- Ability to set different levels of power.
- Firmware stored permanently, or downloaded every time.
As to the driver:
- Whether the driver is included as part of the mainline
(Linus, vanilla) kernel.
- Whether the driver is included as part of the kernel
for your distribution.
- Whether the driver allows setting different levels of
transmitter power.
- Whether the driver, if the card supports it, also supports
monitor
mode.
- Whether the driver, if the card supports it, also supports
unmanaged
(without AP) mode.
- Whether the driver, if the card supports it, also supports
running it as an access point.
- Whether the driver supports WEP at all, and which
key lengths.
- Whether the driver supports WAP at all, and which
type of WAP.
- Whether the driver requires the
wireless-tools
or the wlan-ng
configuration utilities.
Well known drivers and their chipsets
The drivers currently (051003) known to work well with
Linux are:
- The orinoco driver
- This is for a very popular 11b only chipset, the
PrismII or
Hermes chipset; the name of the
driver of the driver comes from the original line of Proxim
devices with the Orinoco brand, which is now used also for
devices using other chipsets. Devices with this chipset are
11b only and are becoming hard to find.
- The
prism54 driver
- This driver supports the
Prism (GT|Duette|Indigo|Frisbee)
chipset for 54g/11b operation. Unfortunately supported
devices are becoming difficult to find, and the driver does
not support the new Prism SoftMAC or Xbow/Javelin
chipsets. The project maintainers
write:
If you can't test a card and want linux support,
I can recommend you just not buy a prism 802.11g based
chipset for now. So now what? Well we have the centrinos
and ralink.
- The
madwifi driver
- This driver supports many
Atheros chipsets for
54g/11b and usually 11a operation.
Since this is one of the very few chipsets that supports
11a, there are good chances that if a card supports all
three standards it is based on this class of chipsets.
This driver contains some parts of the firmware, which
is as usual proprietary. Thus because of this it is not
fully open source. But the other drivers require closed
source firmware too, which has to be obtained separately.
- The
atmel driver
- This driver supports the
Atmel AT76C5xxx
chipsets for 11b USB and Cardbus devices.
- The
at76c503a driver
- Another driver that supports the
Atmel AT76C503A
chipset (and its Intersil radio variant) for 11b USB
and Cardbus devices.
- The
rt2x00 driver,
for the
rt2400
and rt2500
- These are all related drivers, being merged in one
rt2x00
project, an they support the RT2400
(11b) and RT2500 (54g) USB chipsets by
Ralink Technology
and they have been released thanks to
Minitar
whose
products
are therefore particularly well supported, as well as those
of
donated for testing.
- The Intel sponsored Centrino
ipw2100 driver
- This driver supports the Intel Centrino 2100 chipset,
which only supports 11b.
- The Intel sponsored Centrino
ipw2200 driver
- This driver is meant to support the Intel Centrino 2200BG
and 2915ABG chipsets, which as suggested by their names,
support 11b and 54g, and the latter also supports 54a.
- The
zd1201 driver
- This driver supports only the ZyDAS 1201 low cost chipset
for 11b USB network interfaces. Thanks to manufacturer
support versions 0.14 and later work pretty well and
painlessly. This driver has been incorporated into the
mainline kernel starting with kernel version 2.6.12.
Devices with this chipset are currently (050315) easy to
find and very cheap.
There is a new driver for the ZyDAS 1211 chipset, which
does 54g, but it does not quite work yet (050822).
- The
Broadcom 43xx driver
- Starting with Linux 2.6.17 there is a new driver
that supports for the first time a recent Broadcom
series of WiFi chips.
There are other Linux drivers, but they are far less reliable
than those listed above.
Also note that not all the drivers above support all the
possible features, for example unmanaged
mode
or access point mode, WAP encryption or even WEP encryption.
Virtually all however do support managed mode operation and
static WEP encryption up to to 128 bits (actually 114).
So, what are my impressions? Well, for 54g the Atheros and
Ralink RT2500 chipsets look like the best bet, by far, and the
Ralink RT2500 seems particularly nice and rich of features.
For 11b the ZyDAS chipset is available in several really
cheap USB devices, the Ralink RT2400 is also available from
many sources, and the driver is particularly nice. There are
still a few Hermes based cards, and Atmel does not see too
bad.
The Centrinos are well supported, but I think they are only
available built into laptops, so if you have a Centrino
laptop there is not much choice but the situation is lucky.
Online lists of well supported device models
There are some online lists of devices known to work with the
drivers easily available for Linux; it is important to double
check the exact model number, as manufacturers often change
the chipset while making very small changes to the model
number. Sometimes the chipset gets changed but the model
number does not change at all...