2 Gateways and one NAT-Transversal

Hello, First of all sorry for my english :slight_smile:


What we have:

  1. RB 1200;
  2. 2 internet providers: basic one on Enthernet 10, the second (for backup) on Ethernet 6
  3. 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 :frowning:

: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”];
}

You should be able to do this with routes…

Setup a default route with a ping check for the gateway with a lower distance to the primary internet connection and a second route with ping check and a higher distance to the secondary connection.

Then for nat transversal you should be able to dstnat inbound traffic between the devices you want.

already try that, and still no luck. can you contact me by email please

(gicos@bk.ru)

Thank you