Feature request: VRRP sync groups

Alternative products such as Vyatta enable me to configure VRRP interfaces on a router in a group such that failure of a single interface in a group causes all interfaces in that group to go offline. This helps ensure that a virtual router with multiple VRRP instances will fail over correctly in the event of the failure of one of those interfaces.

I’ve tried and failed to set this up using scripting.

Regards

Andrew

+1
Yes, in case of many networks and interfaces (VLANs etc.), it should be very useful.

+1

It would help to get configurations more readable.

I will help :wink:

:foreach i in=[/interface vrrp find] do={ :if ([/interface vrrp get \$i priority] != 210) do={ [/interface vrrp set \$i priority=210] } }

Where 210 is the new wanted priority for the backup router.

Simply add this scripts as the on-master event on the backup router.

Hello everybody,

+1 for such feature

@tomaskir:

Do you have any guesses why your code would not work on my pair of RB1100AH with RouterOS 5.22?
Nothing happens when the script is run manually.

Regards,
gyorgy

No idea, but post these and we can figure it out :slight_smile:

/int vrrp exp com
/sys scr exp com

Sorry for late reply, I haven’t got any notification about your answer (forgot to set).

Finally, I could make scripting work. Here is the code:

:log info "ManualToMaster script run";
:foreach j in=[/interface vrrp find] do={ 
:put ("checking VRRP priority " . $j);
:if ([/interface vrrp get $j priority] != 200) do={ 
/interface vrrp set $j priority=200 
:put ("setting priority 200 on " . $j);
} 
}

It is basically your code slightly edited, but it didn’t execute until I have put the log command. Perhaps, I was missing a new line somewhere.

On the other hand, a feature comparable to pfSense CARP, which provides for all sessions to be kept alive would be nice.

Hi.
I have two Mikrotiks. First - main, secondary - reserve.
I use vrrp and have 3 vrrp interfaces:
-vrrp_lan
-vrrp-wan
-vrrp-vlan91
I want creat sync group, but ros not support it.
So, I finde here small script end modified it.
Mikrotik-1 have priority 200, Mikrotik-2 have priority-100.

On Mikrotik-2 f have two scripts.
If any vrrp interface is down:

:log info "ManualToMaster script run";
:local j
:foreach j in=[/interface vrrp find] do={ 
	:put ("checking VRRP master " . $j);
	:if ([interface vrrp get $j backup  ] = true) do={
		:put ("checking VRRP priority " . $j);
		:if ([/interface vrrp get $j priority] != 250) do={ 
		/interface vrrp set $j priority=250 
		:put ("setting priority 250 on " . $j);
		}
	} 
}

If any vrrp interface is up:

:log info "ManualToBackup script run";
:local j
:foreach j in=[/interface vrrp find] do={ 
	:put ("checking VRRP backup " . $j);
	:if ([interface vrrp get $j master  ] = true) do={
		:put ("checking VRRP priority " . $j);
		:if ([/interface vrrp get $j priority] != 100) do={ 
		/interface vrrp set $j priority=100 
		:put ("setting priority 100 on " . $j);
		}
	} 
}

For example, on Mikrotik-1 interface vrrp_lan is down. Then script on Mikrotik-2 change priority for interfaces vrrp-wan and vrrp-vlan91 from 100 to 250 and. Priority for interface vrrp-lan will 100. It help if vrrp-lan up on first router. If vrrp-lan up on first router, secondary script on Mikrotik-2 executed and make priority for vrrp-wan and vrrp-vlan91 100.

But I have any problems.
Simetimes, when some interface on Mikrotik-1 is down, I have priority for all vrrp-interfaces on Mikrotik-2 is 250. It prevents switch on Mikrotik-1 when all is well.

Do you have any ideas?