Date: Wed, 24 May 2000 11:49:58 PDT From: Darryl Okahata <darrylo@sr.hp.com> To: freebsd-mobile@freebsd.org Subject: Howto: FreeBSD & WaveLan [ was: Re: TI1225 + ORINOCO aka WaveLAN IEEE 802.11 11Mb ] Message-ID: <200005241849.LAA23904@mina.sr.hp.com> In-Reply-To: Your message of "Wed, 24 May 2000 18:45:52 PDT." <200005241545.SAA18462@orpheus.so-com.net>
next in thread | previous in thread | raw e-mail | index | archive | help
> Some weeks ego I saw letters with subject like this.
> Question is .. Have this hardware configuration (subj)
> properly supported by FreeBSD-4.0 or FreeBSD-current ?
I can't help with the TI1225, but here's a document that I've been
writing on using the WaveLan cards with FreeBSD. I've been toying with
submitting it to FreeBSD diary or 'zine, but I don't know if I'll ever
get around to finishing it. It's taking up a lot of my time, and I
don't know if there's really a big audience for it.
It's a bit rough and a bit wordy, but it should cover most of the
bases.
--
Darryl Okahata
darrylo@soco.agilent.com
DISCLAIMER: this message is the author's personal opinion and does not
constitute the support, opinion, or policy of Agilent Technologies, or
of the little green men that have been following him all day.
===============================================================================
FreeBSD 4.X and WaveLan IEEE 802.11 Wireless Networking
Wed May 24, 2000
(C) Copyright 2000, by Darryl Okahata (darrylo@sonic.net)
INTRODUCTION
This article describes how to set up a small home wireless LAN,
using the Orinoco (previously Lucent) WaveLan IEEE 802.11 PC cards, a
desktop PC, and a laptop. The idea here is that the desktop is always
on, and can function as a gateway/router for the laptop. I have a
desktop FreeBSD system running at home 24 hours a day, 7 days a week,
and so this is a good solution for me.
The hardware organization is simple: both the desktop and the
laptop use the silver (64-bit encryption) or gold (128-bit encryption)
PCMCIA WaveLan IEEE 802.11 cards to communicate. The laptop should
already have an available PCMCIA slot for a WaveLan card, and the
desktop uses the WaveLan PCMCIA adapter.
Note that there is more than one type of "WaveLan" card. This
article deals with the IEEE 802.11 WaveLan cards, and not older ones.
Some people don't have a system that's always running, and so they
may prefer using an Apple airport in place of the desktop. While this
is another good solution, it's beyond the scope of this article.
However, I'll list a few pros and cons of the desktop vs airport
approach:
Desktop:
Pro: Somewhat inexpensive solution (around US$220-$250
for just the desktop-related hardware, not
counting the laptop interface).
Pro: No (registered) IP address required. (Assuming the
use of NATD with unregistered source addresses such
as 10.0.0.1, and assuming that the desktop is using
a registered IP address instead of an unregistered
one).
Pro: No additional ethernet wiring (great if you have an
ethernet hub with no free ports).
Con: Noisier than an airport (assuming a typically-
noisy power supply fan).
Con: Not very portable.
Con: Uses more power. (Well, perhaps not, if you use an
old laptop in place of the desktop.)
Airport:
Con: More expensive (around US$300, not counting the
laptop interface).
Con: Currently needs a Macintosh to fully configure.
Can be partially configured from Windows (but no
NATD or DHCP available under Windows).
Con: Yet another ethernet device to wire up to some hub
that's short on ports. Needs an IP address.
Pro: Very quiet.
Pro: Very portable.
Pro: Uses less power.
Pro: Can be wall-mounted. Wall-mounting a desktop is
problematic.
If you're interested in using the airport, you can start here:
Upgrading the airport to 128-bit encryption:
http://www.msrl.com/airport-gold/
Check out the links near the bottom.
Another solution, instead of a desktop or an airport, is to use a
WaveLan Access Point. However, this is a fairly expensive solution, and
one that's best used in commercial/business environments.
REQUIREMENTS
Here's what you need:
* A good working knowledge of FreeBSD and system administration. In
particular, you need to know how to configure and rebuild a kernel.
You also need to know how to install and configure a (wired) network
card. For example, if you don't know what a netmask is, why it's
needed, and how routing works, stop now. The following instructions
are not for novices and beginners.
* A desktop and laptop running FreeBSD 4.0. I've used 4.0-Stable as of
April 29 and May 2, and they work well. I'm sure other snapshots
work.
You'll need to have installed and configured FreeBSD 4.0 on these
systems. I'm not going to cover anything related to installation or
configuration, except for WaveLan-related issues.
You'll also need to have installed and configured any (wired) ethernet
LAN card(s) in the desktop. Make sure the wired LAN is functional
before proceeding.
* The desktop and laptop each need at least one free IRQ. One is
required for the WaveLan PCMCIA card, and another should be used for
the PCMCIA adapter. The PCMCIA adapter does not require an IRQ, but
one should be used for best performance. If one is not used, the
adapter will be used in "polled" mode.
Note that the WaveLan PCMCIA card may not work with IRQ9 (not
surprising, as IRQ9 is shared with IRQ2). If IRQ9 is all you have
free, you'll have to come up with another free IRQ. (However, the
default pccard.conf file does not allow IRQ9 to be used by PCMCIA
cards.)
* Two WaveLan IEEE 802.11 PCMCIA cards (gold or silver). The gold cards
support 128-bit encryption, while the silver cards support 64-bit
encryption. You'll use one in the desktop, and one in the laptop.
* One WaveLan PCMCIA adapter interface for the desktop. I'm sure you
can use any PCMCIA adapter card that FreeBSD supports; however, I know
the WaveLan-specific one works, and it's not all that expensive (I
paid US$65 for mine, and you can probably get it for less).
I'm also only going to cover the ISA version of the adapter; I'm not
going to talk about the PCI version. Where I am, it's pretty
difficult to find the PCI version, and so I settled for the ISA one.
One advantage of this is that it's possible to use an old 386 box as a
WaveLan gateway. A disadvantage is that the ISA bus is going away,
and so newer PCs may not have any ISA slots.
CONFIGURING THE DESKTOP
Here are the steps for configuring the desktop:
1. For the WaveLan PCMCIA adapter card, follow the card's instructions
for installing it into the desktop. Just follow the hardware
installation instructions; you don't have to follow the instructions
for installing software drivers. On the other hand, if you are
dual-booting Windows and FreeBSD, installing the Windows drivers
will allow you to use the WaveLan under Windows, as well as allowing
you to run the hardware and wireless LAN diagnostics.
However, before you install the card, follow the instructions to set
the card's base port address to 0x3E0. The default is 0x3E2. You
don't really have to change the address to 0x3E0, but the default
for FreeBSD is 0x3E0; if you don't change it here, you'll have to
change the value used by the kernel (see below).
Whatever you decide, make a note of the base port address.
2. Decide if you're going to use an IRQ for the PCMCIA adapter card.
You need to use an IRQ for the WaveLan PCMCIA card, but the use of
an IRQ for the PCMCIA adapter is optional. For best performance, an
IRQ should be assigned to the PCMCIA adapter, but the adapter should
still function in polled mode (without an IRQ). I haven't tested
the polled mode, though.
If you're not going to use an IRQ, skip to the next step.
If you are going to use an IRQ, go into the desktop's BIOS setup
routines, and tell the BIOS to not auto-assign IRQ 10. Hopefully,
you have this free; if not, you should be able to use other IRQ
values, as long as they are not shared or already used by other
devices (I haven't tried this, though). In the following, I'm going
to assume that IRQ 10 is used (if not, change "10" to whatever
you're using).
What's happening is that the WaveLan ISA PCMCIA adapter is not a
plug-and-play card, and so you want to insure that the BIOS does not
assign its IRQ to some other device/card. Note that the adapter IRQ
is set via software (by FreeBSD) and not by some jumper setting.
When you configure the FreeBSD kernel (see below), you'll be
specifying the IRQ to use (as part of the pcic device), and you want
to insure that this IRQ is free, and has not been assigned by the
BIOS to some other device/card. To do this, you need to tell the
BIOS that this IRQ is not available for use by PNP or PCI cards.
For the AWARD BIOS, this setting is usually under the "PNP/PCI
CONFIGURATION" or "PNP, PCI, & ONBOARD I/O" page. You'll want to
set the BIOS settings to:
Resources Controlled By: Manual
IRQ 10: N (or "Legacy ISA")
If the BIOS does assign IRQ 10 to another device/card (you do not
want this to happen), the pccard functions will not work, and a good
indication of this is an IRQ mismatch in dmesg, like:
pcic0: <VLSI 82C146> at port 0x3e0 iomem 0xd0000 irq 10 on isa0
pcic0: management irq 11
Note the IRQ mismatch (10 vs 11). If this part is configured
properly, the IRQ values should match, like:
pcic0: <VLSI 82C146> at port 0x3e0 iomem 0xd0000 irq 10 on isa0
pcic0: management irq 10
If you have no free IRQs, you could try to use the WaveLan PCMCIA
adapter in "polled" mode, which does not require an IRQ, but is more
inefficient. I haven't tried this, though.
If you're short on IRQs, you may want to disable any device that you
don't need. For example, I don't need the second serial port, and
so I disabled it, freeing the corresponding IRQ (IRQ3) for use by
the WaveLan card.
3. Boot FreeBSD.
4. Edit /etc/rc.conf, and add lines like the following to it:
pccard_enable="YES"
pccard_mem="0xd0000"
pccard_ifconfig="inet 10.0.0.1 netmask 255.255.255.0"
pccard_conf="/etc/pccard.conf"
gateway_enable="YES"
firewall_enable="YES"
firewall_type="simple"
natd_enable="YES"
natd_interface="fxp0"
Here, you will have to edit the values for "pccard_mem",
"pccard_ifconfig", and "natd_interface". You may also want to
change "firewall_type".
If the desktop is connected to the public Internet, you'll
definitely want to change the firewall type. Read the ipfw(8) man
page, as well as the comments in "/etc/rc.firewall".
If you leave "firewall_type" set to "simple", you will have to edit
/etc/rc.firewall; in that file, see the section for "simple" (search
for "simple firewall") and follow the instructions there.
The value of "pccard_mem" must match the setting used in the kernel
configuration (i.e., the value of "iomem" in "device pcic0" -- see
step X, below).
You'll probably want to change "pccard_ifconfig" to reflect your
local LAN settings. Here, the values you'll be placing here are the
values that will be used by the WaveLan card. Since we will be
using natd, we can use an unregistered IP address here.
Change "natd_interface" to the interface of your wired, public LAN
interface. The idea is that LAN packets will be arriving on the
WaveLan interface, translated by natd, and then sent back out on the
wired LAN specified by "natd_interface", and vice-versa.
Save "/etc/rc.conf".
5. At the bottom of this message, there is an appended file,
"/etc/setup_wi0". Install the file as "/etc/setup_wi0". Make sure
the first line is "#! /bin/sh". Make sure it's executable.
(If you don't know what I'm talking about, you really should not be
doing this.)
6. Edit "/etc/setup_wi0". Read the comments at the beginning of the
file and set the variables appropriately.
This script will be executed when the WaveLan card is inserted, or
at bootup if the card is present at bootup. This script sets up
various WaveLan parameters, such as the frequency channel and
optional encryption key.
7. Copy "/etc/defaults/pccard.conf.sample" to "/etc/pccard.conf".
8. Edit "/etc/pccard.conf", and look for the entry:
# Lucent WaveLAN/IEEE
card "Lucent Technologies" "WaveLAN/IEEE"
config 0x1 "wi0" ?
insert logger -t pccard:$device -s WaveLAN/IEEE inserted
insert /etc/pccard_ether $device
remove logger -t pccard:$device -s WaveLAN/IEEE removed
remove /sbin/ifconfig $device delete
In this entry, add the line:
insert /etc/setup_$device
So that the entry looks like:
# Lucent WaveLAN/IEEE
card "Lucent Technologies" "WaveLAN/IEEE"
config 0x1 "wi0" ?
insert logger -t pccard:$device -s WaveLAN/IEEE inserted
insert /etc/pccard_ether $device
insert /etc/setup_$device
remove logger -t pccard:$device -s WaveLAN/IEEE removed
remove /sbin/ifconfig $device delete
Save "/etc/pccard.conf".
9. Next, you'll have to reconfigure and build a new kernel.
IMPORTANT NOTE: READ EVERYTHING IN THIS STEP. YOU MAY RUN INTO
PROBLEMS LATER, IF YOU DON'T.
First, add the following parameters to your kernel config file, if
they're not already there:
options IPFIREWALL
options IPDIVERT
device wi
[ Technically, you don't need to compile "device wi" into the
kernel, as you can, theoretically, load the "if_wi" module at
bootup (e.g., "kldload if_wi"). However, I haven't tested this,
and, while it should work, I know that compiling the device into
the kernel works. If anyone has any success with "kldload if_wi",
please tell me, so that I can update this. ]
Also, in your kernel config file, locate the section on PCCARD
support, like:
# PCCARD (PCMCIA) support
device card
device pcic0 at isa? irq 10 port 0x3e0 iomem 0xd0000
If you previously deleted or commented out the above, put it back
(you can copy the above lines from GENERIC or LINT).
You don't need the following line, but, if you are using 0x3e2 for
the WaveLan PCMCIA ISA adapter base address, you'll have to delete
or comment it out:
device pcic1 at isa? irq 11 port 0x3e2 iomem 0xd4000 disable
However, you may have to edit this line:
device pcic0 at isa? irq 10 port 0x3e0 iomem 0xd0000
Here, you may have to change the IRQ and port settings, depending on
what you did in steps 1 & 2, above. If you are not using an IRQ for
the PCMCIA adapter (you're using it in polled mode), eliminate the
IRQ setting, like:
device pcic0 at isa? port 0x3e0 iomem 0xd0000
IMPORTANT NOTE: You may also have to change the value of iomem. If,
after rebuilding the kernel and rebooting, the pccard interface
doesn't work (assuming that you followed the instructions BELOW to
enable it), try setting iomem to one of 0xd4000, 0xd8000, or
0xdc000. You may run into memory conflicts with 0xd0000. A good
indication of a memory conflict is when "pccardc dumpcis" produces
garbage (e.g, "code XXX ignored", where "XXX" is a number like
"192"). It seems that people with SCSI controllers can run into
this problem.
If you change iomem, note that you must also change the
corresponding entry in /etc/rc.conf.
Build the new kernel, install it, and reboot.
10. If all goes well, after rebooting, you should see a message like
(by default, this goes to the console only, is not visible via
dmesg, and is not written to a log file):
pccardd[44]: Card "Lucent Technologies"("WaveLAN/IEEE") matched
"Lucent Technologies" ("WaveLAN/IEEE")
This will be all on one line.
After another moment or two, you should see a message like this:
wi0: <WaveLAN/IEEE 802.11> at port 0x240-0x27f irq 3 slot 0 on pccard0
Fortunately, this message is visible via dmesg, and so does get put
into /var/log/messages.
CONFIGURING THE LAPTOP
Configuring the laptop is very similar to configuring the desktop,
except that it's simpler, due to the fact that the PCMCIA interface is
built into the laptop.
TROUBLESHOOTING
1. Nothing appears to happen after rebooting.
Run dmesg. Look for lines that start with "pcic0:". If you find
some, the PCMCIA adapter was found, and you should skip to the next
item.
If you can't find any, this probably means that there is a problem
with the PCMCIA adapter/controller:
* Did you just reboot from Windows 95/98/NT? FreeBSD 4.X has a
minor problem where the PCMCIA controller is not recognized if you
just rebooted from Windows. If you reboot again, the PCMCIA
controller should be found. (Basically, if you were running
Windows, you need to reboot twice -- or turn off the power -- to
get FreeBSD to recognize the adapter.)
* Is the PCMCIA adapter port address correct? Note that the default
address of the WaveLan PCMCIA adapter is 0x3E2, but the default
for the FreeBSD driver is 0x3E0. They've got to match.
2. The ISA PCMCIA adapter does not recognize the WaveLan card; nothing
happens when the card is inserted.
If you assigned an IRQ to the ISA PCMCIA adapter (recommended), did
you tell the BIOS that this IRQ is not available for use by PNP/PCI
cards (see step #2 in the configuration section, above)? One
indication that you didn't do this is an IRQ mismatch, like:
pcic0: <VLSI 82C146> at port 0x3e0 iomem 0xd0000 irq 10 on isa0
pcic0: management irq 11
Note the IRQ mismatch (10 vs 11). If this is configured properly,
the IRQ values should match, like:
pcic0: <VLSI 82C146> at port 0x3e0 iomem 0xd0000 irq 10 on isa0
pcic0: management irq 10
3. The PCMCIA adapter does not recognize the WaveLan card; you get
error messages like:
pccardd: No card in database for ""("")
This particular error is usually caused by a memory address
conflict; if so, the solution is to set "iomem" to a different
address (see step #9 in the configuration section, above). To
verify a memory conflict, try running "pccard dumpcis"; if you get
messages like "code XXX ignored", where "XXX" is a number, then you
probably have a memory conflict.
If you changed iomem, did you also edit /etc/rc.conf to reflect that
fact? The values for iomem and pccard_mem in /etc/rc.conf must
match. If you edit rc.conf, you'll have to reboot.
If the memory addresses are correct (iomem and pccard_mem), "pccard
dumpcis" should output a section like (in addition to a lot of other
text):
Tuple #4, code = 0x15 (Version 1 info), length = 80
000: 05 00 4c 75 63 65 6e 74 20 54 65 63 68 6e 6f 6c
010: 6f 67 69 65 73 00 57 61 76 65 4c 41 4e 2f 49 45
020: 45 45 00 56 65 72 73 69 6f 6e 20 30 31 2e 30 31
030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff
Version = 5.0, Manuf = [Lucent Technologies],card vers = [WaveLAN/IEEE]
Addit. info = [Version 01.01],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]
Note that the above is approximate; it may change with different
card firmware revisions.
4. Did you edit /etc/pccard.conf to allow the use of IRQ9 for the
WaveLan card (wi0)? IRQ9 may not work with the WaveLan card. You
may have to come up with another IRQ.
5. The WaveLan driver complains about:
wi0: No irq?!
This means that the driver could not allocate a free IRQ for the
WaveLan card. Unfortunately, there's no easy solution for this --
you've got to somehow free up an IRQ for the card. Note that the
list of possible IRQs to use is listed in /etc/pccard.conf; if you
free up an IRQ, make sure it's listed there.
6. The driver complains about:
wi0: No I/O space?!
This means that the driver could not allocate a range of I/O ports
to use to access the card.
I've only seen this when I tried to insert the WaveLan card into a
laptop that already has another PCMCIA card in another slot, and the
wi0 driver failed because it could not allocate an IRQ ("wi0: No irq?!").
If I ejected the other card and re-inserted the WaveLan card, I
would then get the "No I/O space?!" error. The solution is to
reboot.
(I think this is caused by a minor bug in the pccard or wi driver
code.)
If the card is found and properly initialized, the problem is probably
caused by some network-related error (the same types that afflict wired
LAN cards), and so is beyond the scope of this article.
===============================================================================
= Here is the "/etc/setup_wi0" script.
====== cut here ===== cut here ===== cut here =================================
#! /bin/sh
set -e
###############################################################################
#
# Configuration variables:
# IFC is the wavelan interface to use (e.g., "wi0"); this must be
# specified:
IFC=wi0
# STATION_NAME is, well, the "station name", which is really only used
# by the WaveLan diagostic tools. When using the tools (in a remote
# PC -- not this one), the tools will display this name when
# identifying the WaveLan card in this system. Because it's only used
# by remote diagnostic tools, it's not essential to set SYSTEM_NAME.
# However, it is recommended that, if it is set, it be set to be the
# same as the hostname (otherwise, you'll have to remember which
# station name goes with which hostname).
#
# Note, however, that the following uses `hostname` as the default.
# This may not work if this script is called at bootup (especially
# when called from pccard.conf), because the hostname may not yet have
# been set. In this case, you should hardcode a value here.
STATION_NAME=`hostname | sed -e 's/\..*$//'`
# NETWORK_NAME is the name of the network that you wish to join (be a
# part of). NETWORK_NAME must be set if you wish this system to talk
# to a WaveLan access point. The NETWORK_NAME can be "ANY"
# (upper-case is required), in which case the card will talk to any
# access point; otherwise, NETWORK_NAME must be set to the same name
# used by the access point. If you are using "ad-hoc mode" (not using
# an access point), which generally is the case with an home LAN, you
# do not need to set NETWORK_NAME (because ad-hoc mode ignores the
# NETWORK_NAME).
NETWORK_NAME='ANY'
# MODE determines how the WaveLan card talks to other cards. If you
# are using a WaveLan access point, you must set this to "1" (BSS
# mode), and you must also set a valid NETWORK_NAME (above), as the
# NETWORK_NAME must correspond to the name used by the access point.
# For LANs without an access point (the usual case for home LANs),
# MODE should be "3" (ad-hoc mode).
MODE=3 # 1 --> BSS, 3 --> ad-hoc mode
# CHANNEL is the frequency channel to use. The default for cards sold
# in the USA and Europe (except France) is channel 3, 11 in France,
# and 14 in Japan. Valid channels are:
#
# USA: 1-11
# Europe (except France): 1-13
# France: 10-13
# Japan: 14 (only -- unchangeable)
#
# See wicontrol(8) for more information.
CHANNEL=3 # Card default is channel 3
# KEY is the encryption key to use. If KEY is blank/empty or not set,
# the encryption key is not set, and encryption will not be enabled.
# If a key is specified here, encryption will be enabled (this script
# does not support enabling/disabling encryption independently of key
# values). Note that, although the wavelan supports up to four
# different keys (but only one can be used at any one time), only one
# key (key 1) is used here.
#
# Remember that all systems that talk to each other must use the same
# key.
#
# See wicontrol(8) for valid key values.
KEY=
#
# End of configuration variables. Nothing should have to be changed
# past this point.
#
###############################################################################
PATH="/usr/sbin:/usr/bin:/sbin:/bin:$PATH"
if [ "X$STATION_NAME" != "X" ]
then
wicontrol -i $IFC -s "$STATION_NAME"
fi
wicontrol -i $IFC -p $MODE
if [ "X$NETWORK_NAME" != "X" ]
then
wicontrol -i $IFC -n "$NETWORK_NAME"
fi
if [ "X$CHANNEL" != "X" ]
then
wicontrol -i $IFC -f $CHANNEL
fi
if [ \( "X$KEY" != "X" \) -a \
\( "X$KEY" != "XNO" \) -a \
\( "X$KEY" != "Xno" \) -a \
\( "X$KEY" != "XNo" \) \
]
then
wicontrol -i $IFC -k $KEY
wicontrol -i $IFC -e 1
fi
exit 0
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200005241849.LAA23904>
