I recenty read about the Windows option for creating an access point, that will run on the same physical device, as the machine. So that I can connect my other devices to that network, and have access to internet as well.

I know that I can use 2 wifi cards to do the trick, by configuring dhcp and creating a bridge, but how can I accomplish this with one card?


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.

  • This does solve the problem, but how can i assign the ip for the connected machines? I have tried dhcp-server3 along with editing of ip-tables, but that just messed up the whole linux, so i had to reinstall. Jan 20 '13 at 20:20

Current versions of Fedora (and I suspect by now most distributions) use NetworkManager, the command nm-online should put you online if possible. Check there are no other problems (too feeble signal, access point has filtered your MAC, bad setup of the AP, the selected channel is crowded, ...).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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