Load Balancing: Difference between revisions

From MikroTik Wiki
Jump to navigation Jump to search
(2 intermediate revisions by the same user not shown)
Line 24: Line 24:


==Failover==
==Failover==
The device has Dual Wan connection and you want to create a link failover? In case, link to WAN-1 goes down and link to WAN-2 becomes active, you simply have to configure routes: [https://wiki.mikrotik.com/wiki/Two_gateways_failover Two gateway failover]
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=192.168.1.1 check-gateway=ping
/ip route add gateway=192.168.2.1 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==
==Firewall marking==

Revision as of 09:23, 20 May 2019

Introduction

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
ECMP Yes No
PCC Yes No
Nth Yes Yes
Bonding No Yes
OSPF Yes No
BGP Yes No

Methods

Failover

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=192.168.1.1 check-gateway=ping
/ip route add gateway=192.168.2.1 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)

Nth

Bonding

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

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

OSPF

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

BGP

External links