6

Is it possible for a single (802.11 b,g,n,ac) WIFI radio to act as both an Access Point and Access Point client simultaneously - if so how, and are there examples of software that allow this (I'm particularly interested in Linux, but any OS that does it would evidence it can be done, and thus valuable to me). If not, why not?

For the sake of clarity, I'm not talking about a radio acting as either one or the other, and switching roles at different times, nor am I talking about 2 radios on different frequencies doing different jobs. I'm also not interested in ad-hoc mode unless this can be leveraged to appear as an AP and AP client to other AP's and AP clients respectively.

davidgo
  • 73,366

3 Answers3

6

Yes, it can be done (depending on Wi-Fi device capabilities). I believe "Wi-Fi Direct" turns it into an official feature (e.g. a TV simultaneously acting as a station on the home network, and as access point for direct video transfer), but it's also possible to have just a regular AP.

Clueless attempt at explanation

As far as I know, the physical radio behaves the same whether it's an AP or a station – at least in "simpler" modes like 802.11b/g/n (perhaps it's more complex in 802.11ac). That is, it does not need to switch between incompatible "AP" and "STA" behaviors.

Instead it just sends different kinds of frames. If the firmware allows it, then it can freely send "AP-like" and "STA-like" frames at the same time. This is especially true for "SoftMAC" devices, which (unlike "FullMAC" ones) defer most of the control to the OS and drivers.

Configuring it in practice

I don't really know how it works; I'm just writing the post because I have tested it on my own hardware.

  • For example, here's what iw phy says about an Atheros ath9k series adapter. (It's several years old, 2.4 GHz only, but is a "SoftMAC" device – meaning that the driver handles everything and is free to do a lot of weird stuff.)

    valid interface combinations:
             * #{ managed } <= 2048, #{ AP, mesh point } <= 8, #{ P2P-client, P2P-GO } <= 1,
               total <= 2048, #channels <= 1, STA/AP BI must match
             * #{ WDS } <= 2048,
               total <= 2048, #channels <= 1, STA/AP BI must match
    

    Each * line is a single combination list. So I can associate to 2000 networks as a station and host 8 networks as an AP; of course they must all remain on a single channel (#channels <= 1).[1]

  • Similarly, here's an Intel "Wireless 3160" adapter. Since it supports 802.11ac, it does a lot more work in the firmware (i.e. is a "FullMAC" device) and therefore is constrained by what the firmware can do.[2]

    valid interface combinations:
             * #{ managed } <= 1, #{ AP, P2P-client, P2P-GO } <= 1, #{ P2P-device } <= 1,
               total <= 3, #channels <= 2
    

    So, since the modes are now firmware-based rather than driver-based, you can only have one of each – but you can still be a station and an AP.

    It also says #channels <= 2 – not just because it's dual-band, but because it can even work on two same band channels. I believe they've made it possible because Wi-Fi Direct requires it – in my tests on 2.4 GHz band, if I use different channels, my phone shows a "[P2P]" marker next to the laptop's SSID. If I use the same channel, the phone just shows a regular AP.

As for how to configure it:

  1. First, use iw to add a new virtual device on top of the same "phy" (physical adapter). By default your adapter is phy0, and has one network interface wlan0. So add a second one:

    iw phy phy0 interface add wlan1 type __ap                 # [sic]
    

    If you want to host a network, normally you'd use type managed and expect hostapd to switch the interface to AP mode, but for some reason that doesn't happen when multiple interfaces exist. So instead you may have to pre-create it in AP mode directly.

  2. Second, just configure hostapd to use that interface as you normally would.


1 (The "BI must match" restriction is explained here.) 2 (Still better than some Realtek or Broadcom devices, which don't even support AP mode at all!)

grawity
  • 501,077
3

Modes of operation

The access point, providing WiFi is usually called AP, while the client is called STA.

It's possible to configure your device as a repeater or as something I will call a wireless-wireless router, since I can't find a consensual name.

  • The repeater will bridge (transmit all Ethernet packets between STA and AP sides), using the existing network infrastructure for DHCP, routing, ...
  • The wireless-wireless router will route selected packets between the STA and the AP side, providing DHCP and NAT.

The wireless-wireless router will need more configuration, but will only transmit packet as needed.

Hardware compatibility

Some wireless adapter are not able to use STA and AP mode at the same time (some adapters even can't serve as AP).

If you've got an adapter at hand, iw list can be used to establish if it is able to do act as an client and access point at the same time. As said in this question, you must look for the valid interface combinations part of the iw list command.

About the single 802.11 a/b/g/ac radio

Since 802.11 b/g/n uses 2.4 GHz and 802.11 a/ac uses 5 GHz, the adapter will need at least 2 phy, and will probably need to be configured as 2 separate access point, from the Linux point of view.

About the software

They are plenty of dedicated Linux distribution targeting small computers and WiFi routers, here are some examples:

All the previously listed distributions have their own flag on superuser.

About the WRT name

Interestingly, a lot of router-targeted Linux distributions contain the WRT word, since they started as an alternative firmware for the venerable LinkSys WRT54G.

pim
  • 802
2

I always find the Arch Linux Wiki a good source. There‘s also a section „Wireless client and software AP with a single Wi-Fi device“.