I have some servers at OVH. OVH provides a service called Vrack to connect your servers to a VLAN. I have created 5 VLANs and i'd like those VLANs to communicate. Since OVH does not provide routers to do so, I decided to use Debian servers connected to each one of my VLANs so that they can act as routers. I've set up 2 of them so that I can have redundancy. When one of the routers is down, the other one ensures that the communication is still working. Here's basically what the infrastructure looks like from the hosts on the VLANs :
Primary Router ------------ "Switch" ---------------- Backup Router
|
|
|
Host
The problem here is that I have 2 possible gateways on the same network and I'm not sure how to do this. I tried to set up static routes on hosts with metrics but when a router is down, it is not detected by the host.
------------- EDIT -----------------
As mention by eKKiM, using VRRP is exactly what I needed to achieve redundancy. I used Keepalived on both my routers. When the primary one is down, the backup one takes over the routing. I've set a virtual IP to use as gateway on the hosts. It works like a charm.
A common way to solve this problem is by using the Virtual Router Redundancy Protocol (VRRP). RFC2338
VRRP is a protocol that provides for automatic assignment of available IP routers to participating hosts. This increases the availability and reliability of routing paths via automatic default gateway selections.
On debian, keepalived implements an independent Virtual Router Redundancy Protocol framework for director failover.