I have been dabbling with a solution to maintain my internet connectivity while having 2+ semi reliable internet connections. Anyone who lives in the boonies and has starlink probably is familiar with seconds to minutes of outages, as I've found in the first week of having the service. I had planned for this and have been abusing/testing an unlimited dataplan and easy tether, this actually works great (albiet slow at 5Mbps) as long as you also use a VPN to obscure your traffic to prevent steam shaping by the carrier.
Initially I used a plain old mwan3 failover, however I quickly discovered that streams that were started on cellular continued on cellular even when starlink was available for several minutes. I also came up with a mwan user script to selectivly kill conntrack states on lower priority connections when a higher priority connection became available. This actually worked ok for streaming video, however it would occationally cause the app to just stop the session, frequently enough to be more annoying than just having to use 480p on my 4K TV.
Enter SDWAN bonding. This had been a concept I was well familiar with as a business solution, however I really had no reason to play around with this since I had access to reliable cable internet (I still do, but I'm practicing some sadomasticicm with unreliable internet to prepare for my Diogenes life in a van) There is a home user targeted service called https://speedify.com/store/ that I looked at (openwrt possible on a rpi), but for $5 a month I can host my own on https://ramnode.com/ or https://digitalocean.com/ and have full control of the solution.
I will be detailing the components I setup on my cute little OpenWRT router that combines Cellular, Wifi, and Ethernet into one logical pipe where NAT sessions are tracked from one place and failover can occur in sub second responce times in some cases.
Each of these components can be replaced with a like solution, however I have familiarity with them, so they
Pros of this solution:
- Since the termination of your "LAN" is in the VPS and your "Edge" is always on and available to connect to, TCP/UDP sessions will be valid regardless if your traffic is coming from 1, 2, or even 100 different ISP links
- You can port-forward from your VPS into any device on your network, even through CGNAT
- In my exprience, the biggest benefit is having an available connection 100% of the time, with merely moments of outage when one connection is unavailable. In the case of a 10 second outage of a primary connection, the secondary/backup connections will take over to maintain (slower) traffic flow before the primary connection returns and becomes the data path within secconds.. The experience shouldn't be much different than watching a streaming video and someone starts downloading a big file.
Cons:
- Increased complexity. I can turn off my router and turn it back on and it will connect just as well as a simple ethernet internet connection. However there are a lot of break points to troubleshoot on your own
- Increased security surface area: Not only do you have to be aware of firewall and updates to your home router, but you also need to maintain and manage the connection on your VPS which is probably reused from hundreds of other customers who may have attracted the attention of hackers/bot nets that will be scanning your new "public ip". However if you watch your WAN zone traffic logs at home, you likely get port scanned or unsolicited traffic often anyway
- Additional cost over just having two plain connections in fail over
- the VPN adds overhead, so if you already have existing wireguard tunnels on your home router, you will need to reduce their MTU to approx 1300 (could be a bit higher, I just shotgun this value while troubleshooting my issues)
VPN side:
- VPS, suggested 2 core, >512MB ram. Shared CPU seems to be fine and my opinion 2 shared cores is better than 1 dedicated core
- Vyos Router ISO from https://vyos.io (This is essentially a wrapper for 2 key technologies: FRR and WireGuard/OpenVPN)
OpenWrt side:
Router:
- Linksys E5480, however a router with USB3 will be preferred
- Self Powered USB hub
- Alfa MT7612 USB Wifi Adapter
- Easytether Driver
Cellular Link
- 5G Android Phone with EasyTether installed
- 2x wide band Cellular 10dbi antennas
- 2x N-Type to SMA cable
- 2x SMA to uFL cable adapters
- USB cable
Wifi Link
- Public Wifi, or any other Wifi Network. This is how I currently connect to starlink for testing
Ethernet Link
- Any primary connection, Eventually I'll get a PoE adapter for starlink
I'll go into detail with future edits, but here is a rough outline of How I set this up
VPS Setup
- setup a VPS at your preferred host
- Download/Upload the latest Vyos image
- In the remote console, Create a new VM instance and install Vyos, setting a temporary password, then reboot (don't use your common password since the keys are passed through the "untrusted" host network into VNC or what ever console they provide.
- configure basic network configuration and test connectivity to SSH from your home computer
- ssh into your new Vyos router and create a new user such as admin, but not root with a secure password
- Setup OTP authentication for increased security
- set SSH to listen only on an alternate port and not on port 22
- Setup firewall zones for WAN, LOCAL, and SDWAN
8a) LOCAL to WAN default Action should be accept
8b) LOCAL to SDWAN default action should be accept
8c) SDWAN to WAN default action should be accept
8d) WAN to LOCAL default action should be drop
8e) WAN to SDWAN default action should be drop - Add rules to WAN to LOCAL for your ssh port from step 7, and expected UDP ports for VPN tunnels ( i.e. 1350-1352)
- Commit your changes and save. Then reboot. Confirm you can ssh into your router before closing your remote session
10a) If you can SSH into your router, delete the default vyos user
10b) if you can't SSH into your router, login via the host console to your VPS and review your settings until it's safe to delete the basic vyos login - configure wireguard/OpenVPN tunnel interfaces, one on each port specified in step 9
- Create a dummy interface and assign it IP 10.99.99.1/32
- Configure OSPF with various costs and hello
13a) Cellular VPN should have a cost of 100, hello of 1 sec, and a dead timer of at least 600 se.
13b) WiFi VPN should have a cost of 10, hello of 1 sec and dead timer of 2. I had tried using a hello multiplier, but the connection wouldn't stay open for more than 60 seconds, so this is what I accept
13c) Ethernet/Primary VPN should have a cost of 1, hello of 1 and a dead timer of 2. This could be a good candidate to use hello-multiplier
13d) Any number of additional connection can be added using the same configuration and tuning the hello and dead timers will be a creative process
13e) assign each of the VPN interfaces to ospf area 0.0.0.0, and the dummy interface area 0.0.0.5 - setup a nat rule with an outbound interface of eth0 using masquerade
14a) I have not tried this, but it may be an option to use NAT 66 to translate your private fd00::/8 networks into a subnet assigned by your VPS host.
OpenWrt setup
- Install OpenWrt on a router, and configure the driver packages for your WiFi adapter
1a) connect the powered USB hub so any devices, including the phone don't rob power from the router's SOC - Download and install the easy tether driver. I suggest these modifications to the hotplug script to ensure the tap device is created with minimal interaction
- Configure and confirm that your internet uplinks work on a basic level (ping -I 1.1.1.1). Ensure each link has an appropriate metric set, (ethernet 1, Wifi 10, Cellular 100)
- Install the following software: frr, frr-staticd, frr-watchfrr, frr-ospfd, frr-vtysh, frr-zebra, mwan3, luci-proto-wireguard or luci-app-openvpn
- configure your VPN of choice and confirm you can connect and ping to/from both sides, create one tunnel device for each VPN device created on the vyos router
- configure mwan3 to track each interface and configure unique policies for the destination IP of your server and each VPN port, i.e. 1350-1352. Assign each policy to a rule unique to each interface. (this is where the source of the magic is!)
- Save and apply the configuration, and re-check the connectivity to/from each end of the tunnel
- configure frr either with frr.conf or via vtysh to setup OSPF similarly to step 12 of the vyos router setup. However additionally set each of your LAN interfaces to area 0.0.0.10. (this announces your local network as a route
- run
sh ip ospf neighbor
to confirm at least one of your links is connected (hopefully all of them are for verification)
9a) also runsh ip route
to confirm you see a route to 10.99.99.1/32 - configure two routes which will become the new default gateway
10a)ip route 0.0.0.0/1 10.99.99.1
10b)ip route 128.0.0.0/1 10.99.99.1
- check that the public IP you configured in the vyos router now appears when your check your ip at somewhere like whatsmyip.org
- test with your secondary/primary links, start a
ping -A 1.1.1.1
and watch the stream of packets while you disconnect your connection, and then reconnect. if everything is working, you will see a momentary pause before it continues, possibly with a higher ping time. The same should be true when you reconnect
12a) you can also verify the routing is working by runningsh ip ospf neighbor
and confirming you see 1 or more neighbors listed and the two default route hacks are pointed via recursive route to the lowest cost interface of your vyos router.
bonus
This is provided for educational purposes, consult your local/FCC regulations and contact your carrier
- choose a "cheap" 5G phone, preferably one with a plastic back. I use the Samsung S20 5G FE
- use a heat gun and de-lid the back of the phone and unscrew the housing until you reveal tiny coax cables
- typically, the connections at the top of the phone are the input, the bottom are the remote antennas
- remove the antenna wires and replace them with the SMA to uFL adapters, routing them in a similar way to the factory. I believe red and white are LTE/5G MiMO, blue is bluetooth, which I just remove. (some experimentation is needed to confirm on the model of phone you use_
- punch a small holein the back of the phone and cut a slit from the edge to the hole. then slide the wires in so they come out of the back
- replace the back of the phone and use strong tape to anchor them in place
- connect your wide band external antennas to these wires with the appropriate SMA extensions and tape these into place on the back of the phone to prevent damage
- confirm an improvement in signal strength and network connectivity
- connect your phone to your router, install the easy tether app, enable USB debugging, and ensure the default USB mode is set for transferring files
That's pretty much all there was to it. I'll add some configs to this for easier copy paste + where you will need to add your own settings. If some of these terms don't make sense, it's probably better to look at speedify, otherwise I hope this is useful to at least one other person.
This was the result of trying and experimenting with hundreds of dollars of things from v1 on a GLiNET router I had because I just wanted a drop-in and go, to a RPi CM4 router I tried to use as a VPN gateway (these are $$$now) that I now just have in my bin because I have a 1 device/router solution.