ok, i did the setup again and now the ping work's in link fail-over mode (adsl line)
Now i have a new ping related problem.
When both connections are up, i can ping/traceroute any ip on the main link but if i select the interface to be the second one (adsl) with the first one connected, i can't ping/trace anything. I want to monitor an external host on the second link only, to know when the back-up line is down (and i have no fail-over).
my setup is:
/ip routes
# DST-ADDRESS PREF-SRC GATEWAY DISTANCE
0 A S ;;; Default Route
0.0.0.0/0 81.181.x.x 1
1 S 0.0.0.0/0 192.168.1.1 2
2 A S ;;; ping facebook on gateway 1
69.171.229.11/32 ether1-gateway 1
3 ADC 81.181.x.x/24 81.181.x.x ether1-gateway 0
4 A S ;;; ping wiki.ro on gateway 2
91.198.174.225/32 ether2-gateway2 1
5 ADC 192.168.1.0/24 192.168.1.2 ether2-gateway2 0
6 ADC 192.168.13.0/24 192.168.13.1 ether3-master-l... 0
fail over scripts:
script 1:
:local i 0; {:do {:set i ($i + 1)} while (($i < 5) && ([/ping 69.171.229.11 interval=3 count=1]=0))};
:if ($i=5 && [/ip route get [find comment="Default Route"] distance]=1) do={:log info "PRIMAYR LINK DOWN"; /ip route set [find comment="Default Route"] distance=3
:delay 15s
/tool e-mail send to="
alerts@xxxx.ro" subject=([/system identity get name] . \
" net is down") from=
tehnic@xxxx.ro body=([/system identity get name] . "-" . [/system clock get time] . \
" call the man")
:log info "mail sent"
}
script 2:
:local i 0; {:do {:set i ($i + 1)} while (($i < 5) && ([/ping 69.171.229.11 interval=3 count=1]=1))};
:if ($i=5 && [/ip route get [find comment="Default Route"] distance]=3) do={:log info "PRIMARY LINK UP";
/ip route set [find comment="Default Route"] distance=1;
/tool e-mail send to="
alerts@xxxx.ro" subject=([/system identity get name] . \
" net is UP") from=
tehnic@xxxx.ro body=([/system identity get name] . "-" . [/system clock get time] . \
" main link is up")
:log info "mail sent"
}
to check my back-up link while the main one is up i do this:
script 3:
:local i 0; {:do {:set i ($i + 1)} while (($i < 5) && ([/ping
91.198.174.225 interval=3 count=1]=0))};
:if ($i=5) do={:log info "ADSL LINK DOWN";
/tool e-mail send to="
alerts@xxxx.ro" subject=([/system identity get name] . \
" adsl is down") from=
tehnic@xxxx.ro body=([/system identity get name] . "-" . [/system clock get time] . \
" adsl")
:log info "mail sent"
}
script 4:
:local i 0; {:do {:set i ($i + 1)} while (($i < 5) && ([/ping
91.198.174.225 interval=3 count=1]=1))};
:if ($i=5) do={:log info "ADSL LINK UP";
/tool e-mail send to="
alerts@xxxx.ro" subject=([/system identity get name] . \
" ADSL LINK UP") from=
tehnic@xxxx.ro body=([/system identity get name] . "-" . [/system clock get time] . \
" ADSL LINK UP")
:log info "mail sent"
}
script 1 and 2 are scheduled to run every 10s and 3 and 4 every 1m.
1and 2 work fine. 3 and 4 don't work. When 3 run's it reports link down even if link is up.