Using WaveLAN IEEE under NetBSD

Wireless networking under NetBSD

Wireless networking under NetBSD

This document describes how to configure and troubleshoot IEEE 802.11 networking under NetBSD. Comments, additions, and corrections welcome.

Configuring the kernel

NetBSD supports a number of PCMCIA/Cardbus and PCI based IEEE 802.11 compatible network cards, among them the Lucent WaveLAN, ELSA AirLancer and recent Atheros based cards. To use them, add one of the following to your kernel config:

an*     at pci? dev ? function ?        # Aironet PC4500/PC4800 (802.11)
ath*    at pci? dev ? function ?        # Atheros 5210/5211/5212 802.11
atw*    at pci? dev ? function ?        # ADMtek ADM8211 (802.11)
wi*     at pci? dev ? function ?        # Intersil Prism Mini-PCI (802.11b)
an*     at isapnp?                      # Aironet 802.11
an*     at pcmcia? function ?           # Aironet PC4500/PC4800 (802.11)
awi*    at pcmcia? function ?           # BayStack 650/660 (802.11FH/DS)
ray*    at pcmcia? function ?           # Raytheon Raylink (802.11)
wi*     at pcmcia? function ?           # Lucent/Intersil WaveLan IEEE (802.11)
ath*   at cardbus? dev ? function ?    # Atheros 5210/5211/5212 802.11
atw*   at cardbus? dev ? function ?    # ADMtek ADM8211 (802.11)

See your platform's sys/arch/*/conf/GENERIC kernel config file for an upto-date list. If you have the "ISA" version of one of these cards, note that it's really just a PCMCIA controller on an ISA card, so you'll need to configure a PCMCIA controller in your kernel as well.

Using the network

Once you've booted a kernel with a 802.11 card driver like wi or ath and it has found your card, try configuring the network by hand. Assuming you haven't changed anything yet, use ifconfig(8) and wiconfig(8) to show the card's current configuration.

Most of the network card's parameters can be changed using ifconfig(8) and wiconfig(8) (deprecated), in NetBSD 3.0 (and -current as of August 2004) there will also be a wlanctl(8) command. Remember that you can get a list of available media and media options with "ifconfig -m wi0".

Assuming that the defaults are correct for your network, you should see "Current netname" (or SSID) change to reflect the name of the wireless network which has been set in the access point your card is communicating with. If you need to change this, use the ifconfig(8) "ssid" keyword (or "nwid", if you are on NetBSD 1.6.x) to do so:

# ifconfig wi0 ssid foobar

If you don't know your network's SSID, you can try the empty string ("") if your access point is tuned to broadcast it's SSID; this is equivalent to a SSID of "ANY" on Windows systems.

You may also want to set different media and media options according to the output of "ifconfig -m", e.g. "mediaopt turbo" can be used to enable 108MBps mode on Atheros cards, if the access point supports that mode.

If there is no change, you may need to adjust the channel your card is communicating on, using "ifconfig ath0 chan XX" for channel XX. The number of available channels depends on your country, 802.11 mode (11b, 11g, 11a, ...) and access point settings. For 802.11b, there are 14 channels possible; We are told that channels 1-11 are legal for North America, channels 1-13 for most of Europe, channels 10-13 for France, and only channel 14 for Japan. If in doubt, please refer to the documentation that came with your card or access point. Make sure that the channel you select is the same channel your access point (or the other card in an ad-hoc network) is on. The default for cards sold in North America and most of Europe is 3; the default for cards sold in France is 11, and the default for cards sold in Japan is 14.

To determine if your network connection between your wireless card and a base station is enabled, check ifconfig(8) output, status should be "active" there.

Once you have good communication with the base station or other ad-hoc device, you should configure the wireless network interface just like you would any other network interface. Use ifconfig(8), dhclient(8) or whatever you normally use. The interface should behave more or less like an ethernet interface.

Acting as an access point

In theory, there is no reason why the card could not be configured as a true access point. This means acting as a gateway between clients (which do not communicate directly). In order to do this, use "mediaopt hostap" to ifconfig(8):

# ifconfig wi0 ssid mynet nwkey foobar mediaopt hostap up

The above example also shows how to set WEP keys, see ifconfig(8) for more documentation. Important: For this to work, the firmware needs to be recent enough for Lucent/Orinocco cards. Although 6.04 seems to be the absolute minimum, 6.06 was found to be unreliable. 7.28 is known to work.

See also Hoang Q. Tran's web page on how to build a wireless 802.11b Access Point using NetBSD.

Setting up an Apple Airport Base Station

Apple provide software for setting up an Apple Airport Base Station. It requires a Macintosh running Mac OS 8.6 or greater. The Airport Base Station Configurator (available as net/airportbasestationconfig in the NetBSD packages collection for i386 and powerpc based platforms) is a Java application that can be used to inspect and change the configuration of Apple's Airport Base Station. Please see for details on how to use Apple's AirPort Admin Utility.

Other WaveLAN tricks

wiconfig(8) is still used for few things in NetBSD 2.0, but it's use is deprecated and many things can be set via ifconfig(8).

WEP encryption can be enabled using "ifconfig nwkey" with a number of options, see ifconfig(8) for more information.

Power-saving can be enabled with "ifconfig ath0 powersave", use "ifconfig ath0 -powersave" to disable it again. You'll see ping times go up, but your power consumption should decrease. (Wireless cards do suck a lot of power; if you plan on using this while unplugged from the mains, its is recommended). You can do this from the command line, or, if you use apmd(8), you can control it automatically, with scripts in /etc/apm/. (See apmd(8) for details)

Here's some quick-and-dirty scripts to get you going:

Put the following in /etc/apm/line:


# look for 'wi' and 'ath' interfaces, and take them out of
# power-saving mode.
INTERFACES=`/sbin/ifconfig -l -u`

for i in $INTERFACES; do
        case $i in
                /sbin/ifconfig $i -powersave

And this in /etc/apm/battery:


# look for 'wi' and 'ath' interfaces, and put them in power-saving
# mode.  (Only do this for interfaces which are up)
INTERFACES=`/sbin/ifconfig -l -u`

for i in $INTERFACES; do
        case $i in
                /sbin/wiconfig $i powersave

Assuming you have APM configured correctly, you should see the card go into power-saving mode when you disconnect the mains, and return to normal usage when it's plugged back in!

A number of useful tools for IEEE 802.11 enabled wireless LANs can be found in pkgsrc, e.g. net/gtk_wicontrol, net/wistumbler, net/gkrellm-wireless, net/xfce4-wavelan-plugin, net/wistumbler2.


Lockups (i386)

On certain machines the wi will appear to work until traffic is actually sent, at which point it will lock the entire machine. Sometimes you may get a ping response, sometimes not, but invariably everything will lock up. While most PCMCIA cards only use 16 bytes or less of I/O space, the WaveLAN card uses a very large amount (64 bytes), and this can conflict with some device on the laptop which wasn't actually configured. This is a common problem with laptops; documentation is somewhat sparse, and NetBSD isn't very good (yet) at all forms of autodetection.

In one case the machine was booted under Windows and the I/O range used by every single device that Windows found examined. (The 'resources' tab of each device in the "Device Manager"). Sure enough, the audio system had a compatibility mode (which NetBSD didn't need) which used part of the range that NetBSD was assigning to wi0.

How to fix this? The easiest option is to force NetBSD to only assign PCMCIA I/O space from a specific range of addresses: find a large range which is unused by the laptop (at least 64 bytes!), and in your kernel configuration file, specify where to start, and how much can be allocated. In one case (this range may not work for you!), it was told to use 256 bytes beginning at address 0x600, using the kernel options PCIC_ISA_ALLOC_IOSIZE and PCIC_ISA_ALLOC_IOBASE respectively. In the kernel config file, it looks like this:

options		PCIC_ISA_ALLOC_IOBASE=0x600
options         PCIC_ISA_ALLOC_IOSIZE=0xff

Remember, these values are probably not right for you!! To find the correct value for your system, you need to either consult documentation (if you can find it), or write down every single range used by every single device under Windows, and pick a range that appears empty.

ISA Adapter (i386)

This is probably obvious to some, but if you don't see the PCMCIA card, the problem probably lies with the configuration of the pcic device. In particular, you may need to tweak the iomem (and possibly iosize) parameters of the pcic(4) device. In one case, the following configuration was used:

pcic1   at isa? port 0x3e2 iomem 0xcc000 iosiz 0x4000


On this particular system, many addresses were tried for iomem without luck. Windows gave the answer as it was using 0xcc000 and the card working. These values may not work for you!


Thanks to Jeff Rizzo for producing this document, Bill Paul for writing the driver for FreeBSD, Bill Sommerfeld for porting it to NetBSD, Chris Hopps both for helping and Bill Sommerfeld and for pointing out the I/O conflicts.

Back to NetBSD Documentation: Network