Table of Contents

802.11

Wireless networking in Linux is really easy to use. The wireless-tools allow to explore and configure wireless network.


Contents

Wireless card mode

iwconfig netcard essid myessid mode Managed

where netcard is the network identifier (eth1, wlan0, …) and essid the wireless network SSID.

iwconfig netcard mode Ad-hoc essid myessid
iwconfig netcard mode Master essid myessid

Wireless security

WEP

WEP stands for (Wired Equivalent Privacy). It is currently deprecated by WPA (Wi-Fi Protected Access). To set WEP key, use the following command:

iwconfig netcard key mykey


If you want to change your WEP key (access point support 4 keys), you can use this script (found on linuxfr.org)

RANDOM=$$$(date +%s)
keynumber=$[ ( $RANDOM % 4 ) + 1 ]
iwconfig eth1 key [1] key1
iwconfig eth1 key [2] key2
iwconfig eth1 key [3] key3
iwconfig eth1 key [4] key4
iwconfig eth1 key [$keynumber]
iwconfig eth1 key on

You can generate a WEP key from a passphrase but iwconfig doesn't support this option. The key is generated using md5. The following script in perl creates a key from a passphrase :

#!/usr/bin/perl
# Perl script to convert a passphrase to a WEP key.
# By Aki Mimoto

use strict;
@ARGV or die "Usage: $0 passphrase\n";
print generate_key( @ARGV ), "\n";

sub generate_key {
# --------------------------------------------------
        require Digest::MD5;
        return substr Digest::MD5::md5_hex( substr( shift() x 64, 0, 64 ) ), 0, 26;
}

It will work with a lot of access points except Apple because they don't use the same implementation.


WPA

WPA works in Linux. You need an agent program (supplicant), which maintains security associations online. There are two programs for that:

Useful commands

Find access point

You can scan wireless network with the command:

iwlist netcard scanning.

Find if you are connected or not

You can know if you are connect or not using

iwconfig

or just with the command:

iwgetid netcard -p

If you see unassociated you are not connected to the wireless network.

Kernel support

Before 2.6.14, ieee80211 was not in the kernel source; now it is. IEEE 802.11 is a wireless communication standard. You can find a description in the 802.11 header in /usr/include/net.

Hardware compatibility

Before buying a wireless card take care about its Linux compatibility, not all cards are supported.

To find a suitable card, you have to google, but take care about exact version/revision of the card, 2 versions of a card don't have the same chips.

The chips that are supported on linux are: ipw2200, ipw2100, atheros, prism, …

ipw2200

The ipw2200 chipset (Centrino laptop) is supported by linux. After the 2.6.14 kernel, the ipw2200 is included in the main kernel tree. This driver doesn't allow packet injections (packets are dropped by Firmware), this is why you can't use the card using this chipset in Master Mode (to act like an access point).

Contrary to what is written on the Lan Ressource, the ipw2200 supports Monitor mode.

The wireless LAN ressource for Linux