Welcome! Log In Create A New Profile

Advanced

How To: Create an 802.11n AP (Access Point) w/ Debian on a Dockstar/Pogoplug/kirkwood device

Posted by davygravy 
When you insert the USB adapter in the device, wait a moment and then ... run
dmesg | grep ath
lsusb
... post back with the results and I can try to help you troubleshoot it...

=====================================================
root@debian:~# dmesg | grep ath
[ 49.644153] usb 1-1.3: ath9k_htc: Firmware - htc_9271.fw not found
[ 49.650381] ath9k_htc: probe of 1-1.3:1.0 failed with error -22
[ 49.664942] usbcore: registered new interface driver ath9k_htc


root@debian:~# lsusb
Bus 001 Device 004: ID 0cf3:9271 Atheros Communications, Inc. AR9271 802.11n
Bus 001 Device 003: ID 0781:5530 SanDisk Corp. Cruzer
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Ok thats a pretty good error measage. I am going to research that some!

After researching this is what i came up with!

Well researching is always good when you have an idea what to look for!
The fix I am using right now is to download and copy the missing firmware

wget http://linuxwireless.org/download/htc_fw/1.3/htc_9271.fw

cp htc_9271.fw /lib/firmware

replug wifi card and then

/etc/init.d/networking restart

reboot

Now all seems to be working correctly



Edited 2 time(s). Last edit at 02/12/2012 04:04PM by leapole.
great!

=====================================================
very nice howto davygravy, though some thoughts:

1) this may apply to the hardware you are using, but in general, not every other hardware - even though technically supported via driver - can achieve highspeed n-Wlan (drivers seem to be extreme buggy) - also adding all features the phy0 suggests ist not always good. In other words: you may even get faster speeds when only enabling g-Mode

2) since you are bridging the interfaces anyway, you don't need to specify them prior. Also (and this also may vary from driver to driver), since you are already manually bridging them via interfaces.conf, you don't (or in may case even shouldn't) need to specify "brdige=br0" in hostapd.conf.

for instance my interfaces.conf looks like this and works fine, too (server acts as router/gateway) - notice the "pre-up hostapd", so that bridging will work, as wlan0 gets up before system tries to bridge the two interfaces..

# LOOPBACK
auto lo
iface lo inet loopback

# iNTERNET
allow-hotplug eth1
auto eth1
iface eth1 inet dhcp

# LAN
allow-hotplug eth0

# BRiDGE / WLAN
auto br0
iface br0 inet static
	bridge_ports eth0 wlan0
	address 192.168.2.1
	network 192.168.2.0
	netmask 255.255.255.0
	broadcast 192.168.2.255
	pre-up /usr/sbin/hostapd -B /etc/hostapd/hostapd.conf
	pre-down /usr/bin/killall hostapd
	post-up /etc/network/firewall
Hi Guenter,

thanks... My opinions are colored by my experiences, I respect you and value your comments, nevertheless. I feel like I must disagree w/ you on both of those points, to some extent. Here is why:

1) I've tested it in just about every mode I could. The current n mode that I have it set for give me the best speed I was able to attain - on par with my Asus RT-N16. Running it in g mode simply gave me lower throughput, lower performance.

2) It works here ... as you say it varies from driver to driver... bottom line is that it works here. I have had only one crash/panic since mine has been up and running - and that was caused by another piece of software.


I can't try your config right now (busy w/ other projects...) but would like to, in the future.

=====================================================
Thanks, this worked like a charm! :-)

Gonna see if I can setup hostapd for wds and use a pair of dockstars to replace my old wrt54gl based bridge.
At my workplace, it is an NAS (AFP and SAMBA), a TimeCapsule (for Apple TimeMachine backups), a wireless bridge, and a media server...

I never tried WDS with it... I don't know whether that is supported, or if it works... please let us know back here if it does work for you.

=====================================================
First a measurement: iperf (do your tests with --parallel 4) achieved over 80 Mbit/s between two dockstars with TL-WN821N v3 interfaces (one in master mode, the other in managed mode, wpa-psk, txpower=20, no bridging at all).

Let me explain what I'm trying to do. I should'nt have used the word "bridge" in my previous post, because I didn't mean it as in "interfaces bridged by brctl". I'm trying to establish a permanent wireless link between two dockstars, with several hosts at each end of the link.

host1 --+                                             +-- host4
        |                                             |
host2 --+-- dockstar1 - - - - - - - - - - dockstar2 --+-- host5
        |     (AP)       wireless link     (client)   |
host3 --+                                             +-- host6

Gotta love some ascii art. :-)

This has been my setup for a few years, except that I'm using two wrt54gl's (running dd-wrt) instead of dockstars.

When I first tried this with the wrt's, I did setup one as an AP, and the other as a "bridged client".
It kind of works, and I've been going that way for a few months, until I got aware of an issue about wireless packets headers: wireless headers usually contain 3 addresses (MACs of the destination host, and of the two endpoints of the wireless link, i.e. the wrt's). To run that setup properly, a fourth MAC in the header is necessary: the address of the source host.

As a consequence, for a host on one side of the link, all the hosts on the other side are seen with the same MAC address, that of the opposite wireless endpoint. (=> seen from host2, hosts 4 5 and 6 are seen with the MAC of one of the wrt's). Hence, the ARP tables (which associate MACs to IPs) of the hosts are just wrong. Practically, it won't matter for most usages, but I eventually ran into blocking issues. (I'm afraid I can't remember exactly which. Anyway, keeping fscked up ARP tables was a no go for me.)

Still using wrt's, the solution was to setup both ends of the wireless link as WDS access points. WDS is a kind of meshed networking mode that has the particularity of using wireless packets headers with *four* addresses. With the wrt's running WDS, hosts from the opposite side are seen with their own MACs, ARP tables are correct, and Mr network nerd is happy.

And now for something completely different: let's try to use dockstars instead of wrt's. (yeah, the wrt's in wds currently give me a whooping 13Mbit/s throughput, so I'm a bit drooling over those 80Mbit/s)

According to the information I've been gathering, there are two ways to achieve this:

- setup WDS with hostapd at each end of the wireless link

- keep the usual Master/Managed setup (no actual WDS), but configure each end to send wireless frames with four addresses headers. This looks easier and that's what I'm digging for now.

dockstar1 (AP running hostapd): just add wds_sta=1 to hostapd.conf (yeah, I said no wds, this is a bit confusing but it seems to be the way to go)

dockstar2 (client running wpa_supplicant): issue iw dev wlan0 set 4addr on *before* adding wlan0 to the bridge

After completing those two steps, association and WPA authentication seem to work fine, but I'm still not able to ping between the dockstars. I'm obviously missing something there.

Note 1: I'm pretty sure those configuration snippets acually do something: if I enable wds_sta=1 on the AP but I don't enable 4addr on the client, or if I enable 4addr but not wds_sta, then WPA authentication doesn't work at all.

Note 2: actually, linux won't let you bridge a wireless interface in managed mode at all unless you enable 4addr:
root@lemur2:~# brctl addif br0 wlan0
can't add wlan0 to bridge br0: Operation not supported
root@lemur2:~# iw dev wlan0 set 4addr on
root@lemur2:~# brctl addif br0 wlan0
root@lemur2:~#

I'm still digging. If anyone's already been there, any clue would be most appreciated. I hope I can get back here with a result, as this kind of setup is actually quite useful.

Refs: (search for "hostapd 4addr" or "hostapd wds")
- http://linuxwireless.org/en/users/Documentation/iw#Using_4-address_for_AP_and_client_mode
- http://nullroute.eu.org/~grawity/not-a-blog.html#post:20110826

Edit: this worked for a while with encryption disabled. But it crashed under heavy load. Still digging.



Edited 1 time(s). Last edit at 05/17/2012 07:19AM by lemur.
I think hostapd has a long road to go, because 802.11n do not work properly. In my case, using ralink 3072 chipset in the interface, I only get links of 75Mbps, and if I try to copy a large file (1GB), the bitrate starts at 2MBps, and just keeps dropping until 50KBps, at which I simply stop the file copy (because, I'm not wiling to wait so long).
You may have a setting a bit out of whack, or hardware-ish problem(s). I see this ... consistently...
AP Status	
channel	
 6
tx-power	
 Current Tx-Power=20 dBm  	(100 mW)
clients	
 Station  00:23:4e:xx:xx:xx (on wlan0)
	tx bitrate:	130.0 MBit/s MCS 15

... and after several months uptime, it drops to...
AP Status	
channel	
 6
tx-power	
 Current Tx-Power=20 dBm  	(100 mW)
clients	
 Station  00:23:4e:xx:xx:xx (on wlan0)
	tx bitrate:	130.0 MBit/s MCS 15
ie., mine is really, really, rock solid...

=====================================================



Edited 1 time(s). Last edit at 05/26/2012 07:22AM by davygravy.
@davygravy
Looks like you forgot to edit your MAC the 2nd time.

By the way, thanks for the time you take to write tutorials & answer questions. I've been planing to try a dockstar router / repeater (when I find time). Alfa awus036h RTL8187L as client, Netgear wna1100 AR9271 as AP.



Edited 1 time(s). Last edit at 05/26/2012 04:56AM by Twi.
!!
Doh!!
!!

thanks

=====================================================
Just for the record, I'm no longer recommending that one install Squeeze and then dist-upgrade to Wheezy. Wheezy (now in testing) has some seriously broken components and things like CUPS are not working at all.

You may need to pull in cdra and wireless-regdb from Squeeze-Backports.

=====================================================



Edited 1 time(s). Last edit at 08/24/2012 06:33PM by davygravy.
Jerry McBride
Making my Pirate Box just got easier!
November 01, 2012 07:44PM
Great tutorial. Used it as a frame work to make my Dell Mini 9 into a WAP and then into a Pirate Box for public access wherever I go.

I've never had so much fun.


http://wiki.daviddarts.com/PirateBox
Re: Making my Pirate Box just got easier!
November 01, 2012 08:14PM
Cool!

=====================================================
How do you do this if you already have one wifi adapter (wlan0), one wired adapter handling the internal network(eth1) and a wired adapter the modem is plugged into(eth0)?
Thanks for the detailed how-to, especially the precise identification of the sub-model of the wifi cards that allowed me to buy the correct one!
I was really looking for something reliable for my home wifi, but unfortunately it does not work as expected: it works for "some time", but after few hours client can't connect anymore, for unknown reason (no errors from hostapd and no error from the log).
The ssid (hidden, that is the only difference with your proposed config) is still visible from another host with iwconfig wlan0 scan.
While it is working, the link is stable and works fine.
Debian squeeze, but with a more recent kernel (3.2.38) and hostapd 1.0.
TL-WN822N Ver:2.0 (yes the wifi range of this model is really nice as you pointed out!)
The only think I suspected was heating of the wifi device, but just unloading the kernel module and restarting hostapd, without even the need of unplugging, restores normal operation, so I am really lost!

Any suggestions? (I realy want something reliable for my parents, when I am not at home, so I need something that works 24/7)

Luca
what's about TP-Link TL-WN821N with RTL8192CU chipset?



Edited 1 time(s). Last edit at 04/23/2013 10:04PM by bambo.
Wireless jamming technology is not just used in military. we can have easy access to wholesale jammer, gps wifi jammer as well as bug wireless jammer etc from online store, which can be used to protect individual privacy as well as business confidential info.
Re: Making my Pirate Box just got easier!
May 22, 2014 12:45AM
I ever meet such problem before, after the high recommendation of one of my good friends, I got a cellular booster, everything is OK now. You can have a try!
dmesg | grep ath
[ 7.974763] usb 2-1.6: ath9k_htc: Transferred FW: htc_9271.fw, size: 51272
[ 8.209289] ath9k_htc 2-1.6:1.0: ath9k_htc: HTC initialized with 33 credits
[ 8.399169] ath9k_htc 2-1.6:1.0: ath9k_htc: FW Version: 1.3
[ 8.399173] ath: EEPROM regdomain: 0x809c
[ 8.399175] ath: EEPROM indicates we should expect a country code
[ 8.399178] ath: doing EEPROM country->regdmn map search
[ 8.399188] ath: country maps to regdmn code: 0x52
[ 8.399190] ath: Country alpha2 being used: CN
[ 8.399192] ath: Regpair used: 0x52
[ 8.717011] Registered led device: ath9k_htc-phy0
[ 8.717014] usb 2-1.6: ath9k_htc: USB layer initialized
[ 8.717033] usbcore: registered new interface driver ath9k_htc


lsusb

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 046d:c31d Logitech, Inc.
Bus 002 Device 003: ID 0cf3:9271 Atheros Communications, Inc. AR9271 802.11n
This thread is almost 4 years old but I wanted to let folks know I used the instructions recently verbatim to get hostapd working on a P01 running bodhi's latest Debian rootfs (3.18.5). For my plug, I replaced the RT3090 with an Atheros AR9485 card and it works fine in AP mode. I also installed Webmin so I could change the SSID and passphrase using a third party module which is available through the Webmin module admin area. Total investment was $20 and I also use the plug as a Squeezelite / Shairport client with a Sabrent USB audio adapter.



Edited 1 time(s). Last edit at 04/03/2015 09:26AM by LeggoMyEggo.
@leggo
do you have the link to that module?
Gravelrash Wrote:
-------------------------------------------------------
> @leggo
> do you have the link to that module?

I've tried:
Atheros AR5B93
and
Atheros AR5B225

Both worked in AP mode as is required by hostapd. Still haven't gotten BT to work on the AR5B225 but it's not suprising because it's a hybrid implementation of BT.

Edit: I just realized by module you meant Webmin for hostapd, it's either in the main Webmin repository or third party repository if you search for hostapd.



Edited 1 time(s). Last edit at 04/23/2015 01:35PM by LeggoMyEggo.
Thanks Lego - yep i did mean the webmin module,

My bad i should have been more obvious in my request.... most request around modules on this site are kernel modules after all
I think I'm gonna try combining the hostapd / Webmin install with OpenMediaVault and see how it goes. That would make a nice handy AP with pretty comprehensive file access. I would boot off of the USB flash drive and use the SATA port for faster disk access on a larger drive to archive stuff. And I would still have the USB audio adapter included so I could stream to a set of speakers from my Squeezebox server.

Edit: Link to OpenMediaVault install as updated by Almaz: OMV on Pogoplug
OMV homepage: http://www.openmediavault.org/



Edited 2 time(s). Last edit at 04/23/2015 04:18PM by LeggoMyEggo.
@Lego you have just described something on my todo list..........

Do need a crash test dummy box again?
LeggoMyEggo Wrote:
-------------------------------------------------------
> I think I'm gonna try combining the hostapd /
> Webmin install with OpenMediaVault and see how it
> goes. That would make a nice handy AP with pretty
> comprehensive file access.

It actually worked! I had some issues with hostapd starting but after I copied my /etc/network/interfaces and /etc/hostapd/hostapd.conf file from a known working hostapd flash drive and rebooted, everything was good. So now I have OMV, hostapd, Webmin and Shairport all running off the Pro / V3. Gonna see how a simple RAID array goes and will report back....................



Edited 1 time(s). Last edit at 04/24/2015 08:35PM by LeggoMyEggo.
@Leggo

When you get all this working - particularly with the raid config, would you be willing to do a "howto writeup" which also details the hardware you have used? I think this will be of particular interest to a LOT of people
Gravelrash Wrote:
-------------------------------------------------------
> @Leggo
>
> When you get all this working - particularly with
> the raid config, would you be willing to do a
> "howto writeup" which also details the hardware
> you have used? I think this will be of particular
> interest to a LOT of people

Not so good at documenting my steps so I might not be the best tutorial guy. But hey at least people know it works, right?
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: