I have 2 gateways on my network.
Currently I have to switch manually to the backup gateway.
What I want is something that when internet goes down on gateway 1, it would switch communication to Gateway 2. And then when gateway 1 internet returns, switch back.
Gateway 1 is uncapped Fiber.
Gateway 2 is paid per MB GSM
On other systems, I’m fine to change manually. But the Homeassist I want to stay online, even when my Fiber goes down.
Even if I have to make an automation task for this in Homeassist…
I’m using a cheap EdgeRouter X that works perfectly for this. Auto fail-over to the cellular modem and return to using the fibre when it comes back up.
Tom_I solution is probably the easiest, since you router will handle it.
If you have two different devices then it will not work.
You then have some different solutions.
The professional one is to get a load balancer in front of the gateways, but that will then be a single point of failure instead, so you will actually have to get 2 and have them communicate with Spanning Tree Protocol or similar to handle the routing.
The makeshift way with two net connections in the device.
I have not really tried this with HA or a Linux, but Windows automatically gives a wired connection higher priority than a WiFi connection, so it is possible to connect both connection types to the same network, but with different gateways.
The primary should then be on the wired and when the wired connection is shutdown, either by the device at the other end failing or by automation, then the secondary will take over.
I think it will work on HA too.
The primary router/gateway is a Mikrotik RB962UiGS-5HacT2HnT
The secondary router/gateway is a Huawei B660
Thing to keep in mind. I’m not talking about power failure. So both routers will have power. It is upstream failure. Like a break in the fiber line.
Was hoping of doing something on the Raspberry Pie 4 that would detect the internet connection on gateway 1. As I want only they pie to switch automatically.
You might still be able.
You need a sensor to react on, like a ping to a device after you router or maybe you public IP.
Then you need to react on it.
With a single router, then you might need SNMP calls or another interface.
With two routers and netcards dedicated to these, then you just need to shut a netcard down.