Community discussions

MikroTik App
 
User avatar
rbm78bln
just joined
Topic Author
Posts: 9
Joined: Fri Aug 06, 2021 4:42 pm
Location: Berlin

Bridging different VLANs and apply filtering rules

Tue Jan 04, 2022 8:36 pm

Hey guys,

I'm pretty new to RouterOS and I don't manage filtering rules getting applied to a bridge on my RB5009UG+S+ (ROS 7.1.1).

So I've got a few crappy devices in my network that do "support" IPv6, but stop working properly, once they gain v6 connectivity. Neveltheless I want those devices to be in my regular L2 network.
So I have my regular vlan10 for all my devices with full IPv4 and IPv6 support. Now I was trying set up another vlan14, which I wanted to bridge with my regular vlan10, yet I was setting up filter rules, that drop any ipv6 packets by ethertype.

In other words:
# jan/04/2022 19:00:00 by RouterOS 7.1.1
# model = RB5009UG+S+
#
/interface bridge
add fast-forward=no name=lan protocol-mode=none

/interface vlan
add interface=ether1 name=vlan10 vlan-id=10
add interface=ether1 name=vlan14 vlan-id=14

/interface bridge port
add bridge=lan hw=no interface=vlan10
add bridge=lan hw=no interface=vlan14

/interface bridge filter
add action=drop chain=forward in-bridge=lan mac-protocol=ipv6 in-interface=vlan14
add action=drop chain=forward out-bridge=lan mac-protocol=ipv6 out-interface=vlan14
# add action=drop chain=forward comment="drop all" log=yes log-prefix=bridge-drop

/interface bridge settings
set allow-fast-path=no use-ip-firewall=no use-ip-firewall-for-pppoe=no use-ip-firewall-for-vlan=no
# set allow-fast-path=no use-ip-firewall=yes use-ip-firewall-for-pppoe=yes use-ip-firewall-for-vlan=yes

/interface ethernet switch port-isolation
# set 0 forwarding-override=switch1-cpu

And it works nicely - just that no filter rules apply at all. I've been commenting out a few variations above that I also tried, yet the result is alway the same:
All traffic is being forwarded, even when I drop ALL traffic in the forward chain for bridging. All kinds of cpu-offloading by hardware is turned off and yet all traffic goes through, all rule counters are stuck at zero. Yet when I remove/disable one of the vlan-"ports" in either bridge or iterfaces, the traffic will stop. Thus I assume the traffic is indeed actively bridged by the cpu.

I've done similar setups before using ebtables directly on a linux box, and it always worked nicely. Thus I assumed I could do the same using ROS.

EDIT: Abusing the Bridge-NAT tables for filtering still results in all traffic passing through without any effect:
/interface bridge nat
add action=drop chain=srcnat log=yes log-prefix=snat-drop mac-protocol=ipv6 out-bridge=lan out-interface=vlan14
add action=drop chain=dstnat in-bridge=lan in-interface=vlan14 log=yes log-prefix=dnat-drop mac-protocol=ipv6

EDIT2: I just didn't get over it and got me some random arch linux box laying around and it worked right away as expected:
ip link add name lan type bridge
ip link add link eth0 name vlan10 type vlan id 10
ip link add link eth0 name vlan14 type vlan id 14
ip link set dev eth0 up
ip link set dev vlan10 up
ip link set dev vlan14 up
ip link set dev lan up
ebtables -P FORWARD DROP
ebtables -A FORWARD --protocol ARP -j ACCEPT
ebtables -A FORWARD --protocol IPv4 -j ACCEPT
ip link set vlan10 master lan
ip link set vlan14 master lan

What setting am I missing, so that my filter rules don't apply at all?
What am I messing up using ROS when I can easily manage using a regular linux distro?

I'm kinda lost and any help or suggestions are highly appreciated.
Last edited by rbm78bln on Tue Jan 04, 2022 9:58 pm, edited 1 time in total.
 
sindy
Forum Guru
Forum Guru
Posts: 10206
Joined: Mon Dec 04, 2017 9:19 pm

Re: Bridging different VLANs and apply filtering rules

Tue Jan 04, 2022 9:26 pm

Just for test, remove the mac-protocol from the filter rules completely. There may be an issue with mac protocol matching. Also in-bridge and out-bridge should not be necessary.
 
User avatar
rbm78bln
just joined
Topic Author
Posts: 9
Joined: Fri Aug 06, 2021 4:42 pm
Location: Berlin

Re: Bridging different VLANs and apply filtering rules

Tue Jan 04, 2022 10:02 pm

I've tried that.

Even when I am adding...
/interface bridge filter
add action=drop chain=forward comment="drop all" log=yes log-prefix=bridge-drop
(i.e. drop everything unconditionally, yet log it)
...it just forwards everything regardlessly, nothing gets logged.

Was editing my post above, as I got it working on a standard linux box right away, which (of course) is not the solution that I want to go for...
 
Guscht
Member Candidate
Member Candidate
Posts: 236
Joined: Thu Jul 01, 2010 5:32 pm

Re: Bridging different VLANs and apply filtering rules

Tue Jan 04, 2022 10:21 pm

Honestly, I dont get what you are trying to accomplish...
You have 2 VLANs and you are trying to "bridge" both VLANs together? Like connecting two switches together with an ethernet cable? Why bridging and not routing? But OK...

I see to following:
/interface vlan
add interface=ether1 name=vlan10 vlan-id=10
add interface=ether1 name=vlan14 vlan-id=14

Normally, youd need to bound the VLAN-Interfaces to the Bridge (not to the physical Interface) in order for the Bridge to work as expected.
Last edited by Guscht on Tue Jan 04, 2022 10:24 pm, edited 1 time in total.
 
sindy
Forum Guru
Forum Guru
Posts: 10206
Joined: Mon Dec 04, 2017 9:19 pm

Re: Bridging different VLANs and apply filtering rules

Tue Jan 04, 2022 10:23 pm

If so, it means bridge filtering is broken in 7.1.1, at least on ARM64. I cannot see anything wrong in your other settings.
 
patrick7
Member
Member
Posts: 343
Joined: Sat Jul 20, 2013 2:40 pm

Re: Bridging different VLANs and apply filtering rules

Wed Jan 05, 2022 3:19 am

Bridge Filters have stopped working here too.
 
User avatar
rbm78bln
just joined
Topic Author
Posts: 9
Joined: Fri Aug 06, 2021 4:42 pm
Location: Berlin

Re: Bridging different VLANs and apply filtering rules

Wed Jan 05, 2022 9:56 am

Guscht:
Honestly, I dont get what you are trying to accomplish...
[...]
Normally, youd need to bound the VLAN-Interfaces to the Bridge (not to the physical Interface) in order for the Bridge to work as expected.

Actually no: This is the traditional way of doing so, before vlan-aware bridges were introduced into the linux kernel (which was indeeded looong ago already). Nevertheless there are some major pitfalls to it, like (R)STP will fail detecting certain loops and so on, so you will have to address this manually. Not going into detail here. This is one of the reasons why vlan-aware bridges came up at all.

Indeed I was presenting you a very much simplified example of my setup that was reduced down to the essence of the underlying problem during my attempts of debugging the issue myself.

Sure thing this is not a beautiful solution to the problem, but when you need to host broken devices that are relying on limited broadcasts to work with them and on top of that those ones are committing suicide as soon as they gain ipv6 connectivity, then can just do few things: ditch them (good solution indeed), turn off ipv6 in your network (brrrrr....), or herd them well-supervised in their very own little bubble.
Last edited by rbm78bln on Wed Jan 05, 2022 9:58 am, edited 1 time in total.
 
User avatar
rbm78bln
just joined
Topic Author
Posts: 9
Joined: Fri Aug 06, 2021 4:42 pm
Location: Berlin

Re: Bridging different VLANs and apply filtering rules

Wed Jan 05, 2022 9:57 am

sindy:
If so, it means bridge filtering is broken in 7.1.1, at least on ARM64. I cannot see anything wrong in your other settings.

patrick7:
Bridge Filters have stopped working here too.

Okay guys, thanks for confirming. I'm gonna open a support ticket.

EDIT:
Broken bridge filter confirmed:
I was plainly bridging two ethernet ports of my device, no vlans, no fast-forwarding or hw-offloading, drop-all rule added, and yet all traffic is being forwarded by the bridge without any filtering.

Support-ticket is SUP-70742.
 
Guscht
Member Candidate
Member Candidate
Posts: 236
Joined: Thu Jul 01, 2010 5:32 pm

Re: Bridging different VLANs and apply filtering rules

Wed Jan 05, 2022 9:35 pm

Actually no: This is the traditional way of doing so, before vlan-aware bridges were introduced into the linux kernel (which was indeeded looong ago already).
I still dont get to point to create two VLANs and bridge both together with some kind of ACLs...
This is from the point of a modern network-architecture a totally wrong approach.

But it should work nevertheless, unfortunately your config will never work. Because you have bound the VLAN-Interfaces to the physical Interfaces and not to the Bridge. On the other hand you are trying to implement Bridge-Filter (in the Bridge you havent bound the interfaces too). This is not the way it works in ROS, it will go (if you want to implent Bridge-related things, not HW-Switch-Chip ACLs):

1. create a Bridge
2. enable VLAN-Filtering (this will change the Switch from a non-VLAN-aware SVL-Switch to a VLAN-aware IVL-Switch)
3. create VLAN-Interfaces and bound them to the Bridge (created in step 1)
4. implement your Bridge-Filters + confirm that they work if the ports are Hardware-offloaded - if no, disbale HW-offloading on these ports

I can confirm, with this config, Bridge-Filter will work as expected with ROS v7.1.1.
This will drop DHCP-requests to the router itself and/or ot another DHCP in the same VLAN1.
# jan/05/2022 21:01:37 by RouterOS 7.1.1
# software id = XXXX-XXXX
#
# model = RB760iGS
# serial number = XXXXXXXXXXXXX
/interface bridge
add ingress-filtering=no name=bridge1 protocol-mode=none vlan-filtering=yes
/interface vlan
add interface=bridge1 name=vlan1 vlan-id=1
add interface=bridge1 name=vlan2 vlan-id=2
/ip pool
add name=dhcp_pool0 ranges=192.168.0.2-192.168.0.254
/ip dhcp-server
add address-pool=dhcp_pool0 interface=vlan2 name=dhcp1
/interface bridge filter
add action=drop chain=input in-bridge=bridge1 in-interface=ether5 \
    mac-protocol=vlan vlan-id=1
add action=drop chain=forward in-bridge=bridge1 in-interface=ether5 \
    mac-protocol=vlan vlan-id=1
/interface bridge port
add bridge=bridge1 interface=ether1
add bridge=bridge1 hw=no interface=ether5
/interface bridge vlan
add bridge=bridge1 tagged=bridge1 untagged=ether1,ether5 vlan-ids=1
add bridge=bridge1 disabled=yes tagged=bridge1 untagged=ether5 vlan-ids=2
/ip address
add address=192.168.0.1/24 interface=vlan2 network=192.168.0.0
/ip dhcp-client
add interface=vlan1
/ip dhcp-server network
add address=192.168.0.0/24 dns-server=192.168.0.1 gateway=192.168.0.1
/ip dns
set allow-remote-requests=yes

Screenshot 2022-01-05 210502.jpg
Screenshot 2022-01-05 210535.jpg
Screenshot 2022-01-05 210621.jpg
You do not have the required permissions to view the files attached to this post.
 
User avatar
rbm78bln
just joined
Topic Author
Posts: 9
Joined: Fri Aug 06, 2021 4:42 pm
Location: Berlin

Re: Bridging different VLANs and apply filtering rules

Thu Jan 06, 2022 8:43 am

.

Thank you very much. Appreciate.
 
User avatar
rbm78bln
just joined
Topic Author
Posts: 9
Joined: Fri Aug 06, 2021 4:42 pm
Location: Berlin

Re: Bridging different VLANs and apply filtering rules

Thu Jan 06, 2022 2:51 pm

[...] unfortunately your config will never work. Because you have bound the VLAN-Interfaces to the physical Interfaces and not to the Bridge. On the other hand you are trying to implement Bridge-Filter (in the Bridge you havent bound the interfaces too). This is not the way it works in ROS [...]

MikroTick support has contacted me back and they confirmed this to be a bug as this should definitely work in ROS.
They were able to reproduce the described behaviour easily and they are working on a bugfix.
 
User avatar
Kentzo
Long time Member
Long time Member
Posts: 529
Joined: Mon Jan 27, 2014 3:35 pm
Location: California

Re: Bridging different VLANs and apply filtering rules

Sat Jan 22, 2022 12:37 am

I'm not sure if it's related, but I have noticed that a bridge of physical interfaces with vlan-filtering=yes won't recognize ip and ipv6 mac-protocols for packets with vlan headers if they are allowed to pass tagged.

Who is online

Users browsing this forum: GoogleOther [Bot], seriosha and 87 guests