Cambiar al peer 2 cuando falle el peer 1 en una VPN con IpSec site to site

Hola soy Nuevo, ingrese a este foro para ver si alguien me puede ayudar con un Script para un Mikrotik. la funcion seria que pase al Peer 2 cuando falle el Peer 1.

el script es este:

{
:local Policy 1
:local Policy 2
:local Policy 3
:local Policy 4
:local Policy 5
:local Policy 6
:local Policy 7
:local Policy 8
:local Peer 1
:local Peer 0

:local PrimaryOK [:ping count=3 src-address=10.10.50.1 181.45.64.109];
:local SecondaryOK [:ping count=3 src-address=10.10.50.1 190.216.92.130];
:local PrimaryActive [/ip/ipsec policy get $PrimaryOK active];



# :log info "Status: $PrimaryOK $SecondaryOK $PrimaryActive";
# Test case: set $PrimaryOK 0;

:if ($PrimaryOK < 1 && $SecondaryOK > 1 && $PrimaryActive) do=
{
:log warn "switch to failover";

/ip/ipsec policy disable 1
/ip/ipsec policy disable 2
/ip/ipsec policy disable 3
/ip/ipsec policy disable 4
/ip/ipsec policy enable 5
/ip/ipsec policy enable 6
/ip/ipsec policy enable 7
/ip/ipsec policy enable 8

/ip/ipsec peer disable 1
/ip/ipsec peer enable 0

}
:if ($PrimaryOK = 3 && !$PrimaryActive) do=
{
:log warn "switch to primary";

/ip/ipsec policy enable 1
/ip/ipsec policy enable 2
/ip/ipsec policy enable 3
/ip/ipsec policy enable 4
/ip/ipsec policy disable 5
/ip/ipsec policy disable 6
/ip/ipsec policy disable 7
/ip/ipsec policy disable 8

/ip/ipsec peer disable 0
/ip/ipsec peer enable 1

}
}
 
Hola soy Nuevo, ingrese a este foro para ver si alguien me puede ayudar con un Script para un Mikrotik. la funcion seria que pase al Peer 2 cuando falle el Peer 1.

el script es este:

{
:local Policy 1
:local Policy 2
:local Policy 3
:local Policy 4
:local Policy 5
:local Policy 6
:local Policy 7
:local Policy 8
:local Peer 1
:local Peer 0

:local PrimaryOK [:ping count=3 src-address=10.10.50.1 181.45.64.109];
:local SecondaryOK [:ping count=3 src-address=10.10.50.1 190.216.92.130];
:local PrimaryActive [/ip/ipsec policy get $PrimaryOK active];



# :log info "Status: $PrimaryOK $SecondaryOK $PrimaryActive";
# Test case: set $PrimaryOK 0;

:if ($PrimaryOK < 1 && $SecondaryOK > 1 && $PrimaryActive) do=
{
:log warn "switch to failover";

/ip/ipsec policy disable 1
/ip/ipsec policy disable 2
/ip/ipsec policy disable 3
/ip/ipsec policy disable 4
/ip/ipsec policy enable 5
/ip/ipsec policy enable 6
/ip/ipsec policy enable 7
/ip/ipsec policy enable 8

/ip/ipsec peer disable 1
/ip/ipsec peer enable 0

}
:if ($PrimaryOK = 3 && !$PrimaryActive) do=
{
:log warn "switch to primary";

/ip/ipsec policy enable 1
/ip/ipsec policy enable 2
/ip/ipsec policy enable 3
/ip/ipsec policy enable 4
/ip/ipsec policy disable 5
/ip/ipsec policy disable 6
/ip/ipsec policy disable 7
/ip/ipsec policy disable 8

/ip/ipsec peer disable 0
/ip/ipsec peer enable 1

}
}
Hola, mira a ver si este script publicado en el foro, lo puedes adaptar a tus propósitos:
https://www.adslzone.net/foro/mikro...oleccion-scripting.575217/page-5#post-3595665

S@lu2.
 
Arriba