I have a Debian Wheezy server running Xivo (let's call it A), this server has 2 interfaces:
eth0
and eth1
.
There is no default gateway and only a few servers are statically reached from A. eth0
has a public IP and connects directly to a remote server (let's call it B), the second interface of A, eth1
is on a local network with another internet connection supposed to be used for different purpose.
In the routing table A, B is reachable through interface eth0
.
What I want is to set up a failover route that tries to connect through eth1
if the connection attempt fails on eth0
.
I have no access to the routers, and no dynamic routing from outside A can be involved.
So far I see different stuff like ip rule
, heartbeat HA
and other technologies but with this question, what I want to achieve is to determine if what I want to do is possible and if possible with what kind of technologies.
EDIT 1
I decided to rephrase my question because I feel like no one knows.
How can I monitor a link from one server to another and take action if the link is down?
It can also be related to the arp resolution because I'm virtually connected to the remote host and I know its MAC address.
I'm pretty sure there are already possibilities out in the jungle of the Internet, and I don't want to reinvent the wheel for that task.
EDIT 2
As the solution of the script is finally what I chose I'll accept it and reward it, but I added a sort of compilation of all I tried before using the script
Best Answer
I had a similar problem some time ago in reaching a remote server from a datalogger (Ubuntu) through an unstable HDSL connection (sometimes not working for days!). I've created a simple bash script running on the datalogger in crontab. The script worked like this:
It was not a refined solution but it worked in my scenario!