Community discussions

 
User avatar
matiaszon
Member
Member
Topic Author
Posts: 305
Joined: Mon Jul 09, 2012 9:26 am

Load balancing with fail over (again)

Sat Apr 21, 2018 2:53 am

Trying to set up load balancing with fail over, but can't get the proper results.

WAN1: static IP, connection over PPPoE
WAN2: LTE, dynamic IP, non-public
LAN1: 10.10.10.0/24
LAN2: 192.168.83.0/24

The best would be to combine (bond) these two WANs, but since they come from two different ISPs, I suppose it's impossible, so at least I would be happy to set WAN1 as gateway for LAN1 and WAN2 for LAN2.
 
solar77
Member
Member
Posts: 437
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

Re: Load balancing with fail over (again)

Sat Apr 21, 2018 11:37 am

Did you try having both gateway in the same static routing entry to 0.0.0.0/0 and enable ping gateway? I read somewhere this should work as load balancing and fails-over as it's got the ping check.
MTCNA MTCTCE UEWA
 
pe1chl
Forum Guru
Forum Guru
Posts: 5923
Joined: Mon Jun 08, 2015 12:09 pm

Re: Load balancing with fail over (again)

Sat Apr 21, 2018 12:06 pm

You forgot to include the information on what you have done and what failed.
So we can do nothing to help you!
Proper documentation on how to set this up is on the WiKi.
https://wiki.mikrotik.com/wiki/Load_Balancing
 
anav
Forum Guru
Forum Guru
Posts: 3114
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada

Re: Load balancing with fail over (again)

Sat Apr 21, 2018 6:07 pm

So to be clear, which is true:
1. you want both LANS to use WAN 2, ONLY if WAN1 is unavailable?
2. you only want Lan1 to only use WAN1 and LAN2 to only use Wan 2?
3. You want both LANS to access either WAN, based on a per session basis - taking turns?
(regardless of where the request is coming from, the session requests alternate between the two WANs).
4. You want the LANs to access the WAN that is least loaded?
(the router decides how much traffic is passing either up or down or both through the WANs and picks the one with lightest load)


It is assumed that in cases 2-4, if one WAN goes down you still want the other to be accessible by all users (both LANS).

The only other question I have is the throughput of the 2 WANs.
For Taking Turns (round robin) it would make sense to even out the sessions based on capacity.
For example a WAN1 70/10 and WAN2 30/10 throughput it would make sense to setup taking turns on a
2/3 to 1/3 basis. Two sessions allocated to WAN1 for every session allocated to WAN2. etc.............
I'd rather manage rats than software. Follow my advice at your own risk! (Sob & mkx forced me to write that!)
 
User avatar
matiaszon
Member
Member
Topic Author
Posts: 305
Joined: Mon Jul 09, 2012 9:26 am

Re: Load balancing with fail over (again)

Sun Apr 22, 2018 7:14 pm

So to be clear, which is true:
1. you want both LANS to use WAN 2, ONLY if WAN1 is unavailable?
2. you only want Lan1 to only use WAN1 and LAN2 to only use Wan 2?
3. You want both LANS to access either WAN, based on a per session basis - taking turns?
(regardless of where the request is coming from, the session requests alternate between the two WANs).
4. You want the LANs to access the WAN that is least loaded?
(the router decides how much traffic is passing either up or down or both through the WANs and picks the one with lightest load)


It is assumed that in cases 2-4, if one WAN goes down you still want the other to be accessible by all users (both LANS).

The only other question I have is the throughput of the 2 WANs.
For Taking Turns (round robin) it would make sense to even out the sessions based on capacity.
For example a WAN1 70/10 and WAN2 30/10 throughput it would make sense to setup taking turns on a
2/3 to 1/3 basis. Two sessions allocated to WAN1 for every session allocated to WAN2. etc.............
I would like LAN1 to go through WAN1 and LAN2 through WAN2. In case if one of the WANs is down, the up WAN will be used by both LANs.
WAN1: 50/20 Mbps
WAN2: LTE, 15-30/15 Mbps
 
pe1chl
Forum Guru
Forum Guru
Posts: 5923
Joined: Mon Jun 08, 2015 12:09 pm

Re: Load balancing with fail over (again)

Sun Apr 22, 2018 8:31 pm

That should just work with the standard solution using marking.
Please post your config so we can see how closely you followed that and where you made a mistake.
 
anav
Forum Guru
Forum Guru
Posts: 3114
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada

Re: Load balancing with fail over (again)

Mon Apr 23, 2018 12:06 am

So basic no load balancing but
a. strict routing LAN1 to WAN1
B. LAN2 to WAN2

And failover in case one or the other fails, the other can be used.

Perhaps
mark routing prerouting IN-Interface LAN, source address list (create 192.168.xx.2-192.168.xx.254) action mark routing new mark LAN1_Traffic
mark routing prerouting IN-Interface LAN, source address list (create 192.168.yy.2-192.168.yy.254) action mark routing new mark LAN2_Traffic

Ensure you make two srcnat masquerade rules one for each LAN.
I believe this will ensure that outgoing traffic going out on a specific WAN (as per the routing below) when returned on the same WAN will get properly sent to the correct LAN.

Make two routing rules....
Destination 0.0.0.0
Gateway, the actual Gateway IP address provided by ISP1
Check gateway: ping
Distance = 1
Routing Mark LAN1_Traffic (from xx)

Destination 0.0.0.0
Gateway, the actual Gateway IP address provided by ISP2
Check gateway: ping
Distance = 1
Routing Mark LAN2_Traffic (from yy)

Now where I am not sure is how to do the fail over.................
I believe it may involve more routing rules...... for a total of FOUR!

LAN1
Destination 0.0.0.0 Gateway (IP address WAN1) CheckGateway: Ping, Distance = 1 Routing Mark - LAN1_Traffic
Destination 0.0.0.0 Gateway (IP address WAN2) CheckGateway: Ping, Distance = 2 Routing Mark - LAN1_Traffic

LAN2
Destination 0.0.0.0 Gateway (IP address WAN2) CheckGateway: Ping, Distance = 1 Routing Mark - LAN2_Traffic
Destination 0.0.0.0 Gateway (IP address WAN1) CheckGateway: Ping, Distance = 2 Routing Mark - LAN2_Traffic

In this way all LAN1 traffic will get routed to WAN1 with the lesser distance.
If the ping returns no results, the LAN1 traffic will be routed through WAN2, until WAN1 comes back online
Conversely, all LAN2 traffic will get routed to WAN2 with the lesser distance of 1
If the ping return no results, the LAN2 traffic will get routed through WAN1, until WAN2 comes back online.

Hope that is close!
I'd rather manage rats than software. Follow my advice at your own risk! (Sob & mkx forced me to write that!)
 
User avatar
matiaszon
Member
Member
Topic Author
Posts: 305
Joined: Mon Jul 09, 2012 9:26 am

Re: Load balancing with fail over (again)

Mon Apr 23, 2018 2:38 pm

LAN1
Destination 0.0.0.0 Gateway (IP address WAN1) CheckGateway: Ping, Distance = 1 Routing Mark - LAN1_Traffic
Destination 0.0.0.0 Gateway (IP address WAN2) CheckGateway: Ping, Distance = 2 Routing Mark - LAN1_Traffic

LAN2
Destination 0.0.0.0 Gateway (IP address WAN2) CheckGateway: Ping, Distance = 1 Routing Mark - LAN2_Traffic
Destination 0.0.0.0 Gateway (IP address WAN1) CheckGateway: Ping, Distance = 2 Routing Mark - LAN2_Traffic

It doesn't work. I don't know why, but I can't configure WAN2 interface as gateway, because it doesn't work (at the same time I can confgure interface as WAN1 gateway and it works). The problem is, that on WAN2 IP address changes from time to time and once it is changed, gateway stops working.
 
pe1chl
Forum Guru
Forum Guru
Posts: 5923
Joined: Mon Jun 08, 2015 12:09 pm

Re: Load balancing with fail over (again)

Mon Apr 23, 2018 3:08 pm

Don't configure an interface as your external gateway! That will cause performance problems if it works at all.
Use the methods available to configure a gateway. And don't ask questions about your own configuration when you have not shared it here.
 
anav
Forum Guru
Forum Guru
Posts: 3114
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada

Re: Load balancing with fail over (again)

Mon Apr 23, 2018 3:32 pm

LAN1
Destination 0.0.0.0 Gateway IP (IP address from ISP1 (not WANIP)) CheckGateway: Ping, Distance = 1 Routing Mark - LAN1_Traffic
Destination 0.0.0.0 Gateway IP (IP address from ISP2 (not WANIP)) CheckGateway: Ping, Distance = 2 Routing Mark - LAN1_Traffic

LAN2
Destination 0.0.0.0 Gateway IP (IP address from ISP2 (not WANIP)) CheckGateway: Ping, Distance = 1 Routing Mark - LAN2_Traffic
Destination 0.0.0.0 Gateway IP (IP address from ISP1 (not WANIP)) CheckGateway: Ping, Distance = 2 Routing Mark - LAN2_Traffic

It doesn't work. I don't know why, but I can't configure WAN2 interface as gateway, because it doesn't work (at the same time I can confgure interface as WAN1 gateway and it works). The problem is, that on WAN2 IP address changes from time to time and once it is changed, gateway stops working.
Concur with the advice. Hard to give advice to partial information.

As for the gateway comment. I have no idea what you are talking about.
The IP address used for gateway is not the WANIP of the router (IP assigned to you by the ISP), its the gateway IP your ISP provides.
Every ISP uses a gateway IP and this is normally static while the WAN IP assigned changes if its all dynamic ...........

Perhaps I confused you and hopefully the above clears up by what I meant to put in for gateway IP (not WAN IP).
I'd rather manage rats than software. Follow my advice at your own risk! (Sob & mkx forced me to write that!)
 
anavds
newbie
Posts: 38
Joined: Wed Apr 04, 2018 2:47 pm

Re: Load balancing with fail over (again)

Wed Apr 25, 2018 10:02 pm


LAN1
Destination 0.0.0.0 Gateway (IP address WAN1) CheckGateway: Ping, Distance = 1 Routing Mark - LAN1_Traffic
Destination 0.0.0.0 Gateway (IP address WAN2) CheckGateway: Ping, Distance = 2 Routing Mark - LAN1_Traffic

LAN2
Destination 0.0.0.0 Gateway (IP address WAN2) CheckGateway: Ping, Distance = 1 Routing Mark - LAN2_Traffic
Destination 0.0.0.0 Gateway (IP address WAN1) CheckGateway: Ping, Distance = 2 Routing Mark - LAN2_Traffic

In this way all LAN1 traffic will get routed to WAN1 with the lesser distance.
If the ping returns no results, the LAN1 traffic will be routed through WAN2, until WAN1 comes back online
Conversely, all LAN2 traffic will get routed to WAN2 with the lesser distance of 1
If the ping return no results, the LAN2 traffic will get routed through WAN1, until WAN2 comes back online.

Hope that is close!
The ping gateway for the LAN1/LAN2 second rules are redundant should read as follows: ( it is implied that As soon as the first gateway is back up the traffic will be routed back to that gateway).

LAN1
Destination 0.0.0.0 Gateway (IP address WAN1) CheckGateway: Ping, Distance = 1 Routing Mark - LAN1_Traffic
Destination 0.0.0.0 Gateway (IP address WAN2) Distance = 2 Routing Mark - LAN1_Traffic

LAN2
Destination 0.0.0.0 Gateway (IP address WAN2) CheckGateway: Ping, Distance = 1 Routing Mark - LAN2_Traffic
Destination 0.0.0.0 Gateway (IP address WAN1) Distance = 2 Routing Mark - LAN2_Traffic
 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 1435
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Randburg
Contact:

Re: Load balancing with fail over (again)

Wed Apr 25, 2018 10:59 pm


LAN1
Destination 0.0.0.0 Gateway (IP address WAN1) CheckGateway: Ping, Distance = 1 Routing Mark - LAN1_Traffic
Destination 0.0.0.0 Gateway (IP address WAN2) CheckGateway: Ping, Distance = 2 Routing Mark - LAN1_Traffic

LAN2
Destination 0.0.0.0 Gateway (IP address WAN2) CheckGateway: Ping, Distance = 1 Routing Mark - LAN2_Traffic
Destination 0.0.0.0 Gateway (IP address WAN1) CheckGateway: Ping, Distance = 2 Routing Mark - LAN2_Traffic

In this way all LAN1 traffic will get routed to WAN1 with the lesser distance.
If the ping returns no results, the LAN1 traffic will be routed through WAN2, until WAN1 comes back online
Conversely, all LAN2 traffic will get routed to WAN2 with the lesser distance of 1
If the ping return no results, the LAN2 traffic will get routed through WAN1, until WAN2 comes back online.

Hope that is close!
The ping gateway for the LAN1/LAN2 second rules are redundant should read as follows: ( it is implied that As soon as the first gateway is back up the traffic will be routed back to that gateway).

LAN1
Destination 0.0.0.0 Gateway (IP address WAN1) CheckGateway: Ping, Distance = 1 Routing Mark - LAN1_Traffic
Destination 0.0.0.0 Gateway (IP address WAN2) Distance = 2 Routing Mark - LAN1_Traffic

LAN2
Destination 0.0.0.0 Gateway (IP address WAN2) CheckGateway: Ping, Distance = 1 Routing Mark - LAN2_Traffic
Destination 0.0.0.0 Gateway (IP address WAN1) Distance = 2 Routing Mark - LAN2_Traffic

Nope, that is the purpose of distance
MTCNA, MTCTCE, MTCRE & MTCINE
 
anavds
newbie
Posts: 38
Joined: Wed Apr 04, 2018 2:47 pm

Re: Load balancing with fail over (again)

Wed Apr 25, 2018 11:28 pm

You mean the observation I made is CORRECT not NOPE- in that I don't need the second ping gateway.

BUT if the NOPE was for my use of the word IMPLIED, then Yes, when I said IMPLIED, I should have clearly stated what I meant by implied in that the function of distance ensures that when the primary route (with distance 1) is back up, the secondary route (distance =2 ) traffic path will be changed back to the primary path.
Wait until I try speaking CHECKOHSLOWVALKEYING

Who is online

Users browsing this forum: MSN [Bot] and 49 guests