Unable to connect to multiple WiFi networks via multiple virtual interfaces

4

2

My laptop have an atheros WiFi card, I created 2 virtual interfaces on top of it, with following commands:

  • iw dev wlan0 interface add vlan0 type station
  • iw dev wlan0 interface add vlan1 type station

I changed their mac addresses, as:

  • macchanger -e vlan0
  • machhanger -e vlan1

and then I turned them on,:

  • ifconfig vlan0 up
  • ifconfig vlan1 up

I want to connect both these interfaces to 2 different networks. Lets say I have SSID1 and SSID2 broadcast by 2 different APs.

I execute below command to do that:

  • iw dev vlan1 connect SSID1
  • iw dev vlan2 connect SSID2

The problem is, vlan1 is able to connect but vlan2 could not. In order to find an answer I traced the frames in the air, I see when vlan2 is asked to connect it sends probe requests and get probe responses from SSID2 but it never sends association request.

However, if I try to connect both vlan1 and vlan2 to one SSID - SSID1/2 both of them are able to connect and associate.

The question is, why 2 different virtual interfaces are not able to connect to 2 different networks?

Dheryta Jaisinghani

Posted 2015-09-24T14:48:15.583

Reputation: 43

Answers

5

Generally speaking, a single Wi-Fi card only has a single radio, so it can only be tuned to a single channel at a time. Cards that support MIMO (2 or more spatial streams) technically have multiple radios in one sense, but they're ganged together; they're only designed to work as a team, on the same channel.

If the nearest APs publishing the two SSIDs you're interested in are on different channels, then you won't be able to connect to both because your radio can't be tuned to both channels at the same time. Trying to rapidly switch back and forth between channels (known as "Time Division Duplexing" or TDD) is just not a recipe for success; you'd end up missing lots of packets on both networks. Even if your card used 802.11 Power Save mode wisely to ask the APs to queue up packets while the client is on the other channel, the client will probably still miss important multicasts/broadcasts including ARP Requests.

Spiff

Posted 2015-09-24T14:48:15.583

Reputation: 84 656

Right said. I tried to connect to 2 different APs that are operating on same channel and I got success. By this 2 virtual interfaces were on 2 different networks but on same channel. – Dheryta Jaisinghani – 2015-09-25T06:41:59.523

1

You can't connect to two networks from the same PC if you have only one WIFI card.

Even if you have two virtual machines, and you are trying to connect from those to two networks - what you are trying to do is to have to programs, on the same PC, to use the same WIFI card to connect to different networks.

That is just not possible.

789

Posted 2015-09-24T14:48:15.583

Reputation: 111

0

Indeed some wifi devices support your scenario (I personally can't deny or confirm Spiff's comment with regard the use of different channels, however the below wiki doesn't mention this limitation):

https://wireless.wiki.kernel.org/en/users/Documentation/iw/vif

At least some atheros devices have this capability, but with intel 8265 I had no luck.

Lóránt Németh

Posted 2015-09-24T14:48:15.583

Reputation: 1