Navigation:

Search



Related Articles

Our Friends

Articles Basic Linux Wireless How-to
 

Basic Linux Wireless How-to

This was written by Chris Verges and given on Wed Apr 09 2003.

Table of Contents


1. Overview

The Linux kernel has supported wireless extensions since 1996. In 2002, it was updated with a new API for more user space support. The full header code may be found in /usr/src/linux/include/linux/wireless.h.

Wireless technologies fall under the IEEE 802.11 committee. This family of protocols runs over 802.3, or Ethernet; hence, it uses CSMA/CD and all other features of Ethernet. Sometimes, it is referred to as "WiFi", though this term more specifically means 802.11b.

Since the 802.11 standard was introduced, four specifications have evolved: 802.11, 802.11a, 802.11b, and 802.11g. The de facto standard nowadays is 802.11b. A brief synopsis of each can be found in the following table.

Name Frequency Max Speed Modulation
802.11a 5-6 GHz 54 Mbps OFDM
802.11b 2.4 GHz 11 Mbps CCK
802.11g 2.4 GHz 54 Mbps OFDM

OFDM - Orthogonal Frequency Division Multiplexing
CCK - Complementary Code Keying

Obviously support for wireless needs to be found in the kernel, so let's explore that now.

2. Kernel Support for WiFi

Since 99% of all wireless applications deals with laptops, I won't even cover a desktop system. The methodology behind it is similar, however. For more information, look at the Wireless How-to at The Linux Documentation Project.

The usermode PCMCIA card services are much better than the kernel's built-in support. However, you need to compile your kernel in such a way that the PCMCIA-CS can be loaded. When you 'make menuconfig' go to the following menus:

General setup
   PCMCIA/CardBus support

Under the last submenu, there should be an option for PCMCIA/CardBuss support. Set that to "N", or exclude it from the kernel. Now, traverse another set of menus, starting back from the original screen:

Network device support
   Wireless LAN (non-hamradio)

The only option that should be selected here is the top, "Wireless LAN (non-hamradio)". It should be built-in to the kernel proper. All other drivers should be excluded. Now, just make the kernel and you can continue into user space.

3. Usermode Support for WiFi

You will first need to install the PCMCIA CardBus services since we did not build them into the kernel. The source can be found at SourceForge:

http://pcmcia-cs.sourceforge.net/

The latest drivers as of this writing are pcmcia-cs-3.2.3. I personally run version 3.2.1 for hardware reasons.

NOTE: If you are running the Orinoco wireless card and wish to do any sort of wireless monitoring (using Kismet or Ethereal or tcpdump), you will need to use the wavelan drivers. Under Gentoo, add "wavelan" to your USE variable prior to compiling pcmcia-cs.

Once you get pcmcia-cs compiled and installed, the next step is to configure it. Under /etc/conf.d/, you will find a pcmcia file. There should be a line in this file that reads "PCIC". If there isn't, add one. SmileIf this is set to your CardBus chipset, then all is good to go. If it isn't, add the appropriate value. For the Dell laptops, this line should read:

PCIC="i82365"

There are other options, but they are outside the scope of this document.

Upon a reboot (and adding the pcmcia init script to your BOOT runlevel), the pcmcia card services should be up and running. If your wireless driver is supported by pcmcia-cs natively, the driver should be loaded at boot time. If not, you will need to follow the manufacturer's instructions for installing your card's drivers. (Good luck, is all I have to say.) I would like to point out that most cards as supported by the prism2 driver included with pcmcia-cs.

If you cannot find your drivers in the pcmcia-cs package, try the linux-wlan project ( http://www.linux-wlan.org/ ). They use the pcmcia-cs package for cardbus services, but install their own drivers.

After you get pcmcia-cs installed and your driver loaded, you can work on configuring your wireless options. The main file you will edit is /etc/pcmcia/wireless.opts. While this file can have many options, the basic few you need to access a wireless network follow this pattern:

case "$ADDRESS" in

scheme,socket,instance,hwaddr)
 INFO="Description of wlan_name"
 ESSID="essid_of_wlan_name"
 MODE="Managed"                    /* Managed, Ad-Hoc */
 RATE="auto"
 KEY="wep key goes here"           /* Omit if no wep */
 ;;

esac

The VERY basic identification block is:

*,*,*,*)
 INFO="Any ESSID"
 ESSID="any"
 ;;

The one you will need for the GT LAWN is:

gtwireless,*,*,*)
 INFO="GT LAWN"
 ESSID="GTwireless"
 MODE="Managed"
 RATE="auto"
 KEY="wep here"                    /* wep omitted for docs on web */
 ;;

So now we've configured all the wireless options. You can change schemes by using the cardctl command:

# cardctl scheme default
# cardctl scheme gtwireless

Now for each entry in wireless.opts, create an entry in networks.opts, same directory. These settings will be used in bringing a wireless interface up. You can use DHCP, BOOTP, or statically assigned IPs. Two basic entries might be:

case "$ADDRESS" in
gtwireless,*,*,*)
 INFO="GT LAWN Network Setup"
 DHCP="y"
 ;;
    dorm,*,*,*)
 INFO="Dormroom WAP settings -- NO DHCP FOR SECURITY REASONS"
 DHCP="n"
 BOOTP="n"
 IPADDR="192.168.1.1"
 NETMASK="255.255.255.0"
 NETWORK="192.168.1.0"
 BROADCAST="192.168.1.255"
 GATEWAY="192.168.1.1"
 DOMAIN="headnut.org"
 DNS_1="192.168.1.1"
 DNS_2="128.61.15.251"
 DNS_3="128.61.15.244"
 MOUNTS=""                /* For any NFS mounts located in /etc/fstab */
 MTU=""                   /* Override the default MTU here */
 start_fn() { return; }
 stop_fn()  { return; }
 NO_CHECK=n               /* Card ejection policy */
 NO_FUSER=n               /* Card ejection policy */
 ;;
*,*,*,*)
 DHCP="y"
 ;;
esac

Needless to say, any of these options can be omitted or simply set to "". There are many more, so feel free to look at Jean Tourrilhes' pcmcia-cs website: http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/ . The PCMCIA.txt file under that directory is particularly concise (HINT HINT!).

Since we just created all the scheme information needed to start this puppy, let's change our default scheme. Remember the /etc/conf.d/pcmcia file? There is another option you need to add to the file:

SCHEME="default_scheme_name_here"

Assuming your initialization scripts work correctly, upon the next reboot, all will be happy in your wireless world.

4. Wireless Extensions

Wireless extensions under Linux have been made possible by Jean Tourrilhes. Now in its 25th version, it merely consists of a proc file. Smile

/proc/net/wireless contains all the networking stats you can pull from the kernel and/or drivers. There are tools like iwconfig/iwspy/iwlist that allow a user to poll data easily from this proc file, but that's all, folks.

Jean's tutorial can be found at his website on the wireless extensions page: Linux.Wireless.Extensions.html (get his page link from above)

The iwconfig utility acts much like ifconfig for wireless cards. In fact, he took much of the same code from ifconfig. It is somewhat self-explanatory.

iwspy sounds like so much more than it really is. It can be used to pull statistics for packets signed with specific MAC addresses. The basic syntax is:

iwspy> interface <[[+/-] [ip_addr] [hw hw_addr]]

A third utility, iwpriv, is used by some drivers (like the patched Orinoco) to extend the functionality of the system. By using ioctl(), it allows for a very extensible solution to the rather rigid driver structure provided by Linux.

5. IEEE 802.11 Family

As noted above in the Overview, there are quite a few specifications in the 802.11 family. The most common (and the one we run at GT) is 802.11b. This will be the one we touch most upon. First, however, let us discuss the others.

802.11a operates in the 5 GHz frequency range, its modulation driven by the OFDM protocol. This combination allows for speeds of up to 54 Mbps, but with a VERY limited range. Users should opt for 802.11a if they need the speed enhancement, if they are in an area filled with 2.4 GHz traffic, or if the user base for wireless applications is very dense. Since 802.11a and 802.11b operate on (a) different frequencies and (b) different modulations, they are completely uncompatible for the possibility of future upgrades, etc.

802.11g operates in the 2.4 GHz range, using the same modulation as 802.11a. This protocol has not been fully standardized at the time of this writing, however, so many things can change between now and then. SmileIt's main advantage is that it can be compatible with 802.11b in terms of frequency, so holds a higher potential as an upgrade solution later down the line. The very first 802.11g enabled devices are just beginning to come out on the market, following an alpha release standards document.

Now for the crux of this section ...

802.11b, also known as WiFi, is by far the most popular of all 802.11 specs. It's popularity came with the DSL and Cable Modem boom a few years ago, with every Tom, Dick, and Harry buying one of those Linksys routers and some really cheap-assed WPC11 cards for their computers. (More on how this is advantageous to YOU later.) According to some reports on the Internet, with directional antennas the range can be over 4 miles! However, more realistically the range for a 1 Mbps signal is limited to under 800 feet unobstructed, less than that for walls and wiring that may get in the way of a signal. For an 11 Mbps signal, the wireless card must be within 150 feet of the access point.

For information about extending WiFi's range, visit: http://www.pbs.org/cringely/pulpit/pulpit20010628.html

There are two modes WiFi can run in: Ad-Hoc and Infrastructure. Ad-Hoc means two or more clients connect to one another independent of an access point or central means of regulating the traffic flow. Infrastructure mode depends on an access point to handle all base communication between clients on the node.

Under 802.11, there are 11 separate "channels" numbered 1 through 11. Each channel represents a separate wireless LAN. These spherical globes can be interleaved so long as no two globes with the same channel "touch". Typically, any given environment only needs 3 channels (1, 6, and 11) to cover an enormous area.

6. Security under 802.11b

Security on a wireless network is ... touchy at best. It can be accomplished using IPSec or some other point to point protocol best, but there do exist built in methods of encrypting the data. The Wireless Encryption Protocol, or WEP, encrypts all packets on a node using a 64-bit or 128-bit algorithm. The WEP is seeded by either a passphrase or a key. (Georgia Tech uses a 64-bit key-based system.)

Needless to say, it sucks. Anyone, given enough time (usually less than 24 hours), can crack a WEP and read all your nice data being broadcast everywhere. For some insane reason, the CIA/NSA have approved usage of specific 802.11b applications. We'll see ...

7. Wireless Fun ...

Twice now I have noted the lack of security inherent in the system. The first was the wide spread usage of the Linksys routers for DSL and Cable Modems. A Linksys router uses factory specific defaults:

IP Address = 192.168.0.1
DHCP Range = 192.168.0.100 - 192.168.0.254
Username = ""
Password = "admin"
WEP = disabled

Which means if you can find any of these, renew your IP address, and open Mozilla, you have complete access to the Wireless Access Point (WAP). Just visit http://192.168.0.1 and enjoy!

The second security concern with 802.11 is the WEP. Even a network secured with a WEP can be decrypted with enough time. I suggest you look into network sniffers like Ethereal and Kismet.