saludos quien me ayuda con los script del failover de 4 wan

Desconectado jhonnywifi

  • Newbie
  • *
  • Mensajes: 2
  • Ubicación:
    • Ver Perfil
  • Me Gusta: 0
saludos a todos los amigos aficionados en el mikrotik
mi problema es que voy a colocar otro adsl a mi balanceo de 3 wan
ya tengo todas las reglas listas para copiar y pegar en la terminal del mk
pero el script del failover lo edite yo mismo basado en el que tengo configurado cosa que yo no hice por ser poco diestro en tema
pero e aprendido poco a poco solo quiero que vean el script y si esta algo mal pues me corrigen y gracias por la ayuda
aca abajo dejos los scritps:
el ultimo fue el que yo sume los demas esta igual trabajando en el equipo con 3 wan

--wan 1--
# Failover Script By Ðixon Villamizar - www.winetsl.com.ve

:global GA [/ip dhcp-client get [find interface=WAN1] gateway]
:global GB [/ip dhcp-client get [find interface=WAN2] gateway]
:global pingresultA
:global pingresultB
:if ([:len $GA] != 0) do={
:global pingresultA [/ping $GA interface=WAN1 count=3]
} else={
 :global pingresultA 0
}
#Si WAN1 esta activo:
:if ($pingresultA>0) do={
:local gatewayNuevo [/ip dhcp-client get [find interface=WAN1] gateway]
:local gatewayActivo [/ip route get [find routing-mark=wan1] gateway]
:if ("$gatewayNuevo%WAN1" != "$gatewayActivo") do={
/ip route set [find routing-mark=wan1] gateway=([/ip dhcp-client get [find interface=WAN1] gateway] . "%WAN1");
:log info "WAN1 activo y se actualiza Gateway"
}
}
#Si WAN1 se cae:
:if ($pingresultA=0) do={
:local status [/ip dhcp-client get [/ip dhcp-client find interface=WAN1] status ]
:if ($status="bound") do={
/ip dhcp-client set [find interface=WAN1] disabled=yes
:local d [/ip dhcp-client get [/ip dhcp-client find interface=WAN1] disabled ]
:if ($d=true) do={
/ip dhcp-client set [find interface=WAN1] disabled=no
}
}
:local pingresultB [/ping 208.67.220.220 interface=WAN2 count=10]
:if ($pingresultB>0) do={
:local gatewayNuevoB [/ip dhcp-client get [find interface=WAN2] gateway ]
:local gatewayActivoA [/ip route get [find routing-mark=wan1] gateway ]
:if ("$gatewayNuevoB%WAN2" != "$gatewayActivoA") do={
/ip route set [find routing-mark=wan1] gateway=([/ip dhcp-client get [find interface=WAN2] gateway ] . "%WAN2");
:log info "WAN1 inactivo se le asigna el Gateway del WAN2 "
}
}
}
--wan2--
# Failover Script By Ðixon Villamizar - www.winetsl.com.ve

:global GA [/ip dhcp-client get [find interface=WAN1] gateway]
:global GB [/ip dhcp-client get [find interface=WAN2] gateway]
:global pingresultA
:global pingresultB
:if ([:len $GB] != 0) do={
 :global pingresultB [/ping $GB interface=WAN2 count=3]
} else={
 :global pingresultB 0
}
#Si WAN2 esta activo:
:if ($pingresultB>0) do={
:local gatewayNuevo [/ip dhcp-client get [find interface=WAN2] gateway ]
:local gatewayActivo [/ip route get [find routing-mark=wan2] gateway]
:if ("$gatewayNuevo%WAN2" != "$gatewayActivo") do={
/ip route set [find routing-mark=wan2] gateway=([/ip dhcp-client get [find interface=WAN2] gateway ] . "%WAN2");
:log info "WAN2 activo y se actualiza Gateway"
}
}
#Si WAN2 se cae:
:if ($pingresultB=0) do={
:local status [/ip dhcp-client get [/ip dhcp-client find interface=WAN2] status ]
:if ($status="bound") do={
/ip dhcp-client set [find interface=WAN2] disabled=yes
:local d [/ip dhcp-client get [/ip dhcp-client find interface=WAN2] disabled ]
:if ($d=true) do={
/ip dhcp-client set [find interface=WAN2] disabled=no
}
}
:local pingresultA [/ping 208.67.222.222 interface=WAN1 count=10]
:if ($pingresultA>0) do={
:local gatewayNuevoA [/ip dhcp-client get [find interface=WAN1] gateway ]
:local gatewayActivoB [/ip route get [find routing-mark=wan2] gateway ]
:if ("$gatewayNuevoA%WAN1" != "$gatewayActivoB") do={
/ip route set [find routing-mark=wan2] gateway=([/ip dhcp-client get [find interface=WAN1] gateway ] . "%WAN1");
:log info "WAN2 inactivo se le asigna el Gateway del WAN1 "
}
}
}
--wan3--
# Failover Script By Ðixon Villamizar - www.winetsl.com.ve

:global GB [/ip dhcp-client get [find interface=WAN2] gateway]
:global GC [/ip dhcp-client get [find interface=WAN3] gateway]
:global pingresultB
:global pingresultC
:if ([:len $GC] != 0) do={
:global pingresultC [/ping $GC interface=WAN3 count=3]
} else={
 :global pingresultC 0
}
#Si WAN3 esta activo:
:if ($pingresultC>0) do={
:local gatewayNuevo [/ip dhcp-client get [find interface=WAN3] gateway ]
:local gatewayActivo [/ip route get [find routing-mark=wan3] gateway]
:if ("$gatewayNuevo%WAN3" != "$gatewayActivo") do={
/ip route set [find routing-mark=wan3] gateway=([/ip dhcp-client get [find interface=WAN3] gateway ] . "%WAN3");
:log info "WAN3 activo y se actualiza Gateway"
}
}
#Si WAN3 se cae:
:if ($pingresultC=0) do={
:local status [/ip dhcp-client get [/ip dhcp-client find interface=WAN3] status ]
:if ($status="bound") do={
/ip dhcp-client set [find interface=WAN3] disabled=yes
:local d [/ip dhcp-client get [/ip dhcp-client find interface=WAN3] disabled ]
:if ($d=true) do={
/ip dhcp-client set [find interface=WAN3] disabled=no
}
}
:local pingresultB [/ping 208.67.222.222 interface=WAN2 count=10]
:if ($pingresultB>0) do={
:local gatewayNuevoA [/ip dhcp-client get [find interface=WAN2] gateway ]
:local gatewayActivoB [/ip route get [find routing-mark=wan3] gateway ]
:if ("$gatewayNuevoA%WAN2" != "$gatewayActivoB") do={
/ip route set [find routing-mark=wan3] gateway=([/ip dhcp-client get [find interface=WAN2] gateway ] . "%WAN2");
:log info "WAN3 inactivo se le asigna el Gateway del WAN2 "
}
}
}
--wan4--
# Failover Script By Ðixon Villamizar - www.winetsl.com.ve

:global GC [/ip dhcp-client get [find interface=WAN3] gateway]
:global GD [/ip dhcp-client get [find interface=WAN4] gateway]
:global pingresultC
:global pingresultD
:if ([:len $GD] != 0) do={
:global pingresultC [/ping $GD interface=WAN4 count=3]
} else={
 :global pingresultC 0
}
#Si WAN4 esta activo:
:if ($pingresultC>0) do={
:local gatewayNuevo [/ip dhcp-client get [find interface=WAN4] gateway ]
:local gatewayActivo [/ip route get [find routing-mark=wan4] gateway]
:if ("$gatewayNuevo%WAN4" != "$gatewayActivo") do={
/ip route set [find routing-mark=wan4] gateway=([/ip dhcp-client get [find interface=WAN4] gateway ] . "%WAN4");
:log info "WAN4 activo y se actualiza Gateway"
}
}
#Si WAN4 se cae:
:if ($pingresultD=0) do={
:local status [/ip dhcp-client get [/ip dhcp-client find interface=WAN4] status ]
:if ($status="bound") do={
/ip dhcp-client set [find interface=WAN4] disabled=yes
:local d [/ip dhcp-client get [/ip dhcp-client find interface=WAN4] disabled ]
:if ($d=true) do={
/ip dhcp-client set [find interface=WAN4] disabled=no
}
}
:local pingresultC [/ping 208.67.222.222 interface=WAN3 count=10]
:if ($pingresultC>0) do={
:local gatewayNuevoA [/ip dhcp-client get [find interface=WAN3] gateway ]
:local gatewayActivoC [/ip route get [find routing-mark=wan4] gateway ]
:if ("$gatewayNuevoA%WAN3" != "$gatewayActivoC") do={
/ip route set [find routing-mark=wan4] gateway=([/ip dhcp-client get [find interface=WAN3] gateway ] . "%WAN3");
:log info "WAN4 inactivo se le asigna el Gateway del WAN3 "
}
}
}