Opened 3 years ago

#19561 new enhancement

Add support for vlan trunking over wifi interfaces

Reported by: pf-openwrt@… Owned by: developers
Priority: normal Milestone:
Component: base system Version: Barrier Breaker 14.07
Keywords: Cc:


Vlan trunking support in Linux is interface-agnostic, which means that any network interface which is capable of working with 802.1q can not only carry tagged vlan traffic, but can have that traffic split out into virtual interfaces off the primary interface. Consider the following scenario, with router1 connected to an upstream network via ethernet and serving a VAP on wlan0, and router2 connected to router1 as a wireless client and serving a small network of devices connected both via ethernet and a VAP running on the same radio:

router1's WAN port connects to a trunked port on a managed switch, which sends multiple tagged vlans to router1.
router1's first VAP is bridged to the WAN port, so tagged vlan traffic flows over the VAP.

router2 connects as a wireless client to router1's trunked VAP using interface wlan0 as a client. Interface wlan0-1 and wlan0-2 are VAPs served by router2, both intended to be on different vlans. We can then create vlans off wlan0 (wlan0.2 == vlan2, wlan0.6 == vlan6) and bridge them with the VAPs (wlan0-1 bridged with wlan0.2 gives us a VAP on vlan2, and wlan0-2 bridged with wlan0.6 gives us a different VAP on vlan6). These vlans can also be tied to router2's switch ports to handle wired devices as well. This lets us pull multiple vlans over a single wireless client connection, rather than having to create a client connection for each vlan we wish to serve.

The above scenario is perfectly acceptable as far as Linux and (most, if not all) wireless drivers which support vlans are concerned. The problem is that openwrt lacks support for doing this (specifically, luci does not support it, but it can be made to work by editing config/network).
Attitude Adjustment can be convinced to have this work fairly easily in config/network:

config interface 'PrivateLan'

option type 'bridge'
option proto 'static'
option ipaddr ''
option netmask ''
option gateway ''
option ifname 'eth0.4 eth1.4 wlan0.4'

This bridges vlan4 off eth0, eth1, and wlan0.

In Barrier Breaker, I've been unable to get this to work (I've been told that it was a fluke that it worked in AA, and subsequent changes to BB rendered the above non-functional), so I've had to implement a script run out of rc.local:

for vlan in 2 4; do

brname="$(eval echo '$'v${vlan})"
while [ ! -d "/sys/class/net/$brname" ]; do

sleep 1


if [ ! -e /sys/class/net/wlan1.$vlan ]; then

vconfig add wlan1 $vlan
ifconfig wlan1.$vlan up


if [ ! -d /sys/devices/virtual/net/wlan1.$vlan/brport ]; then

brctl addif "$brname" wlan1.$vlan



... where variables $v2 and $v4 are bridge names (network names, prefixed by 'br-' as per openwrt's naming convention). This is hardly ideal, but it works for the moment.

Attachments (0)

Change History (0)

Add Comment

Modify Ticket

as new .

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.