3

I have 2 different home internet connections and I have an IP from each router's LAN (such as 10.0.0.2/24 and 10.0.1.2/24 with each ISP's routers being the .1) configured on my private server, which then distributes internet access to my network.

The problem is when one of my ISPs goes down I have to manually change my default gateway from 10.0.0.1 to 10.0.1.1 because those IPs are set in each router and the routers are not in bridge mode. Since the downtime has nothing to do with the routers at my home there's no way my server can know the routing table is down because the router is still answering ICMP packets.

The question is, does the Linux kernel support setting to check an IP through a gateway and using the state of that route to also change my gateways? For example, if I were to set 8.8.8.8 to always go through 10.0.0.1 and if that IP stopped responding then bring down the 10.0.0.1 default route as well, that'd work for me.

I know for a fact setting both my routers to bridge mode and letting my server do the PPPoE handshake would work best and avoiding having to do this but at least one of my routers doesn't support bridge mode.

  • Do you want to load balance the two connections? Can you run a routing protocol between the two routers (RIP is old but good enough for this simple case) so that if your default route on your laptop sends to router1 and isp1 is down then router1 will forward the packet to router2 without you needing to change anything on laptop. – icarus Nov 28 '16 at 22:55
  • Load balancing wouldn't help achieving redundancy (packets will continue being sent through both even if one ISP is down) and is undesirable due to how external websites and games handle connections (playing a game from 2 different internet IPs at the same time). Also the routers don't have any fancy protocols as they are just your average consumer level home router that comes with your basic internet plan, which is why I use a rooted Linux server (CentOS 7) for that. – Railander Nov 29 '16 at 0:13
  • 1
    Short of using a script, and pinging regularly something outside, and fiddling with routing metrics instead of tearing down one of the gateways to be able to monitor when it goes up, I am not seeing another solution. – Rui F Ribeiro Nov 29 '16 at 1:29
  • The purpose of making comments is to try and clarify the problem. Of course load balancing will not help redundancy, but it will allow you to make use of the bandwidth you are paying for. It appears that this is not important to you. Most consumer level home routers will run at least RIP. Since you know more about how your network is configured, can you please edit your question to show us the network topology? – icarus Nov 29 '16 at 1:43
3

does the Linux kernel support setting to check an IP through a gateway and using the state of that route to also change my gateways?

No. Something like that is not in scope for the kernel. You should do it in userspace.

The usual kind of software daemon that has the job of controlling and maintaining your routing table probably doesn't support it either because it runs standards-based routing protocols like OSPF and BGP to learn the correct routes to install from neighbouring routers, not "ping something remote and set default route accordingly if successful", but it might have such a feature...

I know for a fact setting both my routers to bridge mode and letting my server do the PPPoE handshake would work best and avoiding having to do this but at least one of my routers doesn't support bridge mode.

FWIW that's not a guarantee either. Just because the PPPoE session comes up doesn't mean that the (whole) Internet is reachable through that path. There might be a problem further along in the ISP network.

  • +1 for saying OSPF (although it is much more complicated than RIP), -1 for saying BGP. – icarus Nov 28 '16 at 23:48
  • I'm aware of the limitations within the ISP themselves, but from my own personal experience when my internet is down the PPPoE sessions goes down as well most of the time, so the chances that there could be some major problem within the ISP that isn't localised in my region (and therefore affecting my PPPoE connection) are slim enough that I can live with them. That said, isn't there some kind of specialized software that does this? I find it hard to think more people don't find this functionality useful as even I have needed it at work several times (i work at an ISP). – Railander Nov 29 '16 at 0:00
  • I actually do find BGP easier than having to work around the OSPF limitations. – Rui F Ribeiro Nov 29 '16 at 1:21
  • @icarus well, different requirements, different solutions. I would be quite happy to use BGP in a situation like this if the ISP were willing... but they almost certainly aren't willing on a consumer-grade connection. – Celada Nov 29 '16 at 10:38

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.