NOTE: this page is for archival only, see the note at the end of the page.

The following information is not complete yet. It is a work-in-progress. - Pat Erley


hostapd Linux documentation page

About hostapd

Homepage: http://w1.fi/hostapd/

hostapd is an IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator. This page is dedicated to the Linux documentation of it's implementation and use. Please refer to the hostapd home page for information for other Operating Systems.

As far a Linux is concerned, out of the old drivers you can only use these 3 drivers with hostapd:

All new mac80211 based drivers that implement AP functionality are supported with hostapd's nl80211 driver.

The mac80211 subsystem moves all aspects of master mode into user space. It depends on hostapd to handle authenticating clients, setting encryption keys, establishing key rotation policy, and other aspects of the wireless infrastructure. Due to this, the old method of issuing 'iwconfig <wireless interface> mode master' no longer works. Userspace programs like hostapd now use netlink (the nl80211 driver) to create a master mode interface for your traffic and a monitor mode interface for receiving and transmitting management frames.

Getting hostapd

Using your distributions hostapd

It is advisable to try your distributions version of hostapd before taking the time to compile and install your own copy. This will make future maintenance easier as you'll be able to use the init scripts shipped by the distro and hostapd will be updated by it as well. If your distribution ships 0.6.8 or later, you can test with this bare minimum hostapd.conf:

interface=wlan0 #change this to your wireless device
driver=nl80211
ssid=test

If that config errors out with something like:

hostapd $ sudo hostapd ./hostapd.conf
Configuration file: ./hostapd.conf
Line 2: invalid/unknown driver 'nl80211'
1 errors found in configuration file './hostapd.conf'

that means that your distro is not shipping hostapd with nl80211 driver support and you'll need to follow the building instructions that follow. If it works, you can skip down to the configuring hostapd section. If not, continue on.

Download and compile hostapd

Using hostapd with nl80211 requires you to have at least libnl-1.0 pre8 as this release introduced genl, Generic Netlink, which nl80211 relies on. Most distributions are shipping this or a later release by now.

Throughout this section, versions will be referred to by: x.y.z

ex: hostapd-0.6.8.tar.gz would be referred to as hostapd-x.y.z.tar.gz

You can get the latest development version of hostapd from the git repository with:

git clone git://w1.fi/srv/git/hostap.git
cd hostap/hostapd

Or you can get a stable release (0.6.8 or later reccomended) by downloading the tarball from http://w1.fi/hostapd/.

wget http://w1.fi/releases/hostapd-x.y.z.tar.gz
tar xzvf hostapd-x.y.z.tar.gz
cd hostapd-x.y.z

Next, we need to configure the hostapd build to enable nl80211 driver support. Copy defconfig to .config, and open it in your preferred text editor. Also, there are other options that you may want to enable, like 802.11n support if your hardware can do it. Most of the other encryption types and features aren't needed for most applications, so if you're questioning if you need to enable it, you probably don't need to.

cp defconfig .config
vi .config

Now find this line:

#CONFIG_DRIVER_NL80211=y

and uncomment it by removing the '#' sign. Repeat for other settings that you may be interested in. The basic configuration, with only this line uncommented is enough to get hostapd up and running with WPA/WPA2 authentication and encryption.

Next, compile hostapd:

make

if this fails with errors like:

driver_nl80211.c:21:31: warning: netlink/genl/genl.h: No such file or directory
driver_nl80211.c:22:33: warning: netlink/genl/family.h: No such file or directory
driver_nl80211.c:23:31: warning: netlink/genl/ctrl.h: No such file or directory
driver_nl80211.c:24:25: warning: netlink/msg.h: No such file or directory
driver_nl80211.c:25:26: warning: netlink/attr.h: No such file or directory

you need to install/update libnl-1.0pre8 (or later). If all goes well and the compilation finishes, try the minimal hostapd again. I'd recommend creating a seperate hostapd.conf file with this configuration in it called hostapd-minimal.conf, for testing use.

hostapd # ./hostapd ./hostapd-minimal.conf
Configuration file: ./hostapd-minimal.conf
Using interface wlan1 with hwaddr 00:0d:0b:cf:04:40 and ssid 'test'

If that starts as the example here shows, you can move on to configuring hostapd. If it fails to start with errors about the driver not being found, review the steps listed above for compiling hostapd again.

Configuring hostapd


This is a static dump of the wiki, taken after locking it in January 2015. The new wiki is at https://wireless.wiki.kernel.org/.
versions of this page: last, v37, v36, v35, v34, v33, v32, v31, v30, v29, v28, v27, v26, v25, v24, v23, v22, v21, v20, v19, v18, v17, v16, v15, v14, v13, v12, v11, v10, v9, v8, v7, v6, v5, v4, v3, v2, v1