#19561: Add support for vlan trunking over wifi interfaces
--------------------------+-----------------------------------
 Reporter:  pf-openwrt@…  |      Owner:  developers
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:
Component:  base system   |    Version:  Barrier Breaker 14.07
 Keywords:                |
--------------------------+-----------------------------------
 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 '10.255.0.10'
         option netmask '255.255.255.0'
         option gateway '10.255.0.1'
         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
   done

   if [ ! -e /sys/class/net/wlan1.$vlan ]; then
     vconfig add wlan1 $vlan
     ifconfig wlan1.$vlan up
   fi

   if [ ! -d /sys/devices/virtual/net/wlan1.$vlan/brport ]; then
     brctl addif "$brname" wlan1.$vlan
   fi
 done

 ... 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.

--
Ticket URL: <https://dev.openwrt.org/ticket/19561>
OpenWrt <http://openwrt.org>
Opensource Wireless Router Technology
_______________________________________________
openwrt-tickets mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-tickets

Reply via email to