Community discussions

MikroTik App
 
pelli
newbie
Topic Author
Posts: 25
Joined: Fri Oct 07, 2011 5:06 pm

failover two wan + routing policy

Thu Jul 21, 2016 1:06 pm

Hello, i need to implement failover for two wan with routing policy.

The scenario is:

lan: 192.168.10.0/24
wan1: 192.168.1.0/24  gw 192.168.1.254
wan2: 172.16.10.2/24  gw 172.16.10.1

i need that all connection go to wan1 except  connection to site  google.com to go to wan2

if the wan1 down all traffic go to wan2 and after wan1 is ok return to original situation.

I woul use this script for failover http://wiki.mikrotik.com/wiki/Failover_Scripting

any suggestion for policy routing and failover implementation?

Thanks
 
pelli
newbie
Topic Author
Posts: 25
Joined: Fri Oct 07, 2011 5:06 pm

Re: failover two wan + routing policy

Thu Aug 04, 2016 11:23 am

any suggestion? thanks
 
pelli
newbie
Topic Author
Posts: 25
Joined: Fri Oct 07, 2011 5:06 pm

Re: failover two wan + routing policy

Tue Sep 06, 2016 10:02 am

any suggestion? thanks
 
User avatar
Deantwo
Member
Member
Posts: 332
Joined: Tue Sep 30, 2014 4:07 pm

Re: failover two wan + routing policy

Tue Sep 06, 2016 2:56 pm

I woul use this script for failover http://wiki.mikrotik.com/wiki/Failover_Scripting
Is there any reason you aren't just using that then?

Even more so the corrected version I already gave you.
See: http://forum.mikrotik.com/viewtopic.php ... 91#p544520
i need that all connection go to wan1 except  connection to site  google.com to go to wan2

if the wan1 down all traffic go to wan2 and after wan1 is ok return to original situation.
Ooh, well, that isn't really a scripting issue then.

Try adding this:
/ip firewall address-list
add address=google.com list=google.com
/ip route
add distance=1 gateway=172.16.10.1%Wan2 routing-mark=Google
add distance=2 gateway=192.168.1.254%Wan1 routing-mark=Google
/ip firewall mangle
add action=mark-routing chain=prerouting dst-address-list=google.com new-routing-mark=Google passthrough=no
That should make all traffic going to the google.com IP address go out of Wan2. If Wan2 is disable or its gateway unreachable, it should send it out of Wan1.
I guess you can modify the failover script to change the distance of the two google routes too if you want.
 
pelli
newbie
Topic Author
Posts: 25
Joined: Fri Oct 07, 2011 5:06 pm

Re: failover two wan + routing policy

Fri Sep 09, 2016 6:43 pm

I woul use this script for failover http://wiki.mikrotik.com/wiki/Failover_Scripting
Is there any reason you aren't just using that then?

Even more so the corrected version I already gave you.
See: http://forum.mikrotik.com/viewtopic.php ... 91#p544520
i need that all connection go to wan1 except  connection to site  google.com to go to wan2

if the wan1 down all traffic go to wan2 and after wan1 is ok return to original situation.
Ooh, well, that isn't really a scripting issue then.

Try adding this:
/ip firewall address-list
add address=google.com list=google.com
/ip route
add distance=1 gateway=172.16.10.1%Wan2 routing-mark=Google
add distance=2 gateway=192.168.1.254%Wan1 routing-mark=Google
/ip firewall mangle
add action=mark-routing chain=prerouting dst-address-list=google.com new-routing-mark=Google passthrough=no
That should make all traffic going to the google.com IP address go out of Wan2. If Wan2 is disable or its gateway unreachable, it should send it out of Wan1.
I guess you can modify the failover script to change the distance of the two google routes too if you want.
ok, is clear...thanks you for support!

Who is online

Users browsing this forum: No registered users and 8 guests