Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This question already has an answer here:

I am trying to use my pc wireless card as an AP, while being connected to my wifi network thru the very same card, but I have a problem. What I am trying to achieve is the equivalent of Windows' Virtual Wi-fi technology. In line of principle, it's very simple:

service network-manager stop
iw dev wlan0 del
iw phy phy0 interface add new0 type station
service network-manager start
iw phy phy0 interface add new1 type __ap
hostapd -B /etc/hostapd.conf

with a suitable configuration for hostapd:

cat /etc/hostapd/hostapd.conf 
wpa_pairwise=TKIP CCMP
rsn_pairwise=TKIP CCMP

However, the driver nl80211 refuses to put the virtual IF new1 into AP mode. Here comes the interesting bit: the output of iw list contains

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

It is obvious my wifi card (an Intel Centrino Advanced-N 6235 [8086:088e] under iwlwifi) supports AP mode (I have tested it), and I had interpreted the "valid interface combinations" to mean that I could have at most 1 managed and 1 AP vifs on this card at the same time. But then I noticed the mysterious-looking constraint, STA/AP BI must match.

Does anyone know what this means, and whether this is what is thwarting my attempts at using two vifs on my card, one in station the other in AP mode? Cheers

share|improve this question

marked as duplicate by Tog, Oliver Salzburg Dec 16 '13 at 9:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Same question: superuser.com/questions/615664/… –  imz -- Ivan Zakharyaschev Dec 15 '13 at 21:04
@imz--IvanZakharyaschev You are quite right, thank you. But my question ws also about the meaning of STA/AP BI must match, which seems to provide some kind of constraint which I have not yet deciphered. –  MariusMatutiae Dec 15 '13 at 21:09
I'm sorry I haven't taken this detail into account. You are right. But this particular problem isn't obvious from the title, which made me think that having one WiFi adapter is the only problem here... –  imz -- Ivan Zakharyaschev Dec 15 '13 at 21:11

1 Answer 1

up vote 1 down vote accepted

Actually, the mysterious sentence

STA/AP BI must match

seems to have nothing to do with my setup not working. It turns out instead that

 #channels <= 1

was the key to make it work. I eventually understood it means I can use only one channel when I have two vif's on the same physical device (my Intel Centrino, at any rate), one in AP, the other in Station mode. So I switched the channel in the hostapd conf file, to the same I was trying to connect to, and I had no error messages.

At this point I configured iptables, started dnsmasq, then hostapd by means of

echo 1 >/proc/sys/net/ipv4/ip_forward
iptables --table nat --append POSTROUTING --out-interface new0 -j MASQUERADE
iptables --append FORWARD --in-interface new1 -j ACCEPT
/usr/local/bin/hostapd /etc/hostapd/hostapd.conf

and then I had it, a single wifi card working symultaneously as Access Point and client to a network connected to the Internet.

share|improve this answer

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