Site icon System Zone

MikroTik Load Balancing and Link Redundancy with PBR

In computer networking, the Load Balancing technique is used to send network traffic over multiple gateways. If you have multiple ISP connections available, you can use load balancing technique to establish a stable network. You may now ask, why will I use multiple ISP connections? What are the benefits to use multiple ISP connections in my network? For your satisfaction, the following points are some reasons to use load balancing technique in your network.

  1. No ISP can give you 100% uptime guarantee. So, it will be better to use more than one ISP connection to ensure 100% uptime network.
  2. Sometimes you may have dependency (such as Mail, IPPBX etc.) on your uplink ISP but their service is not so good. In this case, you can use another ISP which provides better service.
  3. Your current ISP is better but high paid bandwidth. In this case, you can purchase another ISP bandwidth which is cheap but their connection is good, not better.

If these are your current status, it is suggested to configure a load balancing and link redundancy network with multiple gateways. MikroTik Router has various load balancing and link redundancy methods (such as ECMP method, PCC method and PBR method) to establish a stable network. Among these, PBR (Policy Based Routing) is simple but efficient method to make a stable load balancing and link redundancy network. In this article, I will discuss how to create a load balancing and link redundancy network over two WAN connections using Policy Based Routing in MikroTik Router.

Network Diagram

To configure a load balancing and link redundancy network with Policy Based Routing (PBR), I am following a network diagram like the below image.

PBR Load Balancing and Link Redundancy

In this network, MikroTik Router’s ether1 port is connected to ISP1having IP network 192.168.30.0/30 and ether2 port is connected to ISP2 having IP network 172.30.30./30. On the other hand, ether3 port is connected to LAN network and its IP networks are 10.10.10.0/24 and 10.10.20.0/24 (categorized by GroupA and GroupB respectively). PC-1 and PC-2 are two LAN workstations. PC-1 is under GroupA network and PC-2 is under GroupB network.

After PBR load balancing and link redundancy configuration, GroupA traffics will pass through WAN1 connection and GroupB traffic will pass through WAN2 connection. If WAN1 is disconnected for any unwanted reason, all traffics (from GrpupA and GroupB) will pass through WAN2 connection until the WAN1connection comes back again. Similarly, if WAN2 is disconnected, all traffics (from GrpupA and GroupB) will pass through WAN1 connection and ensure a link redundancy network.

Load Balancing and Link Redundancy Configuration in MikroTik Router

 We will now start load balancing and link redundancy configuration in MikroTik Router according to the above network diagram. Complete configuration can be divided into the following five steps.

Step 1: Renaming Interface Name

We will first rename interface name to understand and remember the configuration easily. The following steps will show how to rename MikroTik interface name.

Interface List Window

Step 2: Assigning WAN and LAN IP

 We will now assign WAN and LAN IP addresses on our respected interface. The following steps will show how to assign IP address on MikroTik Router’s interfaces.

Address List Window

Step 3: Assigning DNS IP

DNS is required to resolve domain name to IP address. Without DNS server MikroTik Router cannot resolve domain name to IP address and fail to communicate with the public domain server. The following steps will show how to assign DNS IP in MikroTik Router.

Step 4: Firewall Configuration

Firewall is the place where we will create Policy for load balancing and link redundancy. In Firewall, we will do the following three types of configurations.

NATing Configuration

The local user cannot communicate with the public servers without masquerade NATing configuration. So, do the following steps to configure masquerade NAT in MikroTik Router.

Address Lists Configuration

We will now create our desired network groups in Firewall Address List. The following steps will show how to create network groups using Firewall Address List features.

Address Lists in Firewall

Mangle Rule Configuration

Mangle Rule creates policy for Policy Based Routing. As we have two groups, we will create two Mangle Rules to mark two different routing. The following steps will show how to create Mangle Rule to mark routing for incoming packets from LAN interface.

Mangle Rules in Firewall

Step 5: Routing Configuration

After creating policy using Mangle rule, we will now configure routing based on created policy and pass different groups to different WAN connections. The following steps will show how to create policy based routing in MikroTik Router.

Route List Window

Load Balancing and Link Redundancy configuration in MikroTik Router with Policy Based Routing has been completed. Now assign GroupA_Block IP to those users whose you want to pass through WAN1 connection and assign GroupB_Block IP to those users whose you want to pass through WAN2 connection. Being a link redundancy network, if the WAN1 connection goes down, all the network traffics (both GroupA snd GroupB) will pass through the WAN2 connection and if the WAN2 connection goes down, traffic will pass through the WAN1connection.

If you face any confusion to follow the above steps properly, watch the following video about MikroTik Load Balancing with Failover using Policy Based Routing. I hope it will reduce your any confusion.

How to configure Load Balancing and Link Redundancy network in MikroTik Router with Policy Based Routing has been discussed in this article. I hope you will now be able to configure a load balancing and link redundancy network with Policy Based Routing. However, if you face any confusion, feel free to discuss in comment or contact with me from Contact page.  I will try my best to stay with you.

Exit mobile version