Linux box WAN failsafe configuration

linuxroutingwide-area-network

OK, I have linux box with one cable WAN and GPRS modem (or lets say another WAN connection that is normally down).

Is there any option to make this second link (GMPR/Ethernet/other) as backup connection that is used ONLY when the main link is not working properly?

I can detect the state of primary link simply by pinging specified server in internet (it is important that it cannot be the gateway, because sometimes the gateway is reachable, but rest of the internet is not…).

further – I can write this test in some bash script to periodically test connection and switch to backup link when the primary connection is broken.
But when changing – the default route changes to the second connection and I'm not able to check in background if the primary link is still down…

So – is there any solution to set default route for all applications to backup link and still be able to route pings through primary link? What makes it more complicated I cannot put static route to test server always through primary link, as those "applications" that run on server also try to connect to this server and I want them to use backup link when primary is down…

Something similar I saw on linksys RV042 dual WAN router. It can monitor primary connection (while secondary is down), and when primary goes down – it uses secondary link, but when primary is up again – the secondary is disabled and all trafic is redirected throug primary link again.

Best Answer

I have a similar problem with our cable provider - the gateway may be reachable but the rest of the internet is not. I used traceroute to find a pingable host on the edge of the providers network as a test host for pings. You do do the same to find a host as a ping test destination / static route candidate.

Related Topic