I have a VRRP setup using a dedicated ethernet link between 2 routers, and some code to disable 2 other interfaces if the router becomes a slave or enabling 2 interfaces when a router becomes a master.
The primary router doesn’t need these as if it goes down then the secondary should be enabling 2 interfaces.
The problem:
I’ve tried writing a script directly in the master and slave sections of the VRRP interface, and although it sends me an email (part of the script) it doesn’t disable the interfaces. Strange thing is that the email part is at the end of the script so if there was an error it shouldn’t even finish.
also, if I copy and paste the code into a regular script and run that, interfaces are disabled correctly and the email is sent.
Copy of the code for becoming master:
/ip address set [/ip address find address=*inet address*] disabled=no
:delay 1
/interface ethernet set [/interface ethernet find name="LAN1"] disabled=no
:delay 1
/interface ethernet set [/interface ethernet find name="LAN2"] disabled=no
:delay 1
/tool e-mail send from=removed@removed.com to=removed@removed.com server=*removed* subject="Secondary router has become Master" body="Primary router appears to have failed, secondary has taken over."
:log error "Router has become Master VRRP"
Copy of code for becoming slave:
/ip address set [/ip address find address=*inet address*] disabled=yes
:delay 1
/interface ethernet set [/interface ethernet find name="LAN1"] disabled=yes
:delay 1
/interface ethernet set [/interface ethernet find name="LAN2"] disabled=yes
:delay 1
/tool e-mail send from=removed@removed.com to=removed@removed.com server=*removed* subject="Secondary router has become Slave" body="Primary router appears to be back online, secondary has reverted to slave."
:log error "Router has become Slave VRRP"
Has anyone else had this problem, or can duplicate this issue?