Hello, First of all sorry for my english ![]()
What we have:
- RB 1200;
- 2 internet providers: basic one on Enthernet 10, the second (for backup) on Ethernet 6
- PBX on IP x.x.x.22
What we need:
I need to use the connection on Eth 10 as default, but in case it fail automatic to switch to Eth 6. Then, when Eth 10 is up, to switch back.
At the same time, I need to have a NAT-Transversal connection to PBX (x.x.x.22) (for SIP) even when Eth 10 is used.
Have a nice day !!!
Thank you.
P.S. This script didn’t helped, not even switching to the second gateway ![]()
:local PingCount 3;
:local CheckIp1 8.8.8.8;
:local CheckIp2 8.8.4.4;:local rName [/system identity get name];
:local rDate [/system clock get date];
:local rTime [/system clock get time];:local isp1 [/ping $CheckIp1 count=$PingCount];
:local isp2 [/ping $CheckIp2 count=$PingCount];:local BackGw [/ip route get [find comment=“gw2”] disable];
#if main ISP is DOWN and backup ISP is UP then:
:if (($isp1=0) && ($isp2=$PingCount) && ($BackGw=true)) do={
:log warning “Set routes to gw2”;
/ip route disable [find comment=“gw1”];
/ip route enable [find comment=“gw2”];
}:local MainGw [/ip route get [find comment=“gw1”] disable];
#if main ISP is UP then:
:if (($isp1=$PingCount) && ($MainGw=true)) do={
:log warning “Set routes to gw1”;
/ip route enable [find comment=“gw1”];
/ip route disable [find comment=“gw2”];
}