ArchLinux – Setup TL-WN725N Access Point with Hostapd

arch linuxhostapdwireless-access-pointwireless-networking

I bought a TL-WN725N v2 wifi usb dongle for my Raspberry.

Amazon read it would work out of the box but it didn't. So I followed several tutorials to have the driver working.

Now the problem is to make it work as an Access Point.

Here is my hostapd.conf file :

interface=wlan0
ssid=Your_AP_SSI
channel=1
## WPA and WPA2 configuration
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
## WPA settings
wpa=2
wpa_passphrase=my_secret_pass
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
## Hardware configuration
#driver=rtl871xdrv
driver=nl80211
ieee80211n=1
hw_mode=g

When I launch hostapd hostapd.conf it reads :

Configuration file: hostapd.conf
nl80211: Driver does not support authentication/association or connect commands
nl80211 driver initialization failed.
hostapd_free_hapd_data: Interface wlan0 wasn't started

Any ideas ?

Thx a lot !

Best Answer

Not all wifi cards, whether USB or not, can act as AP. From the look of it, it seems yours can't.

The way to find out is to issue the command

  iw list

which will have a long and really comprehensive output, where you should search for the following section:

  Supported interface modes:
             * IBSS
             * managed
             * AP
             * AP/VLAN
             * monitor
    software interface modes (can always be added):
             * AP/VLAN
             * monitor
    valid interface combinations:
             * #{ managed } <= 1, #{ AP } <= 1,
               total <= 2, #channels <= 1, STA/AP BI must match
             * #{ managed } <= 2,
               total <= 2, #channels <= 1

This is for my card, which shows the critical line: Supported interface modes: AP. As you can see, there follow also restrictions, under the heading valid interface combinations. In this special case, it means that I can use this card simultaneously in managed and AP mode, provided the two use the same channel. Which means I can set up an AP through hostapd, while I use a wifi connection to forward hostapd traffic to the Internet.

You ought to make the same check for your card.

If furthermore you wish to find out which USB adaptor can be put into AP mode, I am afraid there is no really authoritative list, mostly because of the manufacturers: for instance this Ubuntu help page states:

Be careful when buying a card for this project: - WLAN cards documented as Linux-supported often become no longer available. As a common cost-cutting measure, wireless adapter manufacturers will revise an existing product's specifications, substituting a different chipset (or other components) without changing the (formerly Linux-compatible product's) model number. Naturally, this is a common source of confusion for individuals attempting to purchase a compatible adapter, even when they think they know which adapter to buy. Manufacturers don't help matters much, often using strange naming conventions that produce numerous confusingly similar model names and numbers. Consider: At one point D-Link offered 3 different revisions (with 3 different chipsets) of its DWL-520 adapter, as well as the (completely different) DWL-520+, which was not to be confused with the entirely unrelated DWL-G520, DWL-A520, not to mention the 8 varieties of product offered under the "DWL-620" moniker. Thus it is crucially important to pay close attention not just to manufacturer/model names, but also revision numbers (if provided), chipsets, included drivers, etc, as well. (If uncertain, consider purchasing from a retailer who offers a "consumer friendly" return policy, so the product can be returned/exchanged if it turns out to be incompatible.)

After this major disclaimer, I will just say that http://www.thinkpenguin.com/ and http://linuxwireless.org/ provide lists of AP-capable adapters, and that Atheros products are often AP-capable. I regret I cannot be any more precise.

EDIT:

I have done a bit of research, and I have found out that there actually are two versions of the TP-WN725N USB adapter. v1 has Vendor code 0bda and product code 8176 https://wikidevi.com/wiki/TP-LINK_TL-WN725N_v1, while v2 has 0bda:8179 https://wikidevi.com/wiki/TP-LINK_TL-WN725N_v2. These codes, though not accessible through lspci, can be seen from the output of lsusb. You can then distinguish between the two.

Now it is important to learn which driver you are using. Since you do not have lshw (I normally run Arch, but on my Raspberry I installed raspbian, that's why...), the only way to establish which driver you are running is to do:

  lsmod | grep rtl 

It should be rtl8188cu for v1, but if you have v2 the above-referenced WikiDevi page says that there is a special, pre-compiled binary driver for the Raspberry which is located here. If you have v2, you should definitely use this.

For v1, I found this online guide, for v2 instead I found this.

One thing to check is whether you have the nl80211 driver available on your system; normally you should, but just to check, the file to be searched is mac80211.

I hope this will give you enough info to narrow down your problem.

Related Question