Networking with Linux Wireless Tools



Networking with Linux Wireless Tools

The Linux Wireless Tools package, installed by default, probably meets most of your 802.11a/b needs. Its main advantage is that, unlike Linux-WLAN, you don't have to reinstall it every time you upgrade your kernel.

Using iwconfig for Wireless Tools Configuration

After physically installing your Linux-compatible NIC, you need to configure your NIC's IP and wireless settings before Wireless Tools works.

You can configure your NIC's IP settings as if the NIC were a regular Ethernet device. After you use the ifup command the NIC becomes active, but it will not function correctly as its wireless settings haven't been configured yet.

The most commonly used command in Wireless Tools is iwconfig, which you can use to configure most of the wireless parameters, including the SSID and the wireless mode. For the wireless mode, Managed means that there is a wireless access point (WAP) on the network and Ad-hoc signifies that there is none.

For example, if your wireless NIC is named eth0 and your managed network's ESSID is homenet, then the commands would be:

     iwconfig eth0 mode Managed
     iwconfig eth0 essid homenet

Your NIC should now become fully functional. You will need to run these iwconfig commands each time you use the ifup command, however; forgetting to do so can be problematic. The next section shows how to make these iwconfig changes permanent.

Permanent Wireless Tools Configuration

Once your ad-hoc configuration has been completed, you need to make the changes permanent.

1.
Configure your /etc/sysconfig/network-scripts/ifcfg-eth0 file normally as if it were a regular Ethernet NIC.

DHCP Version          Fixed IP Version
============          =================

DEVICE=eth0           DEVICE=eth0
USERCTL=yes           IPADDR=192.168.1.100
ONBOOT=yes            NETMASK=255.255.255.0
BOOTPROTO=dhcp        ONBOOT=yes
                      BOOTPROTO=static

2.
Add the following statements to the end to specify that the NIC is wireless; provide the ESSID to use (in this case homenet), and finally choose Managed (a WAP on present of the network) or Ad-hoc (no WAP) for the wireless mode.

#
# Wireless configuration
#
TYPE=Wireless
MODE=Managed
ESSID=homenet

These commands need only be on the main interface file. They are not needed for IP aliases. Your wireless NIC should function as if it were a regular Ethernet NIC using the ifup and ifdown commands.

Wireless Tools Encryption

It is usually best to test your network in an unencrypted state before activating the additional security. This allows you to limit your troubleshooting activities to basic wireless settings, without the additional complications of encryption.

Encryption requires an encryption key that you can make up yourself or generate with the /sbin/nwepgen command that comes with the kernel-wlan-ng RPM (more on this coming up). The advantage of the nwepgen command is that you can provide an easily remembered string that it will consistently encode in to an ESSID key. You can use any one of the rows of characters to create a 40-bit key.

If you don't have nwepgen, then remember to use hexadecimal numbers, which are composed of numeric values between 0 and 9 and alphabetic characters between A and F:

     [root@bigboy tmp]# /sbin/nwepgen ketchup
     64:c1:a1:cc:db
     2b:32:ed:37:16
     b6:cc:9e:1b:37
     d7:0e:51:3f:03
     [root@bigboy tmp]#

When using iwconfig to add encryption, be sure that there are no colons or any other non-hexadecimal characters between the characters of the key. There should be ten characters in total:

     iwconfig eth0 key 967136deac

The same rules (no colons or non-hexidecimals between the ten total characters) apply when using the /etc/sysconfig/network-scripts files to add encryption:

     KEY=967136deac