Active/Active Load Balancing with Mikrotik RouterOS
If you have multiple internet connections or site to site tunnels, like VPN or IPIP, with multiple links, you may want to load balance between the links. With Mikrotik this is achieved very easily.
Lets take for example the below scenario:
ISP Link 1 Gateway IP : 184.108.40.206
ISP Link 2 Gateway IP : 220.127.116.11
If you want to give equal priority to both links, you can set the below route:
/ip route add dst-address=0.0.0.0 gateway=18.104.22.168,22.214.171.124 distance=1 check-gateway=ping
The above route will, for example, route the first packet to the internet on ISP link 1, the second on ISP link 2, the 3rd on ISP link 1 and so on.
If you would like to give higher priority to one of the links, for example if ISP link 1 has a bandwidth of 10M down/2M up and ISP Link 2 has a bandwidth of 2M down / 500K up you would want to prioritise the use of ISP link 1.
Taking the example above we will assign a ratio of 4:1 (ISP1:ISP2). We can acheive this with the route below:
/ip route add dst-address=0.0.0.0 gateway=126.96.36.199,188.8.131.52,184.108.40.206,220.127.116.11,18.104.22.168 distance=1 check-gateway=ping
In the above route will route the first four connections through ISP link 1, the fifth connection through ISP link 2 and so on.
The check-gateway=ping property will check if the route is still available by pinging the gateway ip. If it is not reachable, the route will not be used.
The above methods are very basic examples of load balancing but it gets the job done.
Post a Comment