Building a Kirkwood Based 802.11n Wireless Access Point on Debian Wheezy

For some time now I’ve been meaning to use one of my cheaply acquired Seagate Dockstars as a replacement for three or four of the miscellaneous OpenWrt based boards I use around my home for wireless, gateway routing (NAT), vpn to my work (OpenVPN) and some other functions such as my home control box. I’m somewhat partial to using a Dockstar board for this, but these steps should work equally well on the Pogo E02 and any similar Kirkwood based device. Just be sure you put the right bootloader on or you could brick your board. You’ve been warned, don’t blame me, blah blah… The first link in this chain is building a wifi access point using a USB based radio and hostapd. I had no idea how non-trivial this would end up being, but after reading and attempting to follow some of the other online guides google found for me, I wanted to keep track of this as a backup to my own very poor memory, and to share with anyone aiming to achieve the same.

Step one seems to be completely unlrelated to much of the technology I’m most worried about. It appears that the wireless device driver required to use hostapd with a usb wifi radio requires the 3.0 kernel tree. Enter the custom uBoot I’ve been running on my Pogoplugs. Evidently an issue arose somewhere around the 3.2.x kernel tree with how this bootloader initialized the CPU cache. So go here and follow the instructions to update your bootloader. It so happened that this post also helped me to get Jeff’s recovery OS flashed on my Dockstar’s nand flash. Cool, thanks Jeff!

Step two, installing Debian Wheezy. Some time ago I found this page describing a Wheezy install script based on Jeff Doozan’s initial debootstrap work. After some fiddling I figured out that Wheezy is officially named “Testing” at this point. I also had to do some prodding to find the current kernel version. Here’s the resultant script as of 3/26/2012.

dockstar.debian-wheezy-cust

This ran for about two hours, so pack a lunch. When it finally finished, I ended up with:

root@debian:~# cat /etc/debian_version
wheezy/sid
root@debian:~# uname -a
Linux debian 3.2.0-2-kirkwood #1 Mon Mar 5 17:06:08 UTC 2012 armv5tel GNU/Linux

Before I get ahead of myself, it’s usually a good idea to enable the following option in /etc/default/rcS so the filesystem is automatically fixed whenever possible (i.e. after you reboot using the reset button).

# automatically repair filesystems with inconsistencies during boot
FSCKFIX=yes

I went ahead and added the necessary dependencies as well as a couple personal preferences such as byobu and the grown up version of vim to the ‘EXTRA_PACKAGES’ variable in the aforementioned script. But if you’re building this on your own here’s the bare minimum requried for a WPA2/PSK access point.

apt-get install wpasupplicant hostapd bridge-utils wireless-tools usbutils

Next, we need to configure a bridge so that it’s created by /etc/init.d/network starting up. Normally, I use the bridge as the configured interface, and leave eth0 and wlan0 set to manual configuration so they don’t directly have an address bound to them. The following /etc/network/interfaces file will facilitate a static address on br0 and bridge to the onboard eth0 port.

auto lo
iface lo inet loopback

auto eth0
auto wlan0

auto br0
iface br0 inet static
bridge_ports eth0
address 192.168.1.1
network 192.168.1.0
gateway 192.168.1.255
netmask 255.255.255.0
broadcast 192.168.1.255

Once I get around to configuring a second USB ethernet adapter for the WAN side of my router, this will require some changes. But for now I’m focusing on making the wireless access point functional.

Now you’ll want to connect your wireless radio, and install the requisite firmware. The guide at forum.doozan.com shows how to install an older version that may not be available, but at the time of this writing the firmware I needed for my TP-Link TL-WN722N was installed thusly.

wget http://ftp.us.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-atheros_0.35_all.deb
dpkg -i firmware-atheros_0.35_all.deb

Now we need to setup the hostapd.conf file located at /etc/hostapd/hostapd.conf. The following are some default values, you will want to tailor them to your personal preferences / configuration.

interface=wlan0
bridge=br0
driver=nl80211
hw_mode=g
ieee80211n=1
ht_capab=[HT40-][SHORT-GI-40][DSSS_CCK-40]
wmm_enabled=1
channel=11
country_code=US
ssid=AirDebian
auth_algs=1
wpa=2
wpa_passphrase=passw0rd
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
macaddr_acl=0
ignore_broadcast_ssid=1
# needed for winblows clients…
eapol_key_index_workaround=0
eap_server=0
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0

I will update this as I do more experimentation with fine-tuning wifi throughput. But this is by no means the best or even the minimum configuration needed. Go to linuxwireless.org and do your own research. It’s information well worth knowing.

To test this config file, the simplest method I’ve found is to run hostapd from the command prompt without daemonizing it. It’s a good idea to do this so you get direct feedback on your hostapd.conf syntax. Unless you’re like me and everything you do is perfect from beginning to end. 😉

root@debian:~# hostapd -d /etc/hostapd/hostapd.conf

At this point you should see a wealth of information about what hostapd is doing – most importantly bringing up the wlan0 interface, configuring it in master mode and adding it to the bridge br0 we created earlier. If everything is good you should be able to connect with wireless stations and if you have a dhcp server up on your existing network you’ll be talking in bits and bytes. Don’t skip to the last step until you’ve been able do so.

Lastly, for some strange reason no default config file was specified in the startup script deployed by the hostapd package. This is simple – edit /etc/init.d/hostapd and edit the following line to reflect your config file.

DAEMON_CONF=/etc/hostapd/hostapd.conf

At this point, you should be able to reboot your Kirkwood based device and have an active and functional wireless access point.

This entry was posted in Seagate Dockstar. Bookmark the permalink.

Comments are closed.