Difference between revisions of "Load Balancing"

From MikroTik Wiki
Jump to navigation Jump to search
Line 40: Line 40:
* [[Load Balancing over Multiple Gateways]]
* [[Load Balancing over Multiple Gateways]]
* [[Manual:Load balancing multiple same subnet links]]
* [[Manual:Load balancing multiple same subnet links]]
* [[Manual:Failover with firewall marking]]

==ECMP (Equal Cost Multi-Path)==
==ECMP (Equal Cost Multi-Path)==

Revision as of 07:51, 24 July 2019


Load Balancing is a method aiming to spread traffic across multiple links to get better link usage. This can be done one per-packet or per-connection basis.

Method Per-connection Per-packet
Firewall marking Yes Yes
PCC Yes No
Nth Yes Yes
Bonding No Yes
BGP Yes No



This example explains how to use multiple gateways with one taking over when first fails. It begins with adding the gateways. Set bigger distance value for the secondary one, and check-gateway for the first one:

/ip route add gateway= check-gateway=ping
/ip route add gateway= distance=2

That's all, there are no more steps!

The first gateway will begin as it's distance is smaller (default 1); the check-gateway will make sure it's up; when the ping will fail, it will disable the first gateway and the second will take over; when first one comes up, it will return to its function.

Firewall marking

This method uses firewall packet marking to select one from multiple gateways.

ECMP (Equal Cost Multi-Path)

This method uses multiple gateway with same cost.

PCC (Per Connection Classifier)



Can combine multiple links to achieve: higher speed, failover, load balancing.

More detailed information about "bonding" you can find here: Manual:Interface/Bonding


Two or more links are setup with dynamic routing protocol OSPF with equal cost. Then equal multipath routing is used.


External links