Community discussions

MikroTik App
 
mikeedinglis
just joined
Topic Author
Posts: 5
Joined: Fri Aug 19, 2022 11:10 pm

Dual wan & directing from 1 vlan to 1 wan

Thu Mar 09, 2023 12:06 am

Hey guys
So now i have a dual wan configuration which is set up as redundant (is wan1 fails, it turns over to wan2).
What if i want to keep that for all of the vlans except of one, which i want it to have WAN2 as the internet connection and if WAN2 fails then it turns to WAN1, but keep the rest of the network having WAN1 As default and WAN2 as backup
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3253
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Dual wan & directing from 1 vlan to 1 wan

Thu Mar 09, 2023 12:40 am

If you posted your config it would help to give less generic advice.

But essentially you need for follow an example that use routing tables, e.g. one for each of the WANs. From there, you can use a few different approaches. They're all similar to the load balance ones in the help. Even though you just don't want load balancing, config is same since you need multiple routing tables to do this. The help has the "menu" of the approaches:

https://help.mikrotik.com/docs/display/ ... +Balancing
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19105
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Dual wan & directing from 1 vlan to 1 wan

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.
 
Kumar88
just joined
Posts: 1
Joined: Wed Mar 15, 2023 7:47 am

Re: Dual wan & directing from 1 vlan to 1 wan

Wed Mar 15, 2023 7:52 am

Who is online

Users browsing this forum: Bing [Bot], keithy and 66 guests