Community discussions

MikroTik App
 
sleimanr
Member Candidate
Member Candidate
Topic Author
Posts: 176
Joined: Mon Oct 18, 2010 9:31 am

If one route stopped

Mon Jul 04, 2011 8:52 am

i have 4 dsl lines, if one or route stopped how redirect to second route or third....

many thx
 
petrn
Member Candidate
Member Candidate
Posts: 179
Joined: Thu Jul 29, 2010 3:56 am

Re: If one route stopped

Mon Jul 04, 2011 10:02 am

Hi,
/ip route
add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out1
add disabled=no distance=3 dst-address=0.0.0.0/0 gateway=pppoe-out2
add disabled=no distance=5 dst-address=0.0.0.0/0 gateway=pppoe-out3
add disabled=no distance=7 dst-address=0.0.0.0/0 gateway=pppoe-out4
Petr
 
sleimanr
Member Candidate
Member Candidate
Topic Author
Posts: 176
Joined: Mon Oct 18, 2010 9:31 am

Re: If one route stopped

Sat Jul 09, 2011 12:31 am

not working?
 
petrn
Member Candidate
Member Candidate
Posts: 179
Joined: Thu Jul 29, 2010 3:56 am

Re: If one route stopped

Sat Jul 09, 2011 3:48 am

not working?
working for me ....
Petr
 
sleimanr
Member Candidate
Member Candidate
Topic Author
Posts: 176
Joined: Mon Oct 18, 2010 9:31 am

Re: If one route stopped

Sat Jul 09, 2011 8:35 am

how goes the line from gateway=192.168.1.1 to gateway=192.168.2.1
if 192.168.1.1 stopped
 
petrn
Member Candidate
Member Candidate
Posts: 179
Joined: Thu Jul 29, 2010 3:56 am

Re: If one route stopped

Sat Jul 09, 2011 1:16 pm

how goes the line from gateway=192.168.1.1 to gateway=192.168.2.1
if 192.168.1.1 stopped
route with 192.168.1.1 will become invalid, so next valid route (based on distance) will be used ...
You need to post more details:
Specific answers require specific questions. When in doubt, post the output of "/ip address print detail", "/ip route print detail", "/interface print", "/ip firewall export", and an accurate network diagram.
Petr
 
Ivoshiee
Member
Member
Posts: 471
Joined: Sat May 06, 2006 4:11 pm

Re: If one route stopped

Mon Jul 11, 2011 9:03 am

One route will not go invalid by itself (except when the physical line goes down). Something must check it: http://wiki.mikrotik.com/wiki/Two_gateways_failover.
For my own network scenario the check-gateway is doing more than just checking a gateway and disabling that very same route (my alternate gateway is not connected to the same router, but at other side of the internal network using the same physical network interface as default gateway would), so I am unable to use it and use some additional scripting around it.
 
User avatar
peterd
newbie
Posts: 46
Joined: Mon Nov 05, 2007 1:23 pm

Re: If one route stopped

Mon Jul 11, 2011 10:31 am

Hi,

In the case of having two modems plugged into a 750G and the dsl only going down the check gateway will not work, hence I wrote this small script that is combined with pcc, and it works well in our setups. Hope it helps, any input welcome.
:global ping1 [/ping 192.168.2.1 count=3 routing-table=ether1_traffic]
:global ping2 [/ping 192.168.3.1 count=3 routing-table=ether2_traffic]
:global gw1 [/ip route get number=0  gateway-status]
:global gw2 [/ip route get number=1  gateway-status]

:if (($ping1=0) && ($ping2=3) && ($gw1="192.168.2.1 reachable ether1")) do={/ip route disable numbers=[find gateway=192.168.2.1];  [:log info  "disabling route 2.1"];}
:if (($ping1=3) && ($ping2=3) && ($gw1!="192.168.2.1 reachable ether1")) do={/ip route enable numbers=[find gateway=192.168.2.1]; [:log info  "enabling route 2.1"];}

:if (($ping1=3) && ($ping2=0) && ($gw2="192.168.3.1 reachable ether2")) do={/ip route disable numbers=[find gateway=192.168.3.1];  [:log info  "disabling route 3.1"];}
:if (($ping1=3) && ($ping2=3) && ($gw2!="192.168.3.1 reachable ether2")) do={/ip route enable numbers=[find gateway=192.168.3.1]; [:log info  "enabling route 3.1"];}

:if (($ping1=0) && ($ping2=0)) do={[/ip route enable numbers=[find gateway=192.168.2.1]]; [/ip route enable numbers=[find gateway=192.168.3.1]]; [:log info  "fail safe enabling 2.1 and 3.1"];}

PJD
"I love it when a plan comes together."
 
Ivoshiee
Member
Member
Posts: 471
Joined: Sat May 06, 2006 4:11 pm

Re: If one route stopped

Mon Jul 11, 2011 11:23 pm

Actually, I can not use PING for gateway checking as my ISP will selectively filter out ICMP echo requests in case of "network overload" and they insist that PINGing the default gateway for network condition checking is bad thing to have. Strange as it may sound, but who am I to argue with them. So, I did it a bit differently:
1. Set the NetWatch to check the default gateway being up or down and just setting the status of it as a value of a global variable;
2. Scheduler will periodically store received byte count of that gateway interface and perform default route switchover only if these numbers match over two successive runs plus at the same time NetWatch reports as that default gateway being down as well.

I've yet to test it all out, but it should work.
 
petrn
Member Candidate
Member Candidate
Posts: 179
Joined: Thu Jul 29, 2010 3:56 am

Re: If one route stopped

Tue Jul 12, 2011 12:26 am

Actually, I can not use PING for gateway checking as my ISP will selectively filter out ICMP echo requests in case of "network overload" and they insist that PINGing the default gateway for network condition checking is bad thing to have.
and what about ARP:
/ip route add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=<gw ip> check-gateway=arp
...
...
Petr

Who is online

Users browsing this forum: AndyGs, Google [Bot], qadir52786, Shamey, sindy and 138 guests