Thu Mar 09, 2023 2:28 am
distance=5 dst=address=0.0.0.0/0 gwy=ISP_Primary routing-table=main check-gateway=ping
distance=10 dst=address=0.0.0.0/0 gwy=ISP_Secondary routing-table=main
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Using these simple routes you have accomplished most of what you desired,
All users will be pushed to WAN1 due to distance difference. If WAN1 goes down all will go to WAN1.
Thus all that is left is to take one vlan (lets say vlan10 192.168.10.0/24 and force it out of WAN2.
/routing table
add fib table=useWAN2
/ip route
add dst=address=0.0.0.0/0 gwy=ISP_Secondary routing-table=useWAN2
/routing rule
add action=lookup src-address=192.168.10.0/24 table=useWAN2
So basically what we are saying is that for any traffic from vlanX force it out wan2.
action=lookup means that if WAN2 is not available the router will then go to the main table to look for an alternate route such as to WAN1.
action=lookup-only-in-table means that the vlan would not be provided an alternate route.
Be careful because think about this, ALL traffic goes out WAN2!!
So if you have vlan10 to vlan20 and vlan30 traffic it wont go there.............
In this case you need additional routing rules
/routing rule { ORDER IS KEY }
add action=lookup dst-address=192.168.20.0/24 table=main
add action=lookup-only-in-table dst-address=192.168.30.0/24 table=main
add action=lookup src-address=192.168.10.0/24 table=useWAN2
Now we ensure before pushing all traffic out wan2, we take more finite traffic with specified destination and route it as required.