Community discussions

MikroTik App
 
tojoe
just joined
Topic Author
Posts: 9
Joined: Tue Apr 09, 2019 6:19 pm

CRS326 loop-protect with pvid != 1 and VLAN filtering

Sun Dec 01, 2019 10:42 am

Hello,
I've got my hands on a few CRS326-24G-2S+ (budget is tight at the end of the year...) running 6.45.7 to replace some old (f)ailing HP 1GBit switches in our labs but I'm having issues with the mikrotik implementation of the loop-protect feature.
loop-protect only works properly when a port is configured with the default PVID 1 or VLAN filtering is disabled, the moment I change the PVID or enable VLAN ingress filtering I do get log entries like "interface,warning ether7: bridge port received packet with own address as source address, probably loop" and "interface,warning ether7 excessive broadcasts/multicasts, probably a loop" but the ports dont get disabled. If I change PVID back to 1 or disable VLAN filtering the ports get properly disabled again.
To test just use the default config, disable STP, add another vlan, configure the PVID of 2 ports to that vlan, enable loop-protect on those ports.
The moment you enable any kind of VLAN (ingress) filtering either on the bridge ports or the bridge interface ports dont get disabled.

Using (R)STP does not help since we do have devices with multiple ports which block STP BPDUs while forwarding other traffic.

Any hint on how to get loop-protection working with VLAN filtering and different PVIDs?

Regards,
Thomas
 
Zacharias
Forum Guru
Forum Guru
Posts: 3459
Joined: Tue Dec 12, 2017 12:58 am
Location: Greece

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Sun Dec 01, 2019 11:20 am

That is normal, RSTP might not detect loops in a VLAN...
Since RouterOS v6.41 it is possible to enable Multiple Spanning Tree Protocol (MSTP) on a bridge interface to ensure loop-free topology across multiple VLANs
Read here : https://wiki.mikrotik.com/wiki/Manual:S ... e_Protocol
 
User avatar
sindy
Forum Guru
Forum Guru
Posts: 11387
Joined: Mon Dec 04, 2017 9:19 pm

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Sun Dec 01, 2019 12:47 pm

@Zacharias, the OP has stated he's got devices in his network which prevent any flavour of STP from working, as these devices are clever enough not to blindly forward frames with "link-local" dst-mac-address but not clever enough to run xSTP as such. So they just break the chain.
 
tojoe
just joined
Topic Author
Posts: 9
Joined: Tue Apr 09, 2019 6:19 pm

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Sun Dec 01, 2019 4:41 pm

Any kind of STP is not an option, loop protection implemented in the old HP switches works though. Simply enabling loop protection on the old HP switches just works without any issues, even when the ports are configured in different VLANs.
On the CRS326 loop-protection just doesnt do anything the moment a port is in a different PVID than 1 and VLAN filtering is enabled, even when both ports of the loop are configured wit the same PVID.
 
Zacharias
Forum Guru
Forum Guru
Posts: 3459
Joined: Tue Dec 12, 2017 12:58 am
Location: Greece

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Sun Dec 01, 2019 5:11 pm

On the CRS326 loop-protection just doesnt do anything the moment a port is in a different PVID than 1 and VLAN filtering is enabled
Loop protection using what protocol ? Still dont understand...
 
tojoe
just joined
Topic Author
Posts: 9
Joined: Tue Apr 09, 2019 6:19 pm

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Sun Dec 01, 2019 5:20 pm

Using the loop-protect feature as described in https://wiki.mikrotik.com/wiki/Manual:Loop_Protect in the /interface ethernet sub-menu.
The manual says it's recommended to use STP when the interfaces are added to a bridge but not that it wont work at all the moment VLANs come into play.
Enabling loop-protect in the /interface vlan submenu doesnt help and I dont have interfaces added to all VLANs anyway.
 
Zacharias
Forum Guru
Forum Guru
Posts: 3459
Joined: Tue Dec 12, 2017 12:58 am
Location: Greece

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Sun Dec 01, 2019 5:33 pm

The manual says it's recommended to use STP when the interfaces are added to a bridge but not that it wont work at all the moment VLANs come into play
Wrong...
In case there is a loop inside a certain VLAN, (R)STP might not be able to detect it
https://wiki.mikrotik.com/wiki/Manual:S ... e_Protocol
Why dont you try MSTP ?
 
tojoe
just joined
Topic Author
Posts: 9
Joined: Tue Apr 09, 2019 6:19 pm

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Sun Dec 01, 2019 5:44 pm

STP and the loop-protect feature are 2 different ways to prevent loops and due to certain circumstances I *cant* use any kind of STP to detect loops, only loop-protect works.
 
User avatar
sindy
Forum Guru
Forum Guru
Posts: 11387
Joined: Mon Dec 04, 2017 9:19 pm

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Sun Dec 01, 2019 5:50 pm

@tojoe, I agree that the manual is not excessively verbose regarding loop-protect, but there is an interesting point - you can activate it not only at physical Ethernet interfaces and L2 tunnels but also at /interface vlan. Which suggests that the protocol is VLAN-aware. So I've checked what is actually going on. I've used a hAP and a hEX for the test, but given that Mikrotik use their own ethertype for the loop-protect frames, I guess it is not implemented in hardware on CRS3xx so it behaves the same there. I've used 6.45.7 for the test.

The auto-disabling of an Ethernet port only happens when the port receives a tagless loop-protect frame with one of the machine's own MAC addresses as source. If it receives such a frame tagged, it forwards it rather than blocking itself, but it does log the event (it logs ANY frame like that, not just a loop-protect one).

While vlan-filtering is set to no on a bridge, no tagging or untagging is ever done on Ethernet or EoIP member ports of that bridge, only on /interface vlan attached to it, and the pvid values of /interface bridge port rows are ignored.

And what's best, if an /interface vlan receives a loop-protect frame with a matching tag, it gets disabled too. Which is fine in the one-bridge-per-each-vlan configuration (where the tagged ends of several /interface vlan are connected to different carrier interfaces and their tagless ends are member pors of the same bridge), but a disaster in the common-bridge-for-all-vlans setup where the loop-protection frame sent by itself comes back to an /interface vlan.

So if you can make sure that you use the same pvid on all Ethernet ports belonging to the same bridge, you are fine to use loop-protect on those Ethernet ports. If you need to use the same VLAN tagged on some ports of a bridge and tagless on other ports of the same bridge, the loop-protect mechanism as currently implemented in RouterOS will not work properly.
 
tojoe
just joined
Topic Author
Posts: 9
Joined: Tue Apr 09, 2019 6:19 pm

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Sun Dec 01, 2019 5:58 pm

@sindy thanks, that just affirms my doubts with mikrotiks implementation of loop-protect vs. what I'm used to from HP.
Guess we have to drill our students even more to not connect more than one cable unless they're 110% sure their config is right and otherwise hope the upstream switches catch the loop.
Need to test the behaviour of the switch-ports of our new VoIP phones whether at least they play nice with STP or still drop STP BPDUs like the ancient ones I've toyed with.
 
User avatar
sindy
Forum Guru
Forum Guru
Posts: 11387
Joined: Mon Dec 04, 2017 9:19 pm

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Sun Dec 01, 2019 6:41 pm

There is actually no good way of handling the loop protection on trunk ports without xSTP, because in some scenarios you may want to use a different physical link between the same two switches for different (groups of) VLANs, something a VLAN-agnostic loop protection mechanism is not compatible with. Whereas if only used to cut loops between access ports, both the HPE and the Mikrotik implementations work fine.

But I'd say let the students experience the fireworks, they will remember better why to take care about loops.
 
tojoe
just joined
Topic Author
Posts: 9
Joined: Tue Apr 09, 2019 6:19 pm

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Sun Dec 01, 2019 7:08 pm

Well, I'm not really concerned about loops on trunk ports but access ports (i.e. student loops switch port 3 with 5 because they mixed up the patch cables - even going as far as directly connecting the same cable to 2 ports of the CRS326), which doesnt get detected by loop-protect either as soon as the ethernet ports pvid is different from the bridges pvid as we discovered...
But STP should at least catch this as there is no device filtering STP BPDUs involved.
It's just really annoying when a whole lab goes offline because some coworkers are too lazy (dont want to call them names, but they're always surprised like this is the fist time...) to really care about stuff like loops and just come whining. Enabling loop-protect with high timeout on the re-enable timer and ignoring them for some time helped but if the loop (lacking working loop-protect) persists and stuff still doesnt work even the next day which means checking all connections in the lab or having to access the switch with serial console because the network is down gets tedious.
 
User avatar
kvee
newbie
Posts: 39
Joined: Mon Feb 13, 2023 7:59 pm

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Sun Sep 03, 2023 10:10 pm

I'm currently looking for loop protect in Mikrotik.
I'm using RouterOs v7.11.2 ; model RB1100AHx4

I have one bridge and 3 VLANs.
Loop protect in the /interface/vlan does not blocked or ...wrong blocked.
I plugged 1st LAN cable to switch and then 2nd to the same switch for VLAN 101. I have loop protect on for that VLAN but Mikrotik block all VLANs.
If I don't unplug it, I will not be able to access any website including here. Once unplugged, I can access sites but not Mikrotik.

It's look like there is no way to loop protect on VLAN like this (search but not found anything about this except this topic).
In that case, I have to use "Loopback Detection" on managed switch that is be able to block it perfectly.
 
emunt6
Member Candidate
Member Candidate
Posts: 114
Joined: Fri Feb 02, 2018 7:00 pm

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Fri Sep 15, 2023 1:39 am

I'm currently looking for loop protect in Mikrotik.
I'm using RouterOs v7.11.2 ; model RB1100AHx4

I have one bridge and 3 VLANs.
Loop protect in the /interface/vlan does not blocked or ...wrong blocked.
I plugged 1st LAN cable to switch and then 2nd to the same switch for VLAN 101. I have loop protect on for that VLAN but Mikrotik block all VLANs.
If I don't unplug it, I will not be able to access any website including here. Once unplugged, I can access sites but not Mikrotik.

It's look like there is no way to loop protect on VLAN like this (search but not found anything about this except this topic).
In that case, I have to use "Loopback Detection" on managed switch that is be able to block it perfectly.
I'm using the following working/battle-proven setup:
- Mikrotik's side use the "/interface bridge procol-mode=none"
- Connect Mikrotik router through the network using another branded switch device which doing all the L2/STP stuffs.
Topology:
(MT)-------(SW)-----------(NETWORK)

Just leave out the Mikrotik from any L2/STP related stuffs ( every time broken as hell) - pure L3 stuffs on Mikrotik, because
the another branded switch's vendor correctly implements all the L2/STP related protocols.

Dont mix them.
 
joshhboss
Member
Member
Posts: 301
Joined: Thu Aug 01, 2019 2:13 pm

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Thu Feb 15, 2024 3:33 pm

So if you can make sure that you use the same pvid on all Ethernet ports belonging to the same bridge, you are fine to use loop-protect on those Ethernet ports. If you need to use the same VLAN tagged on some ports of a bridge and tagless on other ports of the same bridge, the loop-protect mechanism as currently implemented in RouterOS will not work properly.
This is the 2nd piece of heart breaking news since I purchased (40) CRS318-16P.. I learned how difficult it is to truly rate limit ingress bandwidth on the port level. And just noticed for my self here testing that I can not get the loop-protect feature to shut down the interface when it detects the loop..

:(
 
User avatar
sindy
Forum Guru
Forum Guru
Posts: 11387
Joined: Mon Dec 04, 2017 9:19 pm

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Thu Feb 15, 2024 3:39 pm

Just bear in mind that the post you've quoted is more than 4 years old, so maybe RouterOS 7 has changed something about it. Not that I would give it too much chance.
 
joshhboss
Member
Member
Posts: 301
Joined: Thu Aug 01, 2019 2:13 pm

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Fri Feb 16, 2024 5:01 am

Just bear in mind that the post you've quoted is more than 4 years old, so maybe RouterOS 7 has changed something about it. Not that I would give it too much chance.
Im still on 6.49 but we are going into an event right now so im nervous to make the change but my next event isnt until Mid march so maybe I can put in some bench time to try and get a few things understood..

Id like the CRS3X switches to..

Do loop-protect on ports on the bridge -- and storm control.. (because that doesnt seem to work either, because I figured it would stop the loop just the same way, and it doesnt)
Do a more accurate job of rate-limiting ports (especially on ingress.. the egress seems fine.. im talking about in the /interface/ethernet/switch/port section) I do not know how to do ingress ACLs so thats pretty much all I have right now to do that..
Id like to also see if there is a way to do port security similar to how the cisco switches do. limiting lets say 10 Macs per port..

Also this is more on me learning RSTP.. but I constantly give internet to areas when building out an event with a point to point but then move it to fiber, I want to be able to just leave the p2p up and connect the fiber and always select my root port as the fiber port.. ive been lucky and lately It just seems to pick it automatically but I read that, its not always the case..
 
joshhboss
Member
Member
Posts: 301
Joined: Thu Aug 01, 2019 2:13 pm

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Tue Feb 20, 2024 3:02 pm

Just bear in mind that the post you've quoted is more than 4 years old, so maybe RouterOS 7 has changed something about it. Not that I would give it too much chance.
I just tested this.. to check the logs and look for "probably a loop" and shut down the interface where it came from.. might have to clear the logs every time.. but it's something.
:local loopMessage "probably a loop";
:local foundLogs [/log find message~"$loopMessage"];

# Loop through all found log entries
:foreach logId in=$foundLogs do={
    :local thisMessage [/log get $logId message];
    # Assume interface name follows immediately after "ether" and goes until the first space
    :local startIdx [:find $thisMessage "ether"];
    :local endIdx [:find $thisMessage " " startIdx];
    :local thisInterface "";

    # Check if "ether" is found and adjust endIdx if not found (i.e., end of message)
    if ($endIdx = -1) do={
        :set endIdx [:len $thisMessage];
    }
    :set thisInterface [:pick $thisMessage $startIdx $endIdx];

    # Check if the interface name is extracted correctly and exists
    :if ([:len [/interface find name=$thisInterface]] > 0) do={
        :log info ("Loop detected, shutting down interface: " . $thisInterface);
        /interface set [find name=$thisInterface] disabled=yes;
    }
}
 
joshhboss
Member
Member
Posts: 301
Joined: Thu Aug 01, 2019 2:13 pm

Re: CRS326 loop-protect with pvid != 1 and VLAN filtering

Tue Feb 20, 2024 3:42 pm

Just bear in mind that the post you've quoted is more than 4 years old, so maybe RouterOS 7 has changed something about it. Not that I would give it too much chance.
Im still on 6.49 but we are going into an event right now so im nervous to make the change but my next event isnt until Mid march so maybe I can put in some bench time to try and get a few things understood..

Id like the CRS3X switches to..

Do loop-protect on ports on the bridge -- and storm control.. (because that doesnt seem to work either, because I figured it would stop the loop just the same way, and it doesnt)
Do a more accurate job of rate-limiting ports (especially on ingress.. the egress seems fine.. im talking about in the /interface/ethernet/switch/port section) I do not know how to do ingress ACLs so thats pretty much all I have right now to do that..
Id like to also see if there is a way to do port security similar to how the cisco switches do. limiting lets say 10 Macs per port..

Also this is more on me learning RSTP.. but I constantly give internet to areas when building out an event with a point to point but then move it to fiber, I want to be able to just leave the p2p up and connect the fiber and always select my root port as the fiber port.. ive been lucky and lately It just seems to pick it automatically but I read that, its not always the case..
Check this out..
viewtopic.php?t=204821