<?xml version="1.0"?>
<!DOCTYPE webpage
 PUBLIC "-//NetBSD//DTD Website-based NetBSD Extension//EN"
        "http://www.NetBSD.org/XML/htdocs/lang/share/xml/website-netbsd.dtd">

<webpage id="docs-network-wavelan">
<config param="desc" value=""/>
<config param="cvstag" value="$NetBSD: wavelan.xml,v 1.1 2007/06/09 11:33:55 dsieger Exp $"/>
<config param="rcsdate" value="$Date: 2007/06/09 11:33:55 $"/>
<head>




<!-- Copyright (c) 1994-2004
	The NetBSD Foundation, Inc.  ALL RIGHTS RESERVED. -->


<title>Using WaveLAN IEEE under NetBSD</title>
</head>




<sect1 role="toc">

<sect2 id="wireless_networking_under_NetBSD">
<title>Wireless networking under NetBSD</title>

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

<sect3 id="configuring-the-kernel">
<title>Configuring the kernel</title>


<para>
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:
</para>

<screen>
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)
</screen>

<para>
  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.
</para>

</sect3>
<sect3 id="using-the-network">
<title>Using the network</title>


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

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

<para>
  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 &man.ifconfig.8;
  "ssid" keyword (or "nwid", if you are on NetBSD 1.6.x) to do so:
</para>

<screen>
# ifconfig wi0 ssid foobar
</screen>

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

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

<para>
  If there is no change, you may need to adjust the channel your card is
  communicating on, using "<code>ifconfig ath0 chan XX</code>" 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.
</para>

<para>
  To determine if your network connection between your wireless card and
  a base station is enabled, check &man.ifconfig.8; output, status should be
  "active" there.
</para>

<para>
  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
  <code>&man.ifconfig.8;</code>, <code>&man.dhclient.8;</code> or whatever you normally
  use.  The interface should behave more or less like an ethernet
  interface.
</para>

</sect3>
<sect3 id="acting-as-access-point">
<title>Acting as an access point</title>


<para>
  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 "<code>mediaopt hostap</code>" to &man.ifconfig.8;:
</para>

<screen>
# ifconfig wi0 ssid mynet nwkey foobar mediaopt hostap up
</screen>

<para>
  The above example also shows how to set WEP keys, see &man.ifconfig.8; for
  more documentation.  <emphasis>Important</emphasis>: 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.
</para>

<para>
  See also Hoang Q. Tran's web page on
  <ulink url="http://www.muine.org/~hoang/netap.html">
  how to build a wireless 802.11b Access Point using NetBSD</ulink>.
</para>

</sect3>
<sect3 id="airportbase">
<title>Setting up an Apple Airport Base Station</title>


<para>
  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 <filename role="pkg">net/airportbasestationconfig</filename> 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 <ulink
  url="http://www.info.apple.com/kbnum/n106864">www.info.apple.com</ulink> for
  details on how to use Apple's AirPort Admin Utility.
</para>

</sect3>
<sect3 id="other-tricks">
<title>Other WaveLAN tricks</title>


<para>
  &man.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 &man.ifconfig.8;.
</para>

<para>
  WEP encryption can be enabled using "<code>ifconfig nwkey</code>" with a
  number of options, see &man.ifconfig.8; for more information.
</para>

<para>
  Power-saving can be enabled with "<code>ifconfig ath0 powersave</code>",
  use "<code>ifconfig ath0 -powersave</code>" 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 <code>&man.apmd.8;</code>, you can
  control it automatically, with scripts in <code>/etc/apm/</code>.  (See
  <code>&man.apmd.8;</code> for details)
</para>

<para>
  Here's some quick-and-dirty scripts
  to get you going:
</para>

<para>
  Put the following in <code>/etc/apm/line</code>:
</para>

<screen> #!/bin/sh

# 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
        ath*|wi*) 
                /sbin/ifconfig $i -powersave
                ;;
        esac
done

</screen>

<para>
  And this in <code>/etc/apm/battery</code>:
</para>

<screen>
#!/bin/sh

# 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
        wi*|ath*) 
                /sbin/wiconfig $i powersave
                ;;
        esac
done

</screen>

<para>
  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!
</para>

<para>
  A number of useful tools for IEEE 802.11 enabled wireless LANs can be
  found in pkgsrc, e.g.
  <filename role="pkg">net/gtk_wicontrol</filename>, 
  <filename role="pkg">net/wistumbler</filename>, 
  <filename role="pkg">net/gkrellm-wireless</filename>, 
  <filename role="pkg">net/xfce4-wavelan-plugin</filename>,
  <filename role="pkg">net/wistumbler2</filename>.
</para>


</sect3>
<sect3 id="troubleshooting">
<title>Troubleshooting</title>


<sect4 id="Lockups_i386">
<title>Lockups (i386)</title>

<para>
  On certain machines the <code>wi</code> 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.
</para>

<para>
  In one case the machine was booted under Windows and the I/O range used
  by <emphasis>every single device</emphasis> 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
  <code>wi0</code>.
</para>

<para>
  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
  <code>PCIC_ISA_ALLOC_IOSIZE</code> and <code>PCIC_ISA_ALLOC_IOBASE</code>
  respectively.  In the kernel config file, it looks like this:
</para>

<screen>
options		PCIC_ISA_ALLOC_IOBASE=0x600
options         PCIC_ISA_ALLOC_IOSIZE=0xff
</screen>

<para>
  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 <emphasis>every single range</emphasis> used by
  <emphasis>every single device</emphasis> under Windows, and pick a range that
  appears empty.
</para>

</sect4>
<sect4 id="ISA_adapter_i386">
<title>ISA Adapter (i386)</title>

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

<screen>
pcic1   at isa? port 0x3e2 iomem 0xcc000 iosiz 0x4000

options PCIC_ISA_ALLOC_IOBASE=0x300
options PCIC_ISA_ALLOC_IOSIZE=0x0ff
</screen>

<para>
  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.  <emphasis>
  These values may not work for you!</emphasis>
</para>


</sect4>
</sect3>
<sect3 id="acknowledgements">
<title>Acknowledgements</title>


<para>
  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.
</para>

</sect3>
</sect2>
</sect1>

<parentsec url="./" text="NetBSD Documentation: Network"/>
</webpage>

