4 ms·
Ask HN: A network device that doesn't exist?
I am not a programmer, nor an IT or network expert, so please be kind if you think that what I am asking for is a solved, elementary problem.
I am struggling to find a programmable device that can switch among a few RJ45 sockets for failover functions.
The problem:
I have a LAN where connected devices are connected to the gateway, for the sake of the question, the gateway is 192.168.1.1.
For some reasons the devices connected to the LAN have static IP addresses and the gateway is also "fixed" to 192.168.1.1.
For some other reasons the actual DSL router(s) have all their IP address set as 192.168.1.1.
From time to time[1] the "main" DSL router connection may fail (due to the router itself, its power adapter, ISP, cable, whatever) and I have a "backup" DSL router/modem connected to a separate DSL line and a third one with a (slower, but good enough) 4G SIM.
My current (caveman) manual method is to keep the two backup routers not connected to the network and in case of failure of the main one simply disconnect the RJ45 cable from it and insert it in one of the two backup routers.
There are manual switchboxes that allow switching among 2 or 4 network sockets, example:
http://www.cablesonline.com/abrjswitbox3.html
Using one of them would simplify switching when there is a failure when I am not physically present, as the instructions on the phone would amount to "Rotate the selector to B, if you still have no internet rotate it to C." (as opposed to "Disconnect the yellow cable from the white router and insert it in the back of the blue one, if you still have no internet, disconnect the yellow cable from the blue router and insert it in the back of the smaller white one") .
I know I could use a small router such as the Microtik hEX (RB750gr3):
https://mikrotik.com/product/RB750Gr3
But that would imply that the router gets the 192.168.1.1 and that the three DSL routers get addresses in another range, let's say 192.168.2.1, 192.168.2.2 and 192.168.2.3 (and this change needs to be done on at least one of the routers by the ISP) and, if - for whatever reasons - the Microtik router itself fails I cannot bypass it without changing the gateway on all connected devices (doable, but complex and taking a lot of time) or changing the IP address of the (working) DSL router (which is anyway complex and at least in one case not possible).
The "ideal" solution (in my perverted mind) would be something like the manual switchbox (that knows nothing about IP addresses but simply connects the IN port to the chosen OUT one), but capable of having some sort of failover function and automatically switching to the next RJ45 in case of missing internet connection AND somehow notifying that the main router/modem/connection is down and the router/modem/connection in use is the first or second backup one.
Maybe something like this does actually exist but I cannot find one?
Or there are other possible solutions that you can suggest?
- mikewarot 3y agoI went down this road about 15 years ago as the IT person for a small firm. My first pass at it was a linux box with 2 network cards, and 3 addresses (2 public IP addresses on eth0, and a local address on eth1). Linux only has one routing table, so I had to use ebtables, and ipchains (I think?) to mark packets as they came in, and route them back out correctly. It worked well, but I was worried about the long term stability of it. Then I found out that SonicWall made a box that did failover automatically, and never looked back. I strongly suspect there is an open source project which does this these days.
- h2odragon 3y ago> Linux only has one routing table, Not the case for 20 years+. see "TABLE" in `ip route help` and `ip ro ls table all` to see all the route tables you currently have active... you might not have seen the 'local' routes before
- mikewarot 3y agoThat's cool.... the situation we were in was that we had multiple public ip addresses in each of our class C static addresses, but no BGP routing because we were small fry. I used DNS round robin so that from the outside world, it would try either route in, then forward those packets in to the appropriate server. Its good to see you don't have to mark those packets manually any more.
- nazgulsenpai 3y agoOPNsense has configurable multi-wan support. We relied on it pretty heavily at a previous employer where unreliable we were forced to rely on unreliable DSL/cable connections for branch offices. https://docs.opnsense.org/manual/how-tos/multiwan.html https://docs.opnsense.org/manual/how-tos/multiwan.html
- huhtenberg 3y agoA simple homebrew option would be to get an intermediary box @ 192.168.1.1, stick all three routers into it, but keep only one of three links up. Then have a script on the box ping outside and switch to the next router on ping failure. I.e. if (ping 1.1.1.1 -c 1) fails N times in a row, bring current router link down (ip link set <dev> down) and bring next one up (ip link set <dev> up). Rinse and repeat. Alternatively, you can keep all router links up, NAT their 192.168.1.1 to unique IPs and then have the script change the default route. This setup will allow for checking if previously failed higher priority router regained its connectivity and switching back to it if it did.