Community discussions

MikroTik App
 
PrimeYeti
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 65
Joined: Wed Mar 01, 2023 1:46 pm

Dual WAN Load Balancing

Wed Jun 21, 2023 12:55 pm

I am attempting to set this up with Mangle rules but it seems as if every solution I look at uses different rules and different amounts of rules to the next?

I tried just doing a mark-connection forward rule and then a mark-routing prerouting rule for the aforementioned connection mark but when I setup a route to tell all traffic with that routing mark to go out of my PPPoE1 interface I wasn't able to access the internet from my LAN. Is this incorrect? Could someone point me in the right direction please?

The end goal is just to create sticky routes that make it so that anything coming into PPPoe1 goes out PPPoe1 and the same with PPPoe2. I have had a look at the wiki but they seem to also bring PCC into the mix which I don't think should be necessary.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 21360
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Dual WAN Load Balancing

Wed Jun 21, 2023 2:37 pm

You are not being consistent.

If the title is dual wan load balancing, then you cannot say

I just want to have incoming on both WANs going out the same WAN it came in on.
That is not dual wan load balancing which implies ensuring the LAN users going out are using both WANs equitably.

So please clarify what your intentions are ( the real requirements )

https://www.youtube.com/watch?v=nlb7XAv57tw

https://mum.mikrotik.com/presentations/US12/steve.pdf
 
PrimeYeti
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 65
Joined: Wed Mar 01, 2023 1:46 pm

Re: Dual WAN Load Balancing

Wed Jun 21, 2023 3:41 pm

I just want to have incoming on both WANs going out the same WAN it came in on.
This is what I want which is a part of the load balancing, as if I had connections going out of random WANs then it's likely going to cause some issues for example with certain banking websites.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 21360
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Dual WAN Load Balancing

Wed Jun 21, 2023 3:52 pm

Well thats like saying you want the sun to come up in the morning etc........... What you describe is part of load balancing.
Did you look at the video and follow along?
 
PrimeYeti
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 65
Joined: Wed Mar 01, 2023 1:46 pm

Re: Dual WAN Load Balancing

Wed Jun 21, 2023 5:55 pm

That is exactly what I'm saying...which is why I want to work out how to do it.

The video provided uses PCC which I'm not adverse to using, but I just want to know how to do it only using mangle rules.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 21360
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Dual WAN Load Balancing

Wed Jun 21, 2023 5:59 pm

Well the only other way I am aware of that is viable besides PCC, is bandwith load balance.......
https://mum.mikrotik.com/presentations/US12/tomas.pdf
 
PrimeYeti
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 65
Joined: Wed Mar 01, 2023 1:46 pm

Re: Dual WAN Load Balancing

Wed Jun 21, 2023 6:05 pm

I have just done some more research and think I realise where my confusion is coming from. PCC from what I understand is used for the actual load balancing part of this config (divying up connections between links).

The part that I am trying to get the hang of is before actually setting up the load balancing config. I am just trying to make it so connections coming into WAN1 go out of WAN1, the load balancing side of things can wait for now :)
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 4141
Joined: Sun May 01, 2016 7:12 pm
Location: California
Contact:

Re: Dual WAN Load Balancing

Wed Jun 21, 2023 6:48 pm

At a higher level than PCC (or its cousin ECMP)... it's connection tracking in firewall that maintains the relationship to keep WAN1 on WAN1. So this part should be working without you doing anything. What PCC and its related connection-marks may cause a different routing decision, but if those are wrong, the tracked connection will also be wrong.

To @anav point here... it's really helpful to know what you're trying to do first...than get into the weeds of how PCC/connection-marks/routing tables/etc all work. With multiple WANs, it also important to know the properties of them to really know how to best load balance/failover/etc on them – since the configuration varies if WAN gets a DHCP address vs static IP, or one WAN is faster than the other, etc.
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 4141
Joined: Sun May 01, 2016 7:12 pm
Location: California
Contact:

Re: Dual WAN Load Balancing

Wed Jun 21, 2023 6:56 pm

The part that I am trying to get the hang of is before actually setting up the load balancing config.
If you have the ability to test things. While it wouldn't be complete... it may be easier to start with the default configuration, then add your 2nd WAN to it (making sure the 2nd WAN port is NOT a bridge port). If you set the default-route-distance in each WAN DHCP's client to same value to 1 (or if you have a static IP, in IP route use match the distance= on both 0.0.0.0 route for WAN1 and WAN2 — this will get you load balancing for LAN. This is ECMP load balancing. And if you look at /ip/route/print you'd see a "+" next to the two default route entires if this is setup.

Now incoming connections to the router (such as dst-nat or VPN endpoints to Mikrotik) won't work without more firewall configuration and routing tables... that where you need the firewall rules that do the new-connection-mark= stuff (from the manual or other posts). PCC is just a more complex version of ECMP, since you can control the split of traffic between the WANs – which you may still want, but I'd start with ECMP first since it needs less firewall stuff than PCC.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 21360
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Dual WAN Load Balancing  [SOLVED]

Wed Jun 21, 2023 9:50 pm

The point is that the configuration usually cannot be simply segmented as they interrelate.
In short however.

in pre-routing mark connections on each WAN coming in.
in-pre routing mark routes for those connection for each wan
create tables for such traffic
make output chain rules for that traffic to go out each WAN.
+++++++++++++++++++++++++++++++++++++++++++++

This should not conflict with other PCC rules that I am aware of.
As AMMO says, that should be relatively easy for you to test.

Who is online

Users browsing this forum: Pinacolada88, timotei, zigmars and 33 guests