Previous

Linux Wireless Access Point HOWTO

Next

Chapter 4. Installing the HOSTAP driver


4.1 Overview of HOSTAP

HOSTAP is a driver for wireless cards that use the Intersil Prism2/2.5/3 chipset. We need this driver in order for our Linux box to function as an Access Point, as it includes support for the management functionality we require. For more information, visit the HOSTAP Homepage.

In this chapter we will install a Linux kernel that supports HOSTAP and make changes to system files in order to configure our wireless interface card. Afterwards we will check that the wireless card is functioning correctly and try to diagnose any problems we discover using various system utilities and by checking the configuration files.


4.2 Installing the kernel

As HOSTAP is an esoteric part of Linux, support for it is not included with the default kernel we installed in Chapter 3. For HOSTAP support we must either compile our own kernel or install a binary kernel which has support included.

4.2.1 Building a kernel with HOSTAP

You can download the source from the HOSTAP homepage and follow the instructions given for installing HOSTAP support into the kernel, with reference to the Linux Kernel Howto to compile a suitable Linux kernel. Building a kernel with this method is not for the faint hearted and is recommended for advanced Linux users. Though you may decide in the future to compile your own kernel in order to optimise your system's performance, it is recommended the first time around that you use the method described in the next section to install a pre-packaged kernel.

4.2.2 Installing a pre-packaged Kernel

Fortunately there is an alternative to compiling a kernel from scratch; a binary kernel in .RPM format produced by Aaron Baer. It is identical to the stock Redhat kernel except that it has had HOSTAP support added. That Aaron has kindly taken the time to make this kernel available is one of the reasons why Redhat was chosen as the distribution of choice for this HOWTO. We can download this kernel and install it quickly and easily.

4.2.2.1 Downloading the kernel

Aaron Baer has made the latest HOSTAP supporting kernels available here. One way of downloading a suitable kernel is with this command;

[root@accesspoint root]# wget http://www.cat.pdx.edu/~baera/redhat_hostap/kernel-2.4.20-13.9.HOSTAP.i686.rpm

Which will produce an output similar to;

--01:53:18-- http://www.cat.pdx.edu/%7Ebaera/redhat_hostap/kernel-2.4.20-13.9.HOSTAP.i686.rpm
=> `kernel-2.4.20-13.9.HOSTAP.i686.rpm.2'
Resolving www.cat.pdx.edu... done.
Connecting to www.cat.pdx.edu[131.252.209.97]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14,131,783 [audio/x-pn-realaudio-plugin]
0% [                                                          ] 25,096 33.07K/s ETA 06:56

With the process bar and other data fields continuously updating. Once it has finished, we can move on to installing it.

4.2.2.2 Installing a binary kernel with RPM

We install the new kernel like we would any other package built with the RPM package management system. Note that this procedure adds the HOSTAP supporting kernel to the stock Redhat kernel already on the system. This means that grub bootloader menu that you will see when the system boots will give you the option of which kernel to boot. Install the new kernel with the following command;

[root@accesspoint root] rpm -ivh kernel-2.4.20-13.9.HOSTAP.i686.rpm

Which will produce the following output to show us that the install has been successful;

Preparing...                               ########################################### [100%]
1:kernel-2.4.20.13.9.HOSTAP ########################################### [100%]

At this stage you may like to reboot the system and ensure that it comes up cleanly. Be sure to select the kernel Red Hat Linux (2.4.20-13.9.HOSTAP) and take note of any error messages that you see as they will provide you with clues as to what may have gone wrong. If worst comes to worst and the HOSTAP kernel won't boot, we can always boot back into the stock Redhat kernel by selecting it's entry in the bootloader.


4.3 Configuring the kernel and the wireless interface

Now that our Linux box can support our wireless card, we need to configure it to do so. This is achieved by loading the necessary kernel modules and configuring the TCP/IP settings and the 802.11b settings of the card, as described in the following subsections.

4.3.1 Loading the HOSTAP modules

The Linux kernel will dynamically load the necessary HOSTAP modules on demand. We tell it to do so when the device WLAN0 is present on the system by adding an entry to the file /etc/modules.conf with a command such as this;

[root@accesspoint root]# cat <<END_ENTRY >> /etc/modules.conf
alias wlan0 hostap_pci
END_ENTRY


4.3.2 Configuring TCP/IP for the wireless interface

We need to create a network device entry for our wireless interface, which is called WLAN0 by our Linux system. To do this we create a file that includes the TCP/IP settings we will use for the wireless interface. For the purpose of this example we pretend that that network assigned to us our wireless administrator is 10.1.2/24 (10.1.2.0 netmask 255.255.255.0) which means that we set the IP address of the wireless interface of our Access Point 10.1.2.1 - as shown in the Chapter 1 diagrams

[root@accesspoint root]# cat <<END_ENTRY > /etc/sysconfig/network-scripts/ifcfg-wlan0
DEVICE=wlan0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.1.2.1
NETMASK=255.255.255.0
END_ENTRY

The file we have just created is used by the /etc/init.d/network script to bring our wireless interface up at boot time.

4.3.3 Configuring the 802.11b settings for the wireless interface

In this section we are going to set the name of our Access Point to one that will be visible to other wireless systems. We will configure these to be set at boot time. The name will be the one assigned to us by NZ-Wireless, based on our entry in nodedb.com.

Note that in order to do this we use the /sbin/iwconfig utility, which is part of the Wireless Tools package. Our Redhat install included Wireless Tools by default so we don't need to install it.

For the purpose of ths example, we pretend that the name assigned to us by our wireless administrator is simon.akld.nzwireless.org

While we're editing this particular file, we are also going to enable the routing of traffic between both of the network interfaces; eth0 and WLAN0. Routing is required for traffic to pass across our Access Point, between systems connected to our wired network and systems connected to our wireless network.

[root@accesspoint root]# cat <<END_ENTRY >> /etc/rc.local
/sbin/iwconfig wlan0 ESSID "simon.akld.nzwireless.org"
echo "1" >/proc/sys/net/ipv4/ip_forward
END_ENTRY

At this stage, our wireless interface should be fully configured and wireless clients should be able to associate with our node. It's time to reboot the system and test. Enter the following command to reboot;

[root@accesspoint root]# shutdown -r now

Watch as the system comes back up to make certain that no errors are reported. If there are errors, take note of the error messages as they will provide clues to what may have gone wrong. Once the system has come back up and you are saitisfied that it is operating correctly, log in as root and move on to testing in the next section.

4.3.4 Configuring WDS settings

In this section we will enable the WDS feature of our wireless card. WDS is a solution for interconnecting Access Points wirelessly. We configure it with the iwpriv utility from the Wireless Tools package. We're also going to set the channel that our wireless card operates on, as WDS requires all linking nodes to use the same channel.

This section is based solely on the information provided by SOWN's linking section, available here. My thanks to the SOWN project's Mike Saywell for his research, ongoing advice and willingness to let me include his work in this HOWTO.

We configure the WDS features of our wireless interface by adding configuration settings to the file /etc/rc.local in addition to those that we placed there in the previous section.

[root@accesspoint root]# cat <<END_ENTRY >> /etc/rc.local
/sbin/iwpriv wlan0 prism2_param 8 2
/sbin/iwpriv wlan0 prism2_param 14 1
/sbin/iwpriv wlan0 prism2_param 27 4
/sbin/iwconfig wlan0 channel 3
END_ENTRY

In order, these command lines tell the wireless interface to link with any other Access Point regardless of it's ESSID, enables the automatic creation of link interfaces, enables bridging with other WDS compliant Access Points and finally sets the channel to "3." More information on the IWPRIV command can be obtained from the iwpriv man page

WDS links can be configured manually using the IPWPRIV command, but this requires you to know the remote MAC address of the Access Point you wish to interconnect with and requires that you agree on addressing with the operator. An alternative is to configure links automatically using Mike Saywell's Aladin daemon, as described in Section 11.7


4.4 Testing the wireless interface

In this section we will test that our wireless interface is working correctly. The easiest way to do this is to see if it is visible from another wireless-enabled system. My favorite diagnostic package for this purpose is Kismet, though you could also configure you other wireless system to associate with our Access Point and see if you get a connection. Even if another wireless-enabled device is not available, we can use the following set of maintenace commands on our Access Point to test that is working or to diagnose errors.

4.4.1 Checking that an Interrupt has been assigned

Here we check to see that our wireless card has been assigned an Interrupt (also called an IRQ) with the following command;

[root@accesspoint root]# cat /proc/interrupts

Check that there is an entry for wlan0. Depending on your system it may look something like the following, but all that really matters is that it is mentioned, so that we know it has been detected by the system.

11:     840839     XT-PIC     usb-uhci, eth0, wlan0

If there is no entry for wlan0, your card has not been detected by the system. Possible reasons for this include a lack of availabe IRQs and incompatible versions of PCI between your motherboard and your wireless card. You will need to modify the settings of you PCs BIOS in order to get the card to work. How to do so is outside the scope of this document and you should refer to your PC manufacturer's support documentation for guidance on adjusting your BIOSs settings.

4.4.2 Checking that wireless modules have loaded

We need to ensure that the necessary modules have been loaded by the kernel. To do so enter this command;

[root@accesspoint root]# lsmod

And check that the modules hostap, hostap_pci and hostap_crypt are listed. Here is an example snipet of how the output of the above command should look. Note that I have removed the entries for other modules loaded by the kernel that are not relevant to the wireless card which we can safely ignore.

Module           Size   Used by   Not tainted
hostap_pci      49300   1
hostap             86148   0   [hostap_pci]
hostap_crypt   2992    0   [hostap]

If the modules are not present we can try to insert them manually with the command;

[root@accesspoint root]# insmod hostap_pci

Take note of any errors this command produces. If the module cannot be found check that hostap_pci.o exists in the /lib/modules/2.4.20-13.9.HOSTAP/ heirarchy.

If device wlan0 cannot be found, check that the file /etc/sysconfig/network-scripts/ifcfg-wlan0 exists, that it's format is correct and that the file's permissions are set to 644

4.4.3 Checking the 802.11b settings with iwconfig

Enter the following command to check the various 802.11b settings of your wireless card. Note that you can manually adjust these settings with the iwconfig utility, as described in the iwconfig manpage.

[root@accesspoint root]# /sbin/iwconfig wlan0

The output should look similar to this;

wlan0    IEEE 802.11b ESSID:"simon.akld.nzwireless.org"
             Mode:Master Frequency:2.422GHz Access Point: 00:40:05:AE:99:21
             Bit Rate:11Mb/s Tx-Power:3 dBm Sensitivity=1/3
             Retry min limit:8 RTS thr:off Fragment thr:off
             Encryption key:off
             Power Management:off
             Link Quality:0 Signal level:0 Noise level:0
             Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
             Tx excessive retries:0 Invalid misc:117146 Missed beacon:0


iwconfig is an extremely useful utility for monitoring your wireless interface and adjusting it's settings. For instance, it is possible that you will need to use iwconfig in order to change the channel used by your card in the future, as the concentration of Access Points around you increases and clashes occur. For more information on this integral command see the iwconfig manpage

4.4.4 Checking the TCP/IP settings with ifconfig

Once the wireless interface is configured, Linux treats it exactly as it would any other network interface. We check the TCP/IP settings for Linux network interfaces with the ifconfig command;

[root@accesspoint root]# /sbin/ifconfig wlan0

If the card is working correctly, the output from ifconfig should be similar to this;

wlan0    Link encap:Ethernet HWaddr 00:40:05:AE:99:21
             inet addr:10.1.2.1 Bcast:10.10.10.255 Mask:255.255.255.0
             UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
             RX packets:783821 errors:0 dropped:2543 overruns:0 frame:0
             TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
             collisions:0 txqueuelen:100
             RX bytes:0 (0.0 b) TX bytes:288 (288.0 b)
             Interrupt:11 Memory:c48b6000-c48b7000

Note the amount of useful information that is provided by ifconfig. Together with iwconfig it forms the basis for diagnosing problems with your card and configuring it for your use. For more information on using ifconfig for configuring network interfaces, refer to the ifconfig Manpage.


Previous Home Next