If I have only 1 physical WLAN interface, is there some hackery that can be done so that it can be a client of an existing access point and at the same time also act as an access point for other clients?

I have an existing 802.11g ADSL router, and I'm going to be building an HTPC which will have 802.11n. My laptop also has 802.11n, but at the moment it only connects at 54Mbps because thats what the AP supports. I'd like to be able to have the HTPC be a client of my ADSL router, but have my laptop be a client of the HTPC, so copying files to it will be faster.


Edit: obviously I can connect the HTPC to the ADSL router using Ethernet and disable wifi on the router, but lets just ignore that option. :-)


I haven't done this before personally, but here's some information to get you headed in the right direction.

From a protocol perspective, it's definitely possible to have a single radio working as both an AP and a client STA. It works out best (or perhaps is nearly mandatory) if the AP you're creating and the one you're joining as a client are on the same channel. Having the radio card have to keep switching channels to service requests is a recipe for lost frames and terrible performance.

Software-wise, it's becoming possible. Several 802.11 card drivers on Linux support the concept of VAPs (virtual APs) which allows a single card to act as multiple APs (multiple SSIDs, even BSSIDs) at the same time. Counterintuitively, the term VAP has come to mean any kind of virtual interfaces on the same 802.11 card, regardless of whether the virtual interface is in AP mode or not. So on these card/driver combos, you could create two VAPs -- a STA-mode VAP

The MadWifi driver for Atheros-based cards is one that supports VAPs. If your 802.11 card uses an Atheros chipset, and you install the right version of the MadWifi driver, you might be able to configure your card for simultaneous STA + AP mode something like this:

wlanconfig ath0 create wlandev wifi0 wlanmode sta
wlanconfig ath1 create wlandev wifi0 wlanmode ap

Note that these are not complete instructions for setting everything up, but just an attempt to get you started.

You might want to Google for something like "wifi vap" for more information. I copied the above commands from here.

Oh, and some myth busting: Atheros cards are not uncommon in consumer machines. They're a major player in 802.11 chipsets, along with Broadcom, Marvell, Intel, and Ralink. And just because I used the example of MadWifi/Atheros, doesn't mean there aren't Linux drivers for the other major players' chips that can do a similar thing. Also, 802.11s is not required for this. Saying you have to do 802.11s to do this is like saying you have to support Spanning Tree Protocol just to forward frames from one interface to another.

  • It looks as if the board I'm getting does have an Atheros chipset, so I might be in luck. I'm waiting for delivery of my components then I can build and test. – ThatGraemeGuy Jun 29 '10 at 8:04
  • I haven't had a chance to play with MadWifi yet. I'm accepting because the answer is correct, there seems to be no other chipset/family which offers this functionality. – ThatGraemeGuy Jul 27 '10 at 8:56
  • Spiff, I have am working with a Atheros chip and madwifi and I am trying to set up VAPs one in sta and one in ap. I am able to set up multiple VAPs in ap mode but when I set up the first VAP in sta and then try setting up another VAP in ap I get wlanconfig: ioctl: Input/output error. Do you have any idea as to how to deal with this? – sachinr Sep 23 '13 at 10:18
  • 1
    @sachinr Ask that as a Question so everyone sees it, not just a comment on a three year old Answer to someone else's Question. – Spiff Sep 23 '13 at 14:42
  • Hey I added my question here - superuser.com/questions/649742/…. Can you have a look? Thanks :) – sachinr Sep 24 '13 at 16:44

The nl80211 driver has something called the "managed" interface mode. You can configure it using the "iw" utility like so:

iw phy phy0 interface add wlan1 type managed

More info on this is available at https://wireless.wiki.kernel.org/en/users/documentation/iw. Phy0 refers to what you see in /sys/class/ieee80211/.

I've also seen the rPI3 do something similar, but with a more shady "__ap" interface mode. That way the user creates a second interface that only runs in AP mode, and uses the initial interface as client mode.

Whatever way you realize it (the driver obviously has to support it), you'll need two interfaces (from the same physical device). One interface can simply run wpa_supplicant as client mode, the other (AP mode) typically uses hostapd to play accesspoint.


The source code of the iw tool makes a lot clear about the shady __ap mode:

} else if (strcmp(tpstr, "__ap") == 0) {
    *type = NL80211_IFTYPE_AP;
    return 0;
} else if (strcmp(tpstr, "__ap_vlan") == 0) {
    *type = NL80211_IFTYPE_AP_VLAN;
    return 0;
} else if (strcmp(tpstr, "wds") == 0) {
    *type = NL80211_IFTYPE_WDS;
    return 0;
} else if (strcmp(tpstr, "managed") == 0 ||
       strcmp(tpstr, "mgd") == 0 ||
       strcmp(tpstr, "station") == 0) {
    *type = NL80211_IFTYPE_STATION;
    return 0;

The __ap mode translates to a netlink type NL80211_IFTYPE_AP. I also tested this, and this works fine. Strange that the kernel documentation wiki does not metion it though.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.