Equivalent for netsh start network on linux

17,245

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.

Share:
17,245

Related videos on Youtube

Bartlomiej Lewandowski
Author by

Bartlomiej Lewandowski

Updated on September 18, 2022

Comments

  • Bartlomiej Lewandowski
    Bartlomiej Lewandowski over 1 year

    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?

  • Bartlomiej Lewandowski
    Bartlomiej Lewandowski over 11 years
    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.