Ask HN: How to load-balance two 1 Gbps connections with a failover?
Many years ago, Fry&#x27;s Electronics had a close-out on 2014 era mini-ITX AMD AM1 motherboards and CPUs (less than $50 for motherboard, CPU, heat sink and fan). I&#x27;ve been using them, with suitably small cases, as NAT &#x2F; router &#x2F; firewall &#x2F; DNS machines, and even though there are just four older 2 GHz cores, with NetBSD and npf I&#x27;m able to run at full gigabit speeds just fine. I&#x27;ve set up around ten of these AMD systems and have run them for many years.<p>One way I&#x27;ve shared Internet with two providers is by having two routing machines, each configured with its own Internet connection, with different local IPs on the same LAN. Clients can each be configured to use the preferred gateway, or they can be switched using DHCP. Likewise, when one of the lines is down, the default route can be removed from the machine that handles that line and can be switched to the other machine&#x27;s internal IP, which will DTRT and will cause clients to use the other. This has the advantage of not requiring waiting for an updated DHCP lease, so switching can be nearly instantaneous.<p>This is useful if one line is more robust than the other but isn&#x27;t as fast - the machines that need a reliable connection always use the robust connection, and everything else opportunistically uses whatever&#x27;s available.<p>Another is simple round-robin of NAT to both connections.<p>Neither helps if the line that you&#x27;re using drops mid-call, but there are ways to deal with that, if you have high speed available at a datacenter. For instance, I&#x27;ve set up routing of a small public subnet via tinc (<a href="https:&#x2F;&#x2F;www.tinc-vpn.org" rel="nofollow">https:&#x2F;&#x2F;www.tinc-vpn.org</a>) over two routing machines, each with their own Internet connection, with CARP so that packets can go through either machine. This makes handing off from one to the other transparent so that connections don&#x27;t need to be reestablished.<p>To get back to your original query, I haven&#x27;t seen any off-the-shelf NAT router that either does what a host-based router can do without some parts being proprietary or without a good number of drawbacks and limitations, nor have I seen hardware that can do anything fancy (that is, anything beyond the most simple routing &#x2F; NAT) at high speeds without spending lots of $.<p>Recent connections that are 2 Gbps and faster are served very well by Ryzen 5600X systems with 2.5 and 10 gigabit ethernet, and those systems cost around $500 each.<p>Most of my machines have been set up many years ago, and automatic scripts update things like BIND and other software, so they require almost no maintenance after initial setup. On the other hand, remote administration is dead easy because they all use ssh with keys (no passwords), and can be used to help facilitate remote administration of machines on the local network, too.<p>In other words, I can&#x27;t think of any reason any more to buy off-the-shelf NAT routers. Even if I wanted to go that route, there are too many shortcomings for me to imagine doing that - I&#x27;d give up significantly more flexibility than the amount of time I&#x27;d save would ever possibly balance.<p>To answer your questions about layering NAT routers, yes, you can do that, although it&#x27;s discouraged. If you&#x27;re forced to use the ISP&#x27;s routers, you should at least ask if they can be put in bridge mode so your device can do the NAT, since many of those ISP provided routers have tiny NAT state tables and&#x2F;or time out NAT states for no good reason.<p>Also, there&#x27;s no such thing as NAT that wouldn&#x27;t fit the definition of &quot;stateful firewall&quot;, so it&#x27;s hard to know what they&#x27;re advertising. For instance, the Peplink Balance 580 advertises 1.5 Gbps throughput, and that&#x27;s in aggregate - it definitely can&#x27;t handle all five WAN at 1 Gbps at the same time, else they&#x27;d advertise 5 Gbps. Considering the prices of the hardware, a brand new, physically tiny, host-based NAT router &#x2F; firewall would be both cheaper and significantly faster.<p>Just some thoughts :)