This creates a wlan1
virtual interface using the same physical device as an existing wlan0
interface :
iw dev wlan0 interface add wlan1 type station
Alternatively, you can specify the physical device (linux tends to call them "wiphy") by hand:
iw phy phy0 interface add wlan1 type station
Then run hostapd as usual on wlan1
. hostapd
will handle changing the type of wlan1
to AP mode, and may add another virtual interface in monitor mode if your kernel or driver does not support some features.
Be sure to disable DFS or anything that might change the frequency: Linux does not support channel hoping on two different channels if your hardware cannot support it. Running an AP station and a non-AP station at the same time is not supported by all card/drivers. You can use iw phy0 info
and see the requirement on interface configurations for your card. Running a recent enough kernel and/or hostapd is also advisable.
Then, use your internet sharing method of choice. NAT is evil but works everywhere, bridging as is will not work because the original AP will filter on incoming MAC, even if there is no security enabled. Some clever tricks with ARP proxying can also be used.