Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Network load balancing is the ability to balance traffic across two or more WAN links without using dynamic routing protocols like BGP.Load Balancing aim is to spread traffic across multiple links to get better link usage. This can be done one per-packet or per-connection basis.

There are two type of balancing methods:

  • per-packet - each packet of a single stream can be forwarded over different links. This method will work reliably especially on TCP and secure connections only when you are able to control both balancing endpoints.
  • per-connection - all packets of the same connection (stream) is always sent over one link. This method is mandatory in setups where only one end of the balancing is under our control, for example, home router with multiple WAN connections.


MethodPer-connectionPer-packet


Firewall

marking

Mangle

Yes
NthYes
ECMP (Equal Cost Multi-Path)
Yes
No
PCC (Per Connection Classifier)YesNo
Other matchers
Nth
YesYes
ECMP (Equal Cost Multi-Path)YesNo
BondingNoYes
OSPFYesNo
BGPYesNo

 

...

Simple Failover

...

Example

Simplest failover setup would be This example explains how to use multiple gateways with one taking when one gateway is active and another one takes over when the first one fails.

To make this work, configure larger  fails. It begins with adding the gateways. Configure larger distance value for the secondary one, and check-gateway for the first one:

Code Block
languageros
/ip route add gateway=192.168.1.1 distance=1 check-gateway=ping
/ip route add gateway=192.168.2.1 distance=2

The first gateway will begin as it's distance is smaller (default 1); the check-gateway will make sure it the gateway is up only when actual traffic can reach the gateway. When the ping will fail, it will disable fails the first gateway will become inactive and the second one will take over and ,  and when the first one comes up, it will return to its functiongateway recovers  it will become active and make the second gateway to work again as a backup.