Hi all
I have a RG750 configured with PCC and conencted to 2 upstream providers, every thing works great except when one the providers goes down the fail over does not happen. This is because the check-gateway only allows to check the next gateway, as I am connect to ISP controlled DSL modem I can’t configure the RG750 with the pppoe details.
So I have written a script that will periodically check say goolge and if it can’t reach it it will diabled the main route and enable the secondary, the problem I have is that when it checks google again because it can get to it through the secondary if fails back then on the next check fails over again. so it filp-flops.
Using winbox ping tool I can specify the interface to use to ping and I get the desired result but if I do this in the script I get no response.
This script from the console does not work ?
/ping 196.25.1.1 interface=ether1 interval=2 routing-table=GW1 count=3
Fail-Over Script
0 name="GW1" owner="admin" policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive last-started=Mar/05/2011 22:37:45 run-count=25
source=
:local i 0; {:do {:set i ($i + 1)} while (($i < 3) && ([/ping 196.25.1.1 interval=2 routing-table=GW1 count=3 interface=ether1]<=1))};
:if ($i>=3) do={
:log info "WAN1 Down";
/ip route disable [find comment=GW1];
/ip route enable [find comment="Backup1"];
} else { :log info "WAN1 UP";
/ip route enable [find comment=GW1];
/ip route disable [find comment="Backup1"];
}
IP ROUTE
0 A S ;;; GW1
dst-address=0.0.0.0/0 gateway=10.0.0.1 gateway-status=10.0.0.1 reachable ether1 check-gateway=ping distance=1 scope=30 target-scope=10 routing-mark=GW1
1 X S ;;; Backup1
dst-address=0.0.0.0/0 gateway=10.0.1.1 gateway-status=10.0.1.1 reachable ether2 distance=10 scope=30 target-scope=10 routing-mark=GW1
2 A S ;;; GW2
dst-address=0.0.0.0/0 gateway=10.0.1.1 gateway-status=10.0.1.1 reachable ether2 check-gateway=ping distance=1 scope=30 target-scope=10 routing-mark=GW2
3 X S ;;; Backup2
dst-address=0.0.0.0/0 gateway=10.0.0.1 gateway-status=10.0.0.1 reachable ether1 distance=10 scope=30 target-scope=10 routing-mark=GW2
4 ADC dst-address=10.0.0.0/24 pref-src=10.0.0.100 gateway=ether1 gateway-status=ether1 reachable distance=0 scope=10
5 ADC dst-address=10.0.1.0/24 pref-src=10.0.1.100 gateway=ether2 gateway-status=ether2 reachable distance=0 scope=10
6 ADC dst-address=10.10.0.0/24 pref-src=10.10.0.1 gateway=ether5 gateway-status=ether5 reachable distance=0 scope=10
IP FIREWALL MANGLE
add action=mark-connection chain=prerouting comment="" disabled=yes new-connection-mark=CM-GW1 passthrough=yes per-connection-classifier=src-address-and-port:2/0
add action=mark-connection chain=prerouting comment="" disabled=yes new-connection-mark=CM-GW2 passthrough=yes per-connection-classifier=src-address-and-port:2/1
add action=mark-connection chain=prerouting comment="CM for GW1" disabled=no in-interface=ether5 new-connection-mark=GW1 passthrough=yes per-connection-classifier=both-addresses-and-ports:2/0
add action=mark-connection chain=prerouting comment="CM for GW2" disabled=no in-interface=ether5 new-connection-mark=GW2 passthrough=yes per-connection-classifier=both-addresses-and-ports:2/1
add action=mark-connection chain=output comment="CM for GW1 - output" connection-mark=no-mark disabled=no new-connection-mark=GW1 passthrough=yes per-connection-classifier=both-addresses-and-ports:2/0
add action=mark-connection chain=output comment="CM for GW2 - output" connection-mark=no-mark disabled=no new-connection-mark=GW2 passthrough=yes per-connection-classifier=both-addresses-and-ports:2/1
add action=mark-connection chain=input comment="CM input GW1" connection-mark=no-mark disabled=no in-interface=ether1 new-connection-mark=GW1 passthrough=yes
add action=mark-connection chain=input comment="CM input GW2" connection-mark=no-mark disabled=no in-interface=ether2 new-connection-mark=GW2 passthrough=yes
add action=mark-routing chain=prerouting comment="RM for GW1" connection-mark=GW1 disabled=no in-interface=ether5 new-routing-mark=GW1 passthrough=yes
add action=mark-routing chain=prerouting comment="RM for GW2" connection-mark=GW2 disabled=no in-interface=ether5 new-routing-mark=GW2 passthrough=yes
any help would be appreciated