I'm looking for software to manage redundant Internet connections before writing my own. I'm sure a lot of people have written quick hacks to do this, but there are a lot of weird corner cases…

We have two Internet connections at work, and (unfortunately) not enough address space to run BGP, so unfortunately we're stuck with second-best solutions. One of the connections is substantially faster than the other anyway, so we use them as a primary and backup.

Currently, they're manually switched by running, e.g., ip rule del pref 2500 (to use the backup) or ip rule add pref 2500 from all lookup comcast (to add it back).

Unfortunately, the only way to determine if a connection is down is via ping or similar—both use an external modem-bridge or modem-router, so the Ethernet link stays up. The external devices sometimes know it's down, but not always (and I don't think they expose this in any useful way, like sending an ICMP unreachable or via SNMP.

  • Just needs to add/remove the ip rule. NAT, fwmark, etc., is already set up and works well. (And there are other complexities, including VPNs and dynamic routing internally via OSPF, that make letting something else control the firewall or routing tables problematic).
  • Needs to set a configured source (local) IP for ping, etc. connection checks—that'll make it go out the right ISP.
  • Would be nice if it could ping a couple IPs, some more frequently than others. E.g., frequently ping a host we control to check for any connectivity, infrequently ping some other hosts to eventually catch partial connectivity.
  • Would be nice if a configurable packet loss % also counted as down. Especially if it could compare the two links (so, e.g., loss near the remote end is canceled out).
  • Someday we may get a third link (we had a third in the past). It'd be nice if works with two backup links, too.

I'm aware of Net-ISP-Balance, but it appears to want control of the firewall and only support one ping IP per ISP.

  • this sort of thing is normally done on the router because it knows when its interfaces go up and down. but it looks like you have two routers, each handling one upstream link. is there any way you can replace the hardware to have just one router? or set them to dumb bridge mode and run pppoe or similar on a machine connected to both of them? or have the routers communicate interface status changes with each other? or configure them to use a remote logging host (a script could monitor interface status-change events)? – cas Aug 18 '17 at 23:54
  • IMO, ping isn't the right (or even a good) way to do this. it's a slow, inaccurate and indirect method of determining what you really want to know - interface up/down events. – cas Aug 18 '17 at 23:56
  • @cas Unfortunately, I have no way to get the interface down/up events, especially since they're not even on always on the CPE. Sometimes they're at one of the intermediate routers at the ISP... – derobert Aug 19 '17 at 18:37
  • Have you tried writing a script for it? Loop with sleep or cron if less frequent pings are also ok, use some array variables to find out which pings to do this time, query interface/ping results for packet loss, run other scripts to switch as appropriate. – dirkt Aug 21 '17 at 6:21
  • @dirkt I'm asking if someone else has already done this... Otherwise, I will be writing code to do it. – derobert Aug 21 '17 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.