Script_mikrotik_failover

  • Uploaded by: lcar197702
  • 0
  • 0
  • January 2021
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Script_mikrotik_failover as PDF for free.

More details

  • Words: 319
  • Pages: 2
Loading documents preview...
:log info "-------------------------------------------------------------------------------"; :log info " QUIMICA CMV GROUP "; :log info " Evaluando Servicios de Internet "; :log info "-------------------------------------------------------------------------------"; :local nPruebasPing 3; :local ipExterna "8.8.8.8"; :local hora [/system clock get time] :log info "Evaluando WAN1 $hora"; #:local rping [/ping $ipExterna interface="ether1-WAN1" count=$nPruebasPing]; :local rping [/ping $ipExterna routing-table="hacia_WAN1" count=$nPruebasPing]; # Si la respuesta de ping fue 0, entonces el ISP est� caido y se agrega a la lista de ispsCaidos :if ($rping=0) do={ :log info "Estado...... sin servicio"; if ([/ip firewall mangle get [find comment="WAN1"] disable]=no) do={ /system script run noip2 /ip firewall mangle disable [find comment="WAN1"]; :log info "New Conection Mark WAN1 Inhabilitado..!!!"; } } :if ([/interface get [find name="ether1-WAN1"] disable]=yes) do={ :log info "Motivo...... Interface WAN1 esta INHABILITADO"; } :if ($rping=3) do={ :log info "Estado...... Ok!"; if ([/ip firewall mangle get [find comment="WAN1"] disable]=yes) do={ /system script run noip1 /ip firewall mangle enable [find comment="WAN1"]; :log info "New Conection Mark WAN1 Habilitado..!!!"; } } :log info "-------------------------------------------------------------------------------";

:local rgwant [/ip route get [find distance=2] gateway]; :local rgwact [/ip route get [find distance=3] gateway]; :local hora [/system clock get time] :log info "Evaluando WAN2 $hora"; :log info "Gateway... $rgwant"; if ( $rgwact != $rgwant ) do={ /ip route set [find distance=2] gateway=$rgwact; :log info "Gateway actualizado a $rgwact"; }

:local rping [/ping $ipExterna routing-table="hacia_WAN2" count=$nPruebasPing]; # Si la respuesta de ping fue 0, entonces el ISP est� caido y se agrega a la lista de ispsCaidos :if ($rping=0) do={ :log info "Estado...... sin servicio"; if ([/ip firewall mangle get [find comment="WAN2"] disable]=no) do={ /ip firewall mangle disable [find comment="WAN2"]; :log info "New Conection Mark WAN2 Inhabilitado..!!!"; } } :if ([/interface get [find name="ether2-WAN2"] disable]=yes) do={ :log info "Motivo...... Interface WAN2 esta INHABILITADO"; } :if ($rping=3) do={ :log info "Estado...... Ok!"; if ([/ip firewall mangle get [find comment="WAN2"] disable]=yes) do={ /ip firewall mangle enable [find comment="WAN2"]; :log info "New Conection Mark WAN2 Habilitado..!!!"; } } :log info "-------------------------------------------------------------------------------";

More Documents from "lcar197702"

Script_mikrotik_failover
January 2021 0
January 2021 0
January 2021 0
Configuracion
January 2021 1
January 2021 0