Setting up an Atheros-based AP Using ath5k and hostapd

For those who didn't know, I used to have a setup that included an Atheros-based Access Point using Debian and madwifi's driver, which actually worked pretty good. But recently I changed my Debian installation to Squeeze, and soon I noticed something was very wrong with my access point setup. The reason everything was chaos was that madwifi's packages have been removed from the repositories (oh, I can hear you Debian flamers ;) read on, this post is for you all), so on I went to find a way to setup an atheros-based access point on Debian Squeeze.

I found a couple of tutorials that deal with hostap and ath5k and I frankly didn't understand most of them, so I'll try to make this post as clear as possible.

First of all, hostap is a project that ports everything related to the always problematic master mode to userspace (in plain English, it simplifies lots of crap) and it works through a driver that works through your wireless driver (got that?). It can work with a wide variety of drivers (including madwifi) and, in particular, it works with ath5k for many Atheros chipsets, including mine.

Then ath5k is one of the many drivers for Atheros chipsets, which are probably the best chipsets out there when it comes to GNU/Linux compatibility; that is, you can always trust your Atheros-based wireless card will work like a charm using any of the many drivers available for them, regardless of what particular chipset your wireless card is using. That is obviously because Atheros decided to give out the specifications. The differenced between this driver and madwifi is that it is free (as in free speech), because it doesn't have the proprietary Hardware Abstraction Layer that madwifi has (the reason why it was kept at the non-free repositories in Debian), so even though I could still compile madwifi's source code for my own setup, I prefer to spend some time finding how to free my wireless setup so that this can help people out there in the same situation (or give them a reason and an easy way to change).

So finally, here's the setup:  If you are moving from an old madwifi installation, remove the driver you use (e.g., rmmod ath_pci, in case your wireless card is a PCI one) then remove blacklist all of the madwifi drivers through a file in /etc/modprobe.d/ (you probably already have an /etc/modprobe.d/madwifi file that lists all of the madwifi drivers that should be blacklisted in case you want to move out from them) then load ath5k (modprobe ath5k) which is surely going to be in your kernel (provided that you have a kernel which is recent enough) since the driver is already part of the main tree.

Next, install hostapd with apt-get install hostapd. After that, you will not have a configuration file for your hostapd, so you'll need to create one (suggested location is /etc/hostapd/hostapd.conf). Contents for a simple open network could be:

interface=<your interface name, e.g. wlan0>
ssid=<your ssid, e.g. MyHomeWireless>

Some of the configuration variables are quite self-explaining, but some other deserve special attention: auth_algs=1 means Open System Authentication, while channel=1 specifies in which channel should the wireless card operate, and there's a large discussion about channels in this link. The ignore_broadcast_ssid=0 is important to allow other computers to pair to with your access point and wpa=0 means no WPA protocol will be used.

Finally, you must tell the startup script that you have a configuration file that should be used to configure the hostap daemon. You do that by adding a value to the DAEMON_CONF variable in /etc/default/hostapd, e.g.


And (re)start your hostap daemon with

/etc/init.d/hostapd restart

And that should be it. There are a lot more tutorials out there on how to configure your hostapd with WPA2 than those on how to configure an open one (for quite obvious reasons), so if you are interested in further improving your security, check those out.

See ya!