Page 1 of 1

Load Balancing

Posted: Fri Nov 11, 2011 11:03 am
by zimbofury
Good day

I have setup load balancing with the following.

/ip address> print
Flags: X - disabled, I - invalid, D - dynamic
# ADDRESS NETWORK INTERFACE
0 10.33.0.2/24 10.33.0.0 WAN1
1 10.34.0.2/24 10.34.0.0 WAN2
2 10.35.0.2/24 10.35.0.0 WAN3
3 100.10.0.1/24 100.10.0.0 LAN

/ip firewall mangle> print
Flags: X - disabled, I - invalid, D - dynamic
0 chain=prerouting action=accept dst-address=10.33.0.0/24 in-interface=LAN

1 chain=prerouting action=accept dst-address=10.34.0.0/24 in-interface=LAN

2 chain=prerouting action=accept dst-address=10.35.0.0/24 in-interface=LAN

3 chain=prerouting action=accept dst-address=10.1.1.0/29 in-interface=LAN

4 chain=prerouting action=mark-connection new-connection-mark=WAN1_conn
passthrough=yes in-interface=WAN1 connection-mark=no-mark

5 chain=prerouting action=mark-connection new-connection-mark=WAN2_conn
passthrough=yes in-interface=WAN2 connection-mark=no-mark

6 chain=prerouting action=mark-connection new-connection-mark=WAN3_conn
passthrough=yes in-interface=WAN3 connection-mark=no-mark

7 chain=prerouting action=mark-connection new-connection-mark=WAN4_conn
passthrough=yes in-interface=WAN4 connection-mark=no-mark

8 chain=prerouting action=mark-connection new-connection-mark=WAN1_conn
passthrough=yes dst-address-type=!local in-interface=LAN
connection-mark=no-mark per-connection-classifier=both-addresses:4/0

9 chain=prerouting action=mark-connection new-connection-mark=WAN2_conn
passthrough=yes dst-address-type=!local in-interface=LAN
connection-mark=no-mark per-connection-classifier=both-addresses:4/1

10 chain=prerouting action=mark-connection new-connection-mark=WAN3_conn
passthrough=yes dst-address-type=!local in-interface=LAN
connection-mark=no-mark per-connection-classifier=both-addresses:4/2

11 chain=prerouting action=mark-connection new-connection-mark=WAN4_conn
passthrough=yes dst-address-type=!local in-interface=LAN
connection-mark=no-mark per-connection-classifier=both-addresses:4/3

12 chain=prerouting action=mark-routing new-routing-mark=to_WAN1
passthrough=yes in-interface=LAN connection-mark=WAN1_conn

13 chain=prerouting action=mark-routing new-routing-mark=to_WAN2
passthrough=yes in-interface=LAN connection-mark=WAN2_conn

14 chain=prerouting action=mark-routing new-routing-mark=to_WAN3
passthrough=yes in-interface=LAN connection-mark=WAN3_conn

15 chain=prerouting action=mark-routing new-routing-mark=to_WAN4
passthrough=yes in-interface=LAN connection-mark=WAN4_conn

16 chain=output action=mark-routing new-routing-mark=to_WAN1 passthrough=yes
connection-mark=WAN1_conn

17 chain=output action=mark-routing new-routing-mark=to_WAN2 passthrough=yes
connection-mark=WAN2_conn

18 chain=output action=mark-routing new-routing-mark=to_WAN3 passthrough=yes
connection-mark=WAN3_conn

19 chain=output action=mark-routing new-routing-mark=to_WAN4 passthrough=yes
connection-mark=WAN4_conn

/ip route> print
Flags: X - disabled, A - active, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, B - blackhole, U - unreachable, P - prohibit
# DST-ADDRESS PREF-SRC GATEWAY DISTANCE
0 A S 0.0.0.0/0 10.33.0.1 1
1 A S 0.0.0.0/0 10.34.0.1 1
2 A S 0.0.0.0/0 10.35.0.1 1
3 A S 0.0.0.0/0 10.33.0.1 1
4 S 0.0.0.0/0 10.34.0.1 2
5 S 0.0.0.0/0 10.35.0.1 3
6 ADC 10.33.0.0/24 10.33.0.2 WAN1 0
7 ADC 10.34.0.0/24 10.34.0.2 WAN2 0
8 ADC 10.35.0.0/24 10.35.0.2 WAN3 0
9 ADC 100.10.0.0/24 100.10.0.1 LAN 0

/ip firewall nat> print
Flags: X - disabled, I - invalid, D - dynamic
0 chain=srcnat action=masquerade out-interface=WAN1

1 chain=srcnat action=masquerade out-interface=WAN2

2 chain=srcnat action=masquerade out-interface=WAN3

3 chain=srcnat action=masquerade out-interface=WAN4

WAN 4 is no longer in use. I am able to reach the combined speeds of the 3 internet connections with a torrent program. However I am curious as to why WAN 2 and WAN 3 are not in Active state. In winbox they just appear blue as if unreachable.

Please may someone assist with a possible reason and check over my code. as far as i can see it is adequate.

Re: Load Balancing

Posted: Mon Nov 14, 2011 9:51 am
by zimbofury
can anyone help with this pls :S

Load Balancing

Posted: Mon Nov 14, 2011 5:07 pm
by cbrown
Because you are using the routes with routing marks and not the routes with the higher distance. It sounds like it is working right.

Re: Load Balancing

Posted: Tue Nov 15, 2011 9:55 am
by zimbofury
Yes. It seems to be an ISP issue. the DSL lines give issues at random between each other. If say one connection is timing out, will the router still choose that path? is there a way to make the router check if the connection is stable or not and cut it off till it stabilizes?

Thanks in advance.