[OpenWrt-Devel] Multiple Wi-Fi client/AP interfaces on one radio (was: Change OpenWrt Wifi default settings)

Joshua Judson Rosen jrosen at harvestai.com
Tue Aug 4 10:58:42 EDT 2015

On 2015-08-04 02:26, David Lang wrote:
> A given radio can be either an AP or a client, but not both at once.
> so if you use a radio to connect to another AP, you are making it a client, and
> in client mode all it can do is connect to that other AP as shows up as the SSID
> of that other AP.
> you can do this with one radio, while using the other radio (assuming you have
> two) to act as an AP for local clients.

This is not necessarily true: with at least some hardware/drivers, it's
possible to create multiple virtual interfaces on top of a single radio--
and separate virtual interfaces can in fact operate in different modes
(e.g.: one in STA mode, two in AP mode, one in mesh mode...).

Assuming that your hardware/driver is capable of supporting multiple
virtual interfaces on top of the single physical radio,
you can create these interfaces by adding "wifi-iface" stanzas
in /etc/config/wireless, e.g:

	config wifi-device 'radio0'
		option type 'mac80211'
		option channel '11'
		option hwmode '11g'
		option path 'platform/ar933x_wmac'
		option htmode 'HT20'
		option country 'US'
		option txpower '20'
	config wifi-iface 'ap1'
		option device 'radio0'
		option mode 'ap'
		option wds '1'
		option ssid 'my AP'
		option network 'lan'
	config wifi-iface 'mesh1'
		option device 'radio0'
		option mode 'mesh'
		option mesh_id 'my mesh'
		option network 'lan'

That creates two virtual interfaces using the same physical radio,
and bridges them together onto the OpenWrt "lan network"
(which is itself defined in /etc/config/network).

I believe you could also have an interface with "mode 'sta'", but note
that it would also need to use the same channel as the other interfaces--
which means that the external AP to which you connect it would also
need to use that same channel (11, in the example above).
That's where having multiple *radios* helps: you can run them on
different frequencies (either completely different bands [2.4 GHz vs. 5 GHz],
or on different channels within the same band [e.g. 2.427 GHz = channel 4
vs. 2.472 GHz = channel 13]) to increase efficiency by multiplexing
less data over a single radio, or to increase compatibility with other
APs outside of your control that you might want to connect to.

Also note that, if you want to bridge a STA interface onto anything else,
it'll need to be in "WDS" mode _and_ the the AP to which it's connecting
will also need to be in "WDS" mode (note the "option wds '1'",
in my example above), because the standard "3-address mode" of Wi-Fi
isn't bridgeable (and note that WDS "4-address mode" is bridgeable,
but not standardised across different platforms--so you're probably
OK so long as all of your equipment is running Linux and using
the same Wi-Fi driver, but don't expect to bridge a STA interface
that's connected non-Linux Wi-Fi router).

At least, I've seen this work with Atheros chips. There are some
notes in the wiki about how Broadcom chips have their own, different
solution implemented in hardware; and about how some drivers
don't support this stuff at all....

"Don't be afraid to ask (λf.((λx.xx) (λr.f(rr))))."
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list