Connecting to a Wireless LAN with Linux, Part 2

By: Carla Schroder
Monday, February 7, 2005 11:37:51 AM EST
URL: http://www.linuxplanet.com/linuxplanet/tutorials/5736/1/

Getting Online

In Part 1 we reviewed hardware options, which wireless utilities should be present, how to use Windows drivers, and how to be open to connect to any available wireless access point. Today we'll cover configurations on Red Hat- and Debian-type systems, basic security, and hardware discovery.

Wireless connectivity can be rather overly friendly, allowing connections from anyone. This howto assumes you have a wireless access point on a LAN, which can be all wireless or mixed wired and wireless. You don't want it wide open to just any random person with a desire to snoop on your network or "borrow" your bandwidth, but you want some access controls and security. Your access point should have a unique SSID (service set identifier), WEP (wireless equivalent privacy) or WPA/WPA2 (Wi-fi protected access) set up and working, and either a DHCP server or a pool of assigned IP addresses for clients.

Red Hat and Red Hat-type Systems

Red Hat, Fedora, CentOS, and most Red Hat clones have the excellent Network Configuration Tool. On Red Hat the command to open it is redhat-config-network. On Fedora the command is system-config-network. If it is not on your system it can be installed separately.

Fire it up and highlight the wireless adapter on the Devices tab, and click Edit. The key configuration items are:

  1. On the General tab enable "Allow all users to enable and disable the device," and enter your network settings.
  2. On the Wireless Settings tab, set the Mode to "Managed."
  3. Check the "Specified" Network Name (SSID) and enter the SSID for your access point.
  4. Enter your WEP or WPA/WPA2 encryption key name or hex number, if your access point supports any of these. WEP is regarded as feeble and easily cracked; WPA/WPA2 is not supported on all wireless adapters or in all Linux drivers. However, you should use whatever is available--don't transmit in the clear.
  5. Click OK and return to main Network Configuration menu, click File -> Save, hit the Activate button for the wireless adapter, and there you are.
On the General tab there is a checkbox for "Activate Device When Computer Starts." You should enable this for PCI and mini-PCI adapters, but don't use it for PCMCIA cards. These are managed by either the PCMCIA service or the hotplug subsystem. There are two types of PCMCIA cards: PC cards are the older type, and are well-supported in the kernel. These have a 16-bit data bus. CardBus is a newer-fangled standard, with a 32-bit bus. CardBus costs a bit more and claims faster performance. For reliability and least hassles, stick with PC cards. CardBus is managed by the hotplug subsystem, which is not as mature and reliable as the PCMCIA service.

Don't use ad-hoc, or peer-to-peer mode, which leaves you open to random connections. Ad-hoc mode is useful for quick easy connectivity without needing an access point, such as for meetings, so be sure to use it only when you really intend to.

Debian and Debian-based Systems

On Debian you can configure all Ethernet interfaces in the /etc/network/interfaces file. This is an example for a static IP on a PCI wireless adapter. Use the "auto eth1" line only for PCI cards, to start them at boot. Don't use it for PCMCIA:

auto eth1
iface eth1 inet static
 address 192.168.1.100
 network 192.168.1.0
 netmask 255.255.255.0
 broadcast 192.168.1.255
 gateway 192.168.1.1
 wireless_essid Office
 wireless_mode Managed
wireless_key 5e5d5e66255b75464a492b4b42

The "wireless_" settings come from the iwconfig command options; you may use any iwconfig option except nick, in this format: wireless_[command] [value]. See man iwconfig for a complete list.

This is how to configure it for DHCP:

auto eth1
iface eth1 inet dhcp

Be sure to list your Ethernet devices in order: lo, eth0, eth1, and so forth. They will be started in the order listed.

Multiple Profiles, Starting and Stopping Wireless Adapters

Multiple profiles are created with the redhat-config-network utility. Users can then easily switch profiles for different locations. When more than one profile exists, running redhat-config-network opens first with the profile chooser.

On Debian, use the whereami utility.

If you run your laptop on battery a lot, you can save power by turning off the wireless adapter when you're not using it. For PCMCIA adapters, use the pcmcia-cs tools. These commands stop and restart the card without unloading the drivers:

# /sbin/cardctl suspend
# /sbin/cardctl resume

These commands eject and activate the card after insertion:

# /sbin/cardctl eject
# /sbin/cardctl insert

Check the card status:

$ /sbin/cardctl status

For PCI adapters use the old familiar ifup and ifdown commands:

# /sbin/ifdown eth1
# /sbin/ifup eth1

Check the PCI adapter status:

$ /sbin/ifconfig

Hardware Discovery

Because wireless adapter manufacturers like to use different chipsets in the exact same model line and never tell you, you may be forced to figure it out for yourself, like when you replace a Windows installation with Linux. Or you might want to haul your trusty Knoppix CD to the store and find out what's installed before purchasing a new PC. Or you just need to see the card information to use in configuration.

Use the pcmcia-cs package to discover the radio chipset in PCMCIA cards, and ordinary old lscpi for PCI adapters. This pcmcia-cs command reads the hardware information for all plugged-in PCMCIA wireless adapters, even if the drivers are not installed:

# cardctl ident
Socket 0:
         no product info available
Socket 1:
         product info: "Lucent Technologies", "WaveLAN/IEEE", "Version 01.01", ""
         manfid: 0x0156, 0x0002
         function: 6 (network)

Sometimes this does not tell you what you need to know, so as a last resort pop the card out and copy the FCC (Federal Communications Commission) ID number. Take this to the FCC search page; this will tell you everything about the device. Look for the "Operational Description" to find the chipset.

Before using lspci, run the update-pciids command as root to update the /usr/share/misc/pci.ids list. Then use lspci:

$ /sbin/lspci
...
02:07.0 Network controller: Intersil Corporation Prism 2.5 Wavelan Chipset (rev 01)
...

Reducing Troubles and Getting Help

Wireless networking is going to be a moving target for some time. When you have the right wireless adapter, wireless tools, and kernel support, getting up and running is as simple as installing the adapter and configuring your network settings.

The number one hassle is finding the right hardware. I still recommend the Senao 2511 and Orinoco Classic Gold because they are dependable, even though they are 802.11b cards. If you are looking at any other cards, especially 802.11g or multi-mode, insist on testing before purchase. I can't even recommend Prism54 anymore, due to this update on the Prism54 site: "Manufacturers started buying the SoftMAC chipsets, which are not yet supported and may never be." You can always try NdisWrapper, which allows you to use an adapter that does not have native Linux support by using the Windows drivers. However it does not work all the time.

When you are having problems the first place to go is the mailing lists for your Linux distribution. Fedora, Red Hat, and Debian have great user lists with a lot of information on using wireless adapters. The next place to go is Wireless LAN resources for Linux, which is the #1 comprehensive resource.

Finally, have some patience, and don't believe everything you read. There is all kinds of hype such as "Turbo mode!! Watch streaming video over wireless!!" and "108 Mbps!!" and similar silliness. These may work under ideal conditions in a test lab, but in the real world don't hold your breath.

Resources

Build A Linux-Based Wireless Access Point
Wi-Fi Planet

Copyright Jupitermedia Corp. All Rights Reserved.