A community for technology geeks in Lebanon.

You are not logged in.

#1 June 1 2022


Internet bonding router with seamless failover using Speedify


I work from home and need a reliable internet connection, this small project allows you to use the service in a router setup. I switched from a Peplink BL20X due to high cost and bufferbloat (optimized for streaming).


Tested combinations:
- Alfa 50GB with 2GB daily limit + Ogero 2Mbit unlimited (budget setup - Alfa set as backup)
- Connect + TerraNet ADSL (Connect for upload boost - Connect set as secondary)
- Alfa 200GB with 10GB daily limit + Ogero 200GB (my current plan - Alfa throttled to ADSL speed ~18Mbit for equal consumption, both set as primary)

Link: https://github.com/TalalMash/SmoothWAN/?#readme


The service cost with the occasional coupons is around 30-50 USD per year.
A combination of wireless and wired is preferred for the highest uptime, e.g it's pointless to use 2 ADSL modems as it would be using the same circuit.
I managed to get a 0% packet loss weekly interval and uptime of 2 months, measured using SmokePing (http+icmp) and no broken sessions with a 512Kbit testing TCP socket, before my UPS malfunctioned.
My Alfa network is lossy after 7PM, Ogero helps in error correction, speeds and lower latency even though it's also unstable (disconnections).

Speedify treats streams differently, E.g: Video calls or thin-stream packets are duplicated across all WANs in poor condition while simultaneously aggregating bulk downloads as well as few other behaviors when using modes like secondary or backup for hot failover (~200ms switch, not to be confused with seamless 0ms which uses data when set as primary). It can also route thin-streams like games and DNS requests to the WAN with the lowest latency.
It also supports FEC which is very useful when using one WAN with packet loss as it can double the speed for TCP in this scenario.
For detailed review check the detailed section "Speedify solutions" in the readme page.

P.S: My current seamless failover stats which happens to be very bad today with the ADSL

Last edited by ReadMe (June 2 2022)


#2 June 2 2022


Re: Internet bonding router with seamless failover using Speedify

Nice setup, thanks for sharing.

How do you connect everything to the raspberrypi? Multiple wireless modules? or is there some wired ethernet to usb thing?

I am using another method but it only allows to choose between 2 wired connections, it does not combine them. My ADSL modem has a WAN ethernet port. So after doing the proper configuration I am able to plug in an ethernet cable with an internet connection that supplements the dsl connection. I can also give priority to one of the connections in case both connections are working. This can be useful when you have a cheap connection that has outages and an expensive connection that is always up.


#3 June 2 2022


Re: Internet bonding router with seamless failover using Speedify

Thanks, so what you described by your method is a load balancer/failover.

As briefly as possible:
You have two exit IP addresses assuming that 2 ISPs are used, active statefull connections break when switching between the 2 gateways as the other end (server) is not notified for handover to the second IP address, at least by standard unlike MPTCP/MPQUIC for example (still uncommon), and thus it's not a seamless failover, it is a disruptive failover.

In nutshell: your video call, remote desktop, gaming, radio, streaming, non-resumable downloads etc will end if it happens to be on the faulty WAN. It will also end if the router/firewall decides to switch it off due to packet loss or other reasons. It can't handover the connection to the better WAN. You'd have to restart the call after a failover or wait for the video call app to reconnect. This is still useful if failures are rare or scheduled which is not the case for many in this country.

In load balancing configuration (not your case), active connections cannot be migrated on low saturation, they're weighed before creation, example:
You have two ISPs: 4G: 20 Mbit down 10 Mbit up, ADSL: 20 Mbit down 1Mbit up, and you're uploading a file, most uploading services are single socket, the upload may go through 4G or ADSL which is undesirable when load balancing asymmetric connections. Your video game/video call may also use the worst/slowest WAN. Setting unbalanced weight assumes that you have stable and predictable internet connections, at least in terms of speed.
Bonding aggregates single sockets, the weighing is done dynamically by packet but it requires a server to terminate one end.
SD-WANs can also rehash the flows to the other path if tunnels/IGPs are used without bonding. (Zerotier's balance-aware, Citrix etc)

Having an orchestrator with tunneling allows you to:

  • Have one exit IP address

  • Correct a lossy WAN by forward error correction (with slight latency increase)

  • Maintain active sessions

  • Bond single-socket connections as described above

  • Duplicate packets in case all WANs are lossy/bad

  • Correct packet ordering which is very important for TCP with bad ISPs (even in a UDP tunnel)

  • Use realtime WAN quality monitoring as opposed to pinging one-way, as well as quality index (memory/history) and other logic

  • Use QoS for flows by path as opposed to prioritization-only (similar to SD-WAN)

  • Que and shape speed for dynamic links to reduce bufferbloat (quicker with 2 ends)

The focus is mainly on the Pi (and old laptops) due to availability and cost, hence the reliance on USB ethernet adapters, if you wish to combine few hundred megabit connections then this hardware setup isn't suitable but that's not the case in Lebanon ;)
The solution is very popular with Starlink users despite the decent speeds due to dropouts.
There is a drop down menu in the link that describes the setup process, the example uses a smartphone for simplicity.
If you wish to give it a try, try Speedify on a PC/Mac with wired connections first to see if it works well.
Note that the speed ramps up slowly for weighing dynamic connections, use a speed testing service that has decent intervals or the built-in test which waits for the speed to stabilize.

Tip for Lebanon: Use French servers, Paris #1 server is close to Marseille (IMEWE).

Last edited by ReadMe (June 2 2022)


#4 June 2 2022


Re: Internet bonding router with seamless failover using Speedify

Yes you are right. I am combining DSL and 4G. My DSL is out most of the day and becomes alive in the evening. It sometimes works for a couple of hours during the day and when it disconnects I am susceptible to disruptive failover. I am fine with that most of the time but when I am doing an important task that doesn't afford disconnection I change the priority and use 4G even if the DSL is on.

It is cool to learn about a more reliable approach. Speedify can come in handy some time. Il take a look at it.


#5 June 4 2022


Re: Internet bonding router with seamless failover using Speedify

Thanks for putting this together and sharing it here Talal!


Board footer