Community discussions

MikroTik App
 
User avatar
omega-00
Forum Guru
Forum Guru
Topic Author
Posts: 1167
Joined: Sat Jun 06, 2009 4:54 am
Location: Australia
Contact:

VRRP Scripting in ros v3.2

Fri Feb 08, 2008 7:06 am

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?
 
WirelessRudy
Forum Guru
Forum Guru
Posts: 3119
Joined: Tue Aug 08, 2006 5:54 pm
Location: Spain

Re: VRRP Scripting in ros v3.2

Mon Dec 29, 2008 1:25 am

I have almost the same problem. Did you ever got your fingers on it?

Rudy

Who is online

Users browsing this forum: firewall01, iDaemon and 8 guests