Load Balance with Fail Over

Hi all,
I have done configuration of load balancing with Failover.

Load Balancing is working Perfect but fail over is NOt working. The configuration is.

/ip route

[admin@MikroTik] ip route> print detail
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf
0 ADC dst-address=10.10.1.0/30 pref-src=10.10.1.2 interface=ether1 scope=10
target-scope=0

1 ADC dst-address=10.10.2.0/30 pref-src=10.10.2.2 interface=ether2 scope=10
target-scope=0

2 ADC dst-address=192.168.1.0/30 pref-src=192.168.1.1 interface=ether3
scope=10 target-scope=0

3 A S dst-address=0.0.0.0/0 gateway=10.10.1.1 check-gateway=ping
interface=ether1 gateway-state=reachable scope=255 target-scope=10
routing-mark=odd

4 A S dst-address=0.0.0.0/0 gateway=10.10.2.1 check-gateway=ping
interface=ether2 gateway-state=reachable scope=255 target-scope=10
routing-mark=even

5 A S dst-address=0.0.0.0/0 gateway=10.10.2.1 interface=ether2
gateway-state=reachable scope=255 target-scope=10

6 S dst-address=0.0.0.0/0 gateway=10.10.1.1 interface=ether1
gateway-state=reachable distance=2 scope=255 target-scope=10

[admin@MikroTik] ip route>

If i disconnect either line, it WONt work , What to do.

Thanks

ASHISH

sometimes, problem happen not in the next gateway, but somewhere in internet.
check gateway feature in static route, check only the connection to the gateway.
if you want to set a fail over system and check your line further,
you have to use netwatch and do scripts if gateway problem happen.

Do you Think it will WORK..

ASHISH

sure, why not?

and how you mangle packets (mark with routing mark)?
so, what you have in mangle

Yes, Routing Mark.

I have done with the wiki example.

Load Balance is working fine, But the failover is NOT working Properly, Sometimes it works and its taking time to cange over, Any other idea

Hi,

I have also implemented load balancing in my setup. I have one question. If I have 2 wan links of 256kbps & 1 Mbps, how load balancing will happen ?

B’coz as per wiki every alternate packet will be passed through the wan links and in my setup one wan link is 256 & other one is 1 Mbps. What will happen
if the 256 kbps gets overloaded. Will the packets belong to 256 link get diverted to 1 mbps link once the 256 link is full ?

Thanks in advance.

Ravin

If your line 1 with 256 Kbps gets full, it will divert all the traffic to the second line with 1 Mbps.

You can check Practically…Its working

hello
paste me only Fail over scripts i have 2 adsl for different isp

http://wiki.mikrotik.com/wiki/Two_gateways_failover

ASHISH

Hi,

Have installed load balancing & fail-over system in Mikrotik. Now I want to make sure that load balancing works perfectly.
How can I check whether it’s functioning properly. Is there any method by which I can check.

Fail-over works fine when I disable the working route, the packets are routed to the 2nd route. But if I remove the network
cable from working route, change over doesn’t happen.

Thanks
Ravin

Hi

I have been using fail-over and load balancing features in mikrotik. Recently I observed a problem in mikrotik. I have two bandwidths coming
from 2 ISP (ISP-a-1 Mbps + ISP-b-2 Mbps). Now the problem is that using load balancing features I’m using only 1 mbps from 2 mbps line (ISP-b). I checked my
usage with MRTG and it shows only 1 Mbps is being used out of 2 mbps link. How can I overcome this problem. I have been paying for 2 mbps and using only
1 mbps from ISP-b and 1 mbps from ISP-a. Load balancing is done by sending alternate packets to both the links. My one link is only 1 mbps and I think
that’s the reason mikrotik is using only 1 mbps from another 2 mbps link.

Awaiting your reply.

Thanks & Regards,
Ravin

in mangle you need to change NTH to divide traffic on three (nth=2,1,0) , and add two new mangle

/ ip firewall mangle
add chain=prerouting in-interface=Local connection-state=new nth=2,1,0 \
    action=mark-connection new-connection-mark=2M-1ST passthrough=yes comment="" \
    disabled=no
	
add chain=prerouting in-interface=Local connection-mark=odd action=mark-routing \
    new-routing-mark=2M-1ST passthrough=no comment="" disabled=no 
	
add chain=prerouting in-interface=Local connection-state=new nth=2,1,1 \
    action=mark-connection new-connection-mark=2M-2ND passthrough=yes comment="" \
    disabled=no 
	
add chain=prerouting in-interface=Local connection-mark=even action=mark-routing \
    new-routing-mark=2M-2ND passthrough=no comment="" disabled=no
	
add chain=prerouting in-interface=Local connection-state=new nth=2,1,2 \
    action=mark-connection new-connection-mark=1M passthrough=yes comment="" \
    disabled=no 
	
add chain=prerouting in-interface=Local connection-mark=even action=mark-routing \
    new-routing-mark=1M passthrough=no comment="" disabled=no

last add new default route for new routing mark to use 2M line

/ ip route 
add dst-address=0.0.0.0/0 gateway=10.111.0.1 scope=255 target-scope=10 routing-mark=1M check-gateway=ping 

add dst-address=0.0.0.0/0 gateway=10.112.0.1 scope=255 target-scope=10 routing-mark=2M-1ST check-gateway=ping 

add dst-address=0.0.0.0/0 gateway=10.112.0.1 scope=255 target-scope=10 routing-mark=2M-2ND check-gateway=ping 

add dst-address=0.0.0.0/0 gateway=10.112.0.1 scope=255 target-scope=10

add dst-address=0.0.0.0/0 gateway=10.111.0.1 scope=255 target-scope=10 distance=2

=== sorry for my bad english

Thank you for your reply.

Surely, I’ll implement this solution. But can you please explain me the parameters in nth. What this values stand for?

Regards,
Ravin

A question for you, how to do load balance with failover with 2 adsl modems if it asign to me dynamyc ip addresing?

how i put it
(1 ADC dst-address=10.10.2.0/30 pref-src=10.10.2.2 interface=ether2 scope=10
target-scope=0)

OR

( A S dst-address=0.0.0.0/0 gateway=10.10.1.1 check-gateway=ping
interface=ether1 gateway-state=reachable scope=255 target-scope=10
routing-mark=odd)


on my MIKROTIK if my ip on eth1 and eth2 will change?

do you have an example? please