** for example we have two separate links with two gateway IP,
we wants to disable or enable concern interface(ether1 or ether2) if gateway ping timeout
* If we wants montior/ ping gateway three times and script will run Ones each 1 minute (interval = 00:01:00)
ether1 = lnik1 = Interface IP 192.168.1.2 and gateway IP 192.168.1.1
ether2 = link2 = Interface IP 172.16.1.2 and gateway IP 172.16.1.1
** GoTo Winbox -> and Click
#System -> Scheduler -> + Add
------------------------------
interval = 00:01:00
:if ([ /ping 192.168.1.1 src-address=192.168.1.2 count=3] = 0) do={
[/interface disable ether1]
:log info "gateway timeout, disabling link1 ether1 interface"
}
:if ([ /ping 192.168.1.1 src-address=192.168.1.2 count=3] = 3) do={
[/interface enable ether1]
:log info "Link1 is now up enabling ether1 interface"
}
---------------------------
** script to check link2
----------------------------
System -> Scheduler -> + Add
interval = 00:01:00
:if ([ /ping 172.16.1.1 src-address=172.16.1.2 count=3] = 0) do={
[/interface disable ether2]
:log info "gateway timeout, disabling link2 ether2 interface"
}
:if ([ /ping 172.16.1.1 src-address=172.16.1.2 count=3] = 3) do={
[/interface enable ether2]
:log info "Link2 is now up enabling ether2 interface"
}
------------------------------
#Enjoy## Tayab Khan ###