Router – Load balancing between two routers

load balancingrouter

I have the following network:

enter image description here

On LAN A, I have several hosts connected with two routers to LAN B. My goal is to use R1 and R2 to route traffic to LAN B/R3. For that, there are two solutions:

  • 50% of my hosts use R1, the other half R2 (like in the figure above), like by manually setting the gateway on each host.
  • Every hosts split their data between R1 and R2.

Cisco has a protocol called GLBP to achieve that, but in my case, R1 and R2 are Linux machines. So, how can I configure a load balancing system ?

Best Answer

Are you sure you wold like to load balance outbound? If hosts are just regular users with internet access, it is more likely that inbound balancing is needed. This is achieved by implementing routing protocols. For instance, if you run OSPF between R1-R2-R3, and both R1 and R2 will announce same subnet to R3, OSPF will do equal cost multipathing for you, i. e. load will be balanced. But if you would like outbound load distribution:

You can use different VLANs and VRRP implementation in Linux (keepalived). Distribute them in a way that half of your hosts resides in vlan A with VRRP master at R1, and the other half resides in vlan B with VRRP master at R2.

Related Topic