Saturday, 24 February 2018

Can a Linux machine act as both a wireless client and access point simultaneously using a single physical WLAN interface?


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.


Possible?


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. :-)



Answer



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.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...