Topic: Hostapd WDS + VLANs
I have some questions about the configuration of hostapd and VLANs on an OpenWRT device. I'm not a very expert user of OpenWRT so please correct me if I say something wrong. I'll try to explain my scenario as clear as possible. The configuration I want to set up is the following:
in which the device is configured as an AP with two SSIDs. Each SSID is on a different VLAN, while the wired interface is in trunking mode. To achieve this behavior I performed the following steps:
I configured hostapd in order to create two SSIDs
I created two vlan interfaces (2,3) on the wired interface
I created one vlan interface for each wireless interface (2 for wlan0, and 3 for wlan1)
I created two bridges, one for each vid and I added to them the corresponding vlan interfaces
The hostapd conf file is the following:
interface=wlan0 driver=nl80211 ieee80211n=1 ht_capab=[HT20] channel=36 macaddr_acl=0 ssid=SSID1 ignore_broadcast_ssid=0 bss=wlan1 ssid=SSID2 ignore_broadcast_ssid=0
and the commands I used are:
vconfig add eth0 2 vconfig add eth0 3 vconfig add wlan0 2 vconfig add wlan1 3 brctl addbr br.vlan2 brctl addbr br.vlan3 brctl addif br.vlan2 eth0.2 brctl addif br.vlan2 wlan0.2 brctl addif br.vlan3 eth0.3 brctl addif br.vlan3 wlan1.3
The result is the following configuration:
and everything worked as expected! Packets that comes to eth0 with VID=2 are sent out from wlan0 with VID=2 and packets that comes to eth0 with VID=3 are sent from wlan1 with VID=3. This is exactly what I wanted.
Now suppose that I would like to configure one of the stations connected to SSID1 as a bridge as well. The only way to achieve this is putting its wireless interface in 4address mode and forcing hostapd to work in WDS mode (wds_sta=1 in the conf file). It is here that problems come out. While working in WDS mode hostapd automatically creates a new interface (e.g. wlan0.sta1, wlan0.sta2, ...) for each station that connects to it, in fact (I guess) the wds_sta option is thought to be used together with the bridge option. This way each new interface (e.g. wlan0.sta1) is automatically bridged with the main interface (e.g. wlan0). My question is: how can I configure VLANs on interfaces like wlan0.sta1? In order to achieve the same behavior as the previous example I should do something like:
As far as I know, hostapd is not able to do this by itself. I should create VLANs on WDS interfaces by myself if I had a way to configure a hook on the "new station connected" event. Is there a way to do that?