Creating an Access Point Interface with the ath5k driver (using hostapd)
This document describes how to create an Access Point using an ath5k device. For this, we will be using hostapd for access point management, which supports various encryption and authentication schemes, including common schemes like WPA, WPA2 and EAP.
Another guide that may help for kernel versions greater than 2.6.30: http://wireless.erley.org/stable.html (as of Nov 1, 2009), and http://wireless.kernel.org/en/users/Documentation/hostapd and http://bobcopeland.com/blog/2009/11/ath5k-ap-mode/
The driver currently included with kernel version 2.6.30 (and all previous releases) does not support switching the card to access point mode (also called "Master Mode". This is why we need to use compat-wireless, which is a collection of bleeding edge versions of common wireless drivers, including ath5k.
- Preparing your kernel
- Building and installing compat-wireless
- Building and installing hostapd
- Testing your setup
Preparing your kernel
Compat-wireless requires a 2.6.27 or higher kernel version. This procedure was tested using a 2.6.30 kernel, but should work for all versions >= 2.6.27 -- no guarantees, however.
- Kernel source for your current kernel
- Kernel headers
It is important that your current kernel has the following drivers as modules (and NOT built in):
Networking support -> Wireless -> Improved wireless configuration API
Networking support -> Wireless -> Generic IEEE 802.11 Networking Stack (mac80211)
In addition to this, the driver you will be using (in this case 'ath5k') needs to be configured as a module as well:
Device Drivers -> Network device support -> Wireless LAN -> Atheros 5xxx wireless cards support
If you prefer to edit your kernel .config manually, set the following options:
If these are built-in, compat-wireless will fail to build.
Building and installing compat-wireless
First download the appropriate release for your kernel from http://linuxwireless.org/en/users/Download : compat-wireless-old for kernels 2.6.22 up to 2.6.26, compat-wireless-stable for kernels >= 2.6.27.
To use AP functionality, the compat-wireless source code will need one slight modification. To do this, use your favorite text editor to open compat-wireless-<your_version>/drivers/net/wireless/ath5/base.c .
Find this block of code:
hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_MESH_POINT);
and add the line "BIT(NL80211_IFTYPE_AP) |" so it reads:
hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP) | BIT(NL80211_IFTYPE_MESH_POINT);
After doing this, build and install compat-wireless as normal, as explained on http://linuxwireless.org/en/users/Download . Finally, unload and reload the appropriate modules, or, if you're unsure which ones to reload, reboot.
Building and installing hostapd
Download, build and install hostapd as described on: http://wireless.kernel.org/en/users/Documentation/hostapd The latest stable release found on http://w1.fi/hostapd/ should work.
Testing your setup
After you've successfully built Hostapd, you can test it using a barebone hostapd.conf. The minimum of options you need for this are:
to set the SSID and:
to tell hostapd which interface to use (type 'iwconfig' to find out what the interface is called) and:
To tell hostapd to use the nl80211 driver interface.
Now run hostapd with the appropriate config file:
(this assumes running hostapd from the build directory, adjust paths to appropriate settings if needed)
This will create an access point using the default SSID 'test'. If all went well, you'll see something like:
Configuration file: ./hostapd.conf Using interface wlan0 with hwaddr 00:18:e7:5e:92:0a and ssid 'test'
You now have a functioning access point, which allows association with client stations. If you want your access point to relay traffic to your wired network, the next step is to set up either a bridging interface, or assign an IP to your wireless interface and configure IP routing/forwarding. Additionally, you'll likely want to configure hostapd to use some form of encryption, as well as run it as a daemon. For more information about this, see UserDocs/HostAP