new bridge vlan filtering feature wiki example

Hello,

I read carefully new feature of bridge vlan filtering in version 6.40 and later including examples, and I am trying to make a such approach I think is often required.
It is a mixing of bridging and routing, eg:

Link from ISP has two services in ether1:
vlan 401 internet, public ip 172.16.10.10/24 gw 172.16.10.1
vlan 501 something else without ip, it is needed to pass to local net as it is

Local network ether2:
vlan 1501(this is my vlan I can choose it), ip dhcp 10.10.10.1/24
vlan 501 without ip, it must pass through tagged from ether1 to ether2


As you can see, my local network connected to ether2 must route to internet masqueradeing through ISP public ip and its gateway,
while vlan 501 must bridge from ether1 though ether2


Can any help me for a correct configuration ?
Is the case to use thew new brdge vlan filtering feature ?

thanks in advance

There are no “new” bridge vlan filtering in 6.40, only from 6.41 onwards

My solution for similar task (ISP delivers PPPoE untagged and IPTV multicast tagged with VID=3999) is as follows:

  1. first of all, I joined all ethernet ports to one bridge (difference from default is that I added ether1 to the default bridge)

  2. I set up VLANs in /interface ethernet switch port and /interface ethernet switch vlan .
    In your case I’d do the following:

/interface ethernet switch port
set 0 vlan-mode=secure
set 1 vlan-mode=secure
set 2 vlan-mode=secure
set 3 vlan-mode=secure
set 4 vlan-mode=secure
set 5 vlan-header=add-if-missing vlan-mode=fallback
# N.b.: interface with index 5 is switch1-cpu pseudo-interface, which connets RBs man CPU with switch chip
/interface ethernet switch vlan
add independent-learning=no ports=switch1-cpu,ether1 switch=switch1 vlan-id=401
add independent-learning=no ports=ether1,ether2,ether3,ether4,ether5 switch=switch1 vlan-id=501
add independent-learning=no ports=switch1-cpu,ether2,ether2,ether3,ether4,ether5 switch=switch1 vlan-id=1501

and then use ether1 (former WAN) port to connect towards ISP, while other ports (2-5) are all intended for LAN, all carrying VLANs 501 and 1501.

  1. Set up appropriate router interfaces/addresses for internet stuff:
/interface vlan
add interface=bridge name=vlan-401 vlan-id=401
add interface=bridge name=vlan-1501 vlan-id=1501
/ip address
add address=172.16.10.10/24 interface=vlan-401 network=172.16.10.0
add address=10.10.10.1/24 interface=vlan-1501 network=10.10.10.0
/ip route
add distance=1 gateway=172.16.10.1

The names of VLAN interfaces, created on bridge (vlan-401 and vlan-1501 in example above) can be almost anything (e.g. vlan-WAN and vlan-LAN).

  1. setup whatever else needed - DHCP server on interface vlan-1501, firewall, …

In short: RB will act as (smart) switch for VLAN 501, as (smart) switch and gateway for VLAN 1501 and as router between VLAN 401 and 1501.

A remark: my setup was done on pre-6.41 and works unchanged after upgrade to 6.41.2.

Thank you very much for the fast answer,


I have a ccr1036, which has NOT switch chip and features, switch1 and its derives do NOT exist.

how can it be done in absence of switch ?

In that case, both physical interfaces will be member ports of the same bridge. Until you activate vlan-filtering, all VLANs will be transparently forwarded between the physical interfaces.

/interface bridge add my-bridge vlan-filtering=no
/interface bridge port add bridge=my-bridge interface=ether1
/interface bridge port add bridge=my-bridge interface=ether2

Then, you configure VLAN interfaces for WAN and LAN:

/interface vlan add name=WAN vlan-id=401 interface=my-bridge
/interface vlan add name=LAN vlan-id=1501 interface=my-bridge

Now you can attach IP configuration to the vlan interfaces (static address or dhcp client for WAN, static address and dhcp server to LAN), create the firewall rules etc.

At this moment, the VLAN 501 is transparently forwarded between ether1 and ether2, and both VLAN 401 and 1501 are available at both ether1 and ether2 as well.

To enforce a different behaviour, you have to configure the vlan-filtering first

/interface bridge vlan
add bridge=my-bridge tagged=my-bridge,ether1 vlan-ids=401
add bridge=my-bridge tagged=my-bridge,ether2 vlan-ids=1501
add bridge=my-bridge tagged=ether1,ether2 vlan-ids=501

And then you may activate vlan-filtering:

/interface bridge set vlan-filtering=yes [find name=my-bridge]

Thanks You Sindy for the help!


Just now I was able to perform this setup and seems working with some small changes:

vlan 501 needs to pass as it is from ether1 to ether2(multicast too), and you wrote to add:

/interface bridge vlan
add bridge=my-bridge tagged=ether1,ether2 vlan-ids=501

I changed to:

/interface bridge vlan
add bridge=my-bridge tagged=my-bridge,ether1,ether2 vlan-ids=501

in order to work properly, in ccr1036, does it make sense?

But, in rb1100ahx2, works your command, it seems different routers have different software behaviour

regards

It unfortunately does. The thing is that on models with a switch chip there is a port of that chip which is only mentioned as “switchN cpu” in ****

/interface ethernet switch

configuration subtree. And in the

/interface bridge vlan

configuration, the name of the bridge itself in the list of member ports of the VLAN actually substitutes the name of the CPU port - if it is not mentioned, the CPU port is not made a member of the VLAN, so the CPU does not get the packets. You didn’t need that the router had an IP interface in that VLAN so it seemed appropriate not to list the bridge name (= the CPU) among VLAN members However, it seems that even on models without a switch chip, you still have to mention the bridge name although there is no other way how the frames could get from one port to another than via the CPU.

I would expect that future software releases will eventually hide this from the user and automatically set the configuration depending on model and on whether anything in the configuration (IP address, dhcp client, PPPoE client) indicates that a given VLAN must be extended to the CPU, but right now you have to indicate it the way you did.