|Home About Us Services Clients Resources Blog Careers Orderbox™||contact us Site map links|
Load balancing and failover across multiple ISP gateways via ARP
In our office, we use 2 ISPs for redundancy. Our original setup was to route both ISPs through an inexpensive D-Link DI-LB604 load-balancing router. This works well for sharing load between two working ISPs. But if you want to get both the load balancing feature plus automatic failover to the working one in case of a failure of the other, the LB604 won't cut it. For some reason, when in load-balancing mode, the LB604 has difficulty sensing when one of the ISPs has failed and will thus take many minutes before it switches to the working one.
Because both ISPs we utilize have bad days quite often and and disconnect several times during the course of a single day, it turns out the load balancer approach was not very satisfactory.
The alternative is to set the LB604 to work in "backup line" mode, wherein it sticks to one ISP as long that is working, and only switch to the second one upon failure. Although we did not try it, I suspect that under this mode, the failure detection might be more reliable. The problem with this setup, of course, is that when when both main and backup line have similar bandwidth sizes - like in our case - it is quite a waste to have one ISP remain idle most of the time. Plus, part of the reason we got a 2nd ISP was, apart from insuring against downtime, the need for additional bandwidth due to the number of users.
It turns out that if you are willing to split your load manually by having half the hosts on your network gateway through one ISP and the other half via the other, there is a way to set things up such that in case of a failure of one of the ISPs, you can very quickly switch to the other one thereby having your load-balancing cake (albeit rougher-grained) and eat it too (get failover).
In the method outlined below, you don't even need a load balancing router, but instead you use two regular routers plugged into the same switch. The key is to get half the machines on your network to use one router connected to ISP A, and the other half to use the other router connected to ISP B but with both routers set to the same IP address.
But why would you want both routers to have the same IP address? This is because if either ISP fails, you want the hosts connected to the failed ISP to be switched to the working one as quickly and as transparently as possible. Not requiring the IP address of their gateway to be changed is about as transparent as you can get.
But how do you achieve the above and how do you ensure that the machines on the network use the selected router even if both claim the same IP address? The answer is by manipulating the Address Resolution Protocol (ARP) tables. ARP is the protocol responsible for mapping an IP address to an actual physical device and it does this is via an IP-to-MAC address table whose entries, as it turns out, you can easily manipulate.
So, if you have two routers acting as gateways to two
different ISPs, one with MAC address
11-11-11-11-11-11-11 and the other, 22-22-22-22-22-22,
both set to the same IP address 192.168.0.1, simply set the
ARP table on some of your machines to map their gateway address
(e.g. 192.168.0.1 in this case), to the MAC address
of the first router while the other machines have their gateway
address pointing to the MAC address of the second router.
In Windows, you use the
arp -d 192.168.0.1 arp -s 192.168.0.1 11-11-11-11-11-11
while you do
arp -d 192.168.0.1 arp -s 192.168.0.1 22-22-22-22-22-22
for those intending to use the second router as gateway.
© by Andy Sy
Web Development / Rich Internet Applications (RIA) Development
|© 2003-2015 Neotitans Technologies Inc.||contact/hire us|