BSD DevCenter
oreilly.comSafari Books Online.Conferences.


Big Scary Daemons

Setting up Wireless Cards on FreeBSD


FreeBSD supports a few different types of wireless cards. WaveLAN cards use the wi driver. Aironet cards use the an driver. The Raylink cards use the ray driver. The user interfaces are similar. I'll discuss WaveLAN cards in detail below, but this should work for the other cards as well.

Most wireless cards work with one of these drivers. Even if the names "WaveLAN," "Aironet," or "Raylink" don't appear on the card, it's probably supported. Remember how many different cards use the NE2000 Ethernet card, known in FreeBSD as "ed"? Well, the literal NE2000 is just Novell's card; the hundreds of others are "NE2000-compatible."

If you have questions about a particular card, check the mailing list archives. Unless your card is brand-spanking new, it's been discussed there. At length. Many times.

The important thing to remember with making wireless cards work is that everything on all devices connected to the network must match. Ethernet is easy; you install the card, plug in a cat5 cable, check for a link light, configure, and go! Wireless cards replace the cat5 cable and hub with radio waves. You need to jump through some hoops to configure things properly.

If you're running in ad-hoc mode, you just need to set up all the cards in exactly the same way. Install each card normally. Confirm that your kernel recognizes it. If your kernel doesn't include the driver for that card, rebuild your kernel. If it's a PC Card, just use kldload before inserting the card.

The main tool to configure WaveLAN cards is wicontrol(8). If you enter wicontrol without any arguments, it displays the configuration of the wi0 interface. (You can change the interface with the -i command-line option.) Similarly, an cards have ancontrol, and ray cards use (wait for it...) raycontrol.

We'll look at the commands needed for the bare minimum to get your wireless card securely in operation. Errors in any of these commands will prevent your network from working.

First of all, there's the port type. In the previous article we discussed the differences between ad-hoc and infrastructure mode. If you're in ad-hoc mode, the default (3) is correct. If you have an access point, set your port type to 1. I'm using an Apple Airport access point, so I tell the card to search for it with:

wicontrol -p 1

In the case of my home network, infrastructure mode was really my only option. I could have opened the case on my firewall and installed a network card, but I'm afraid of what could happen if I even touch that ancient piece of crud.

Then you have a network name. You can only network with hosts with the same network name, so this needs to be correct. This helps keep neighbors off your LAN, and vice versa. Since Lucent cards attach to the first network they find, such wrong connections can be a perfectly innocent error instead of a blatant attempt to steal your bandwidth. You set the network name as such:

wicontrol -n YourNameHere

You could technically start networking here. WEP (Wired Equivalent Privacy) encryption isn't set up yet, however. Any traffic you send now will be broadcast in clear-text across the neighborhood. You enable encryption with the -e flag:

wicontrol -e 1

You can then set a WEP cryptographic key. This is a hexadecimal shared secret between the various network nodes. Much like a password, if your key is discovered, anyone can access your network. Set the key with:

wicontrol -k 0x1234567890

Only network cards that have the same cryptographic key and network name can talk to each other. Don't use the key in the example; pick your own.

The wicontrol command only displays keys if run as root. They appear empty when run as a regular user.

Pages: 1, 2

Next Pagearrow

Sponsored by: