5.5 Wireless

Wireless networking is still a relatively new thing in the world of computers, yet is quickly catching on as more people begin to purchase laptops and want networking on the go, without having to fool with some old twisted pair cable. This trend doesn't appear to be slowing down. Unfortunately, wireless networking isn't yet as strongly supported in Linux as traditional wired networking.

There are three basic steps to configuring an 802.11 wireless Ethernet card:

  1. Hardware support for the wireless card

  2. Configure the card to connect to a wireless access point

  3. Configure the network

5.5.1 Hardware Support

Hardware support for a wireless card is provided through the kernel, either with a module or built in to the kernel. Generally, most newer Ethernet cards are provided through kernel modules, so you'll want to determine the appropriate kernel module and load it through /etc/rc.d/rc.modules. netconfig may not detect your wireless card, so you'll probably need to determine the card yourself. See http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/ for more information on kernel drivers for various wireless cards.

5.5.2 Configure the Wireless Settings

The vast majority of this work is done by iwconfig, so as always read the man page for iwconfig if you need more information.

First, you'll want to configure your wireless access point. Wireless access points vary quite a bit in their terminology, and how to configure them, so you may need to adjust a bit to accommodate your hardware. In general, you'll need at least the following information:

Warning

A NOTE ABOUT WEP. WEP is quit flawed, but it's much better than nothing. If you wish a greater degree of security on your wireless network, you should investigate VPNs or IPSec, both of which are beyond the scope of this document. You might also configure your WAP not to advertise its domain ID/ ESSID. A thorough discussion of wireless policy is beyond the scope of this section, but a quick Google search will turn up more than you ever wanted to know.

Once you've gathered the above information, and assuming you've used modprobe to load the appropriate kernel driver, you can edit rc.wireless.conf and add your settings. The rc.wireless.conf file is a bit untidy. The least effort is to modify the generic section with your ESSID and KEY, and CHANNEL if required by your card. (Try not setting CHANNEL, and if it works, great; if not, set the CHANNEL as appropriate.) If you're daring, you can modify the file so that only the necessary variables are set. The variable names in rc.wireless.conf correspond to the iwconfig parameters, and are read by rc.wireless and used in the appropriate iwconfig commands.

If you have your key in hexadecimal, that's ideal, since you can be fairly confident that your WAP and iwconfig will agree on the key. If you only have a string, you can't be sure how your WAP will translate that into a hexadecimal key, so some guesswork may be needed (or get your WAP's key in hex).

Once you've modified rc.wireless.conf, run rc.wireless as root, then run rc.inet1, again as root. You can test your wireless networking with standard testing tools such as ping, along with iwconfig. If you have a wired interface you may wish to use ifconfig to turn those interfaces off while you test your wireless networking to ensure there's no interference. You may also want to test your changes through a reboot.

Now that you've seen how to edit /etc/rc.d/rc.wireless for you default network, let's take a closer look at iwconfig and see how it all works. This will teach you the quick and dirty way of setting up wifi for those times when you find yourself at an Internet cafe, coffee shop, or any other wifi hot spot and wish to get online.

The first step is to tell your wireless NIC what network to join. Make sure you replace “eth0” with whatever network interface your wireless card uses and change “mynetwork” to the essid you wish to use. Yes, we know you're smarter than that. Next you'll have to specify the encryption key (if any) used on your wireless network. Finally specify the channel to use (if needed).

# iwconfig eth0 essid "mynetwork"
# iwconfig eth0 key XXXXXXXXXXXXXXXXXXXXXXXXXXX
# iwconfig eth0 channel n

That should be all on the wireless end of things.

5.5.3 Configure the Network

This is done in the exact same way as wired networks. Simply refer to earlier sections of this chapter.