Page 1 of 1

Dual WAN Policy based Load Balancing with Failover

Posted: Mon May 23, 2016 7:52 am
by aliakberm92
Hello,

I am configuring my router and I want to setup the scenario as following:

LAN1 = 192.168.1.0/24 - eth5
LAN2 = 192.168.2.0/24 - eth5
WAN1 = 10.0.0.1 - eth1
WAN2 = 10.0.1.1 - eth2

I need to route my traffic from LAN1 to WAN1 only using policy based routing and LAN2 traffic over WAN2 only. But in case any of the links go down the traffic should be routed to the backup WAN i.e. if WAN1 goes down then LAN1 traffic should be diverted to WAN2. Also when the link comes up it should be diverted back to WAN1 only.

Any suggestions or help will be highly appreciated.

Re: Dual WAN Policy based Load Balancing with Failover

Posted: Mon May 23, 2016 9:07 pm
by tiftok
Hello
/ip firewall address-list add list=LAN1 address=192.168.1.2-192.168.1.254 ;
/ip firewall address-list add list=LAN2 address=192.168.2.2-192.168.2.254 ;
 /ip firewall mangle add chain=prerouting src-address-list=LAN1 action=mark-routing new-routing-mark=LAN1 ;
 /ip firewall mangle add chain=prerouting src-address-list=LAN2 action=mark-routing new-routing-mark=LAN2;
 /ip route
add distance=1 gateway=10.0.0.1 routing-mark=LAN1;
add distance=1 gateway=10.0.1.1 routing-mark=LAN2;

Have a good day :D