Internet Bonding with a Raspberry Pi Access Point

Internet Bonding with a Raspberry Pi Access Point

We have a cell phone and a Mifi device we use to connect to our laptops for fast internet in the van (thanks to some speed-boosting tricks). But staying under the data caps for each was challenging, so we’d try to connect to Wifi connections whenever we could. But juggling all of this quickly became a problem (before I implemented “internet bonding”) because we each have a laptop, plus there is a small computer in the van automatically recording data about our travels.

That small computer ended up being the solution. I turned it into a Raspberry Pi access point (wifi hotspot) which is smart enough to switch between (or even combine) internet connections. At only $27, it provided an extremely cost-effective solution to an annoying problem. Plus, it’s simple enough to do that even if you’ve never heard of “Linux” or “Raspberry Pi,” you can still complete this tutorial in about an hour. At the end of this post, you’ll find some open-source tools to help set everything up.

Why Not a Dual-SIM Device?

Many people we have met on the road who care about combining internet connections use a dual-SIM device like the Teltonika RUT950.

No products found.

As I explained in the van/RV Internet Guide, our solution:

  • Can combine more than two internet connections.
  • Can use your existing phones’ data (instead of dedicated SIM cards).
  • Can combine things other than cellular connections, like Wifi or satellite connections.
  • Can intelligently limit data to not go over any connection’s cap.
  • Costs hundreds of dollars less.

Building a simple version of a Raspberry Pi access point is described in the official documentation. Unfortunately, that documentation may be a bit complicated for those who are not advanced Linux users. I created a separate tutorial on building a Raspberry Pi router (below) and monitoring its traffic. These tutorials should help with some of the basics, but do not cover using two internet connections simultaneously to create internet connection bonding.

Internet Connection Bonding

First, let’s consider the hardware required for connection bonding.

You may have heard of “pair bonding” DSL.

Because DSL connections are so slow, it is common to use two of them together.

All kinds of bonded internet work very similarly. However, DSL accomplishes this with a channel bonding modem. Instead, we’ll use a Raspberry Pi to use two modems in one “house.”

If you're new to Raspberry Pi, the popular CanaKits are a great place to start. I prefer to buy the Raspberry Pi 4, power adapter, micro SD cards, and heatsinks separately. Not only is this cheaper, but it reduces e-waste.

The following are affiliate links to other parts I used in this project. I never link to a product that I have not personally used.

Even the cheapest, tiniest computers (like a Raspberry Pi Zero W kit for $27) comes with a Wifi card and 4+ USB ports. That’s at least 5 different channels for bonding internet connections.

magic spellbook home automation open me
I created a “Magic Spellbook” for the van, which is a Raspberry Pi in a box with a touchscreen. This lets me run not only the Wi-Fi access point described in this post, but also a Home Assistant kiosk that monitors the van and lets me control various things in the van.

The idea behind using a Raspberry Pi for internet bonding is simple:

  • Each one of the USB ports can connect to the internet via:
    • Tethering via one of our phones.
    • Connecting to a Mifi.
    • Connecting to a public Wifi network via a USB dongle.
    • … or anything else.
  • The “preferred” internet connection is shared via a WiFi access point.
    • The fastest connection can be chosen.
    • Data caps can be applied to each connection.
    • … or they can be combined together for faster speeds.

This last option is known as “internet bonding” or “connection bonding.” Each of the different connections are combined together into a single, virtual connection. This combines the speeds, as much as possible, from each connection to create one faster than any of the individual connections.

Use a good-quality USB WiFi adapter, instead of using a Mifi or phone’s “WiFi Hotspot” feature.

This is significantly faster — especially as you try download many things simultaneously.

A big advantage for us is also the fact that our solution automatically and intelligently switches between the connections, yet the internal WiFi network remains the same. So our computers stay connected to the same van network and don’t care about which internet connection is used.

multiple internet connections vanlife/rv tethering, mi-fi and connection bonding
Tucked behind the door are power wires, a MiFi, cell booster antenna, and lights.

Free (but Complicated) Channel Bonding

The first approach I’ll describe is free, but limited. I ultimately ended up abandoning it for the paid solution, below, due to the headaches involved.

If you’re not technically oriented and/or a little masochistic, I’d recommend you jump to the next section.

First, I set up a Raspberry Pi to create a wireless access point for a single internet connection. I have a Verizon Jetpack with “WiFi mode” turned off, instead plugged directly into the Raspberry Pi’s USB port. I followed the official documentation, except replacing eth0 for the interface of the Jetpack. The Raspberry Pi access point was now active, but only supported that one connection.

If you add more devices (connections), you can switch between them by replacing the connection on the bridge. For example, sudo brctl delif br0 eth1 and sudo brctl addif br0 eth2. Since the WiFi access point is sharing the data from the bridge, the new interface will be used for the internet connection.

This can be automated by running a simple shell script that runs indefinitely. Here’s an example I had from my expermientation, but you should not expect this to “just work” (you’ll need to tweak it for your needs). It worked, but still had the following problems:

  • Does not pick the best internet connection by speed.
  • Cannot limit data based upon caps.
  • Will not use internet bonding.

The first two are theoretically solvable without too much effort. But it’s at this point that I came upon a much easier solution…

Easy (but Paid) Bonding Router

I use a tool called Speedify for internet bonding, using their instructions to install on a Raspberry Pi. The Individual plan currently costs $47.88 per year. I am not affiliated with them in any way, and do not receive any sort of kickback for recommending the tool. I just liked it because it was easy to set up and provided most of the features I described above right out-of-the-box.

As of this writing, there are a couple problems with their documentation for the Raspberry Pi running Raspbian Buster.

First, I had to follow these instructions to install Network Manager. The recommended config command sudo raspi-config nonint set_net_names 1 did not work, but instead I had to modify the nameserver in /etc/resolv.conf to 1.1.1.1.

In addition, Speedify has a command line tool (speedify_cli) which I use for automation with my home-assistant Spellbook Kiosk and other purposes. There was just one thing left that Speedify did not solve…

Auto-Connecting to a WiFi Network

In the post on van/RV internet, I explained how we find WiFi networks in order to not use too much cellular data. I have Speedify configured to use an external USB WiFi dongle as its “primary” connection (with the tethering options set to “secondary” and “backup,” so they’re not used unless necessary.

van wifi
The Netgear Nighthawk is a USB WiFi device, positioned at the front of the van to maximize reception.

One advantage I didn’t mention about Speedify above is that it comes with a VPN (which is a good idea to use when on the road). Speedify provides this so that you can switch between connections without disrupting a download. However, it also means that open WiFi networks are relatively more secure because the data is being transmitted in an encrypted manner. This makes it reasonable to automatically connect to open WiFi networks to preserve the cellular data.

I’ve created this open-source project to help. The effect is that, if there’s an open WiFi network available (and you’ve not explicitly connected to another network) you’ll be automatically connected. This maximizes the time spent on WiFi instead of using cellular data.

Finally, I wrote some code that proxies all the data into our Home Assistant running in the same Raspberry Pi. This lets us see the connection quality, status, and data usage of each of the connections:

home assistant speedify verizon wifi internet bonding connection status
The Home Assistant card shows: (1) a Verizon sensor with the signal quality, days remaining in the billing cycle, and data used so far (2) a WiFi sensor with the signal strength and current network name.

Build Guides

Looking for even more detail?

Drop your email in the form below and you'll receive links to the individual build-guides and projects on this site, as well as updates with the newest projects.

... but this site has no paywalls. If you do choose to sign up for this mailing list I promise I'll keep the content worth your time.

Written by
(zane) / Technically Wizardry
Join the discussion

4 comments
  • Hi Zane,

    This is very informative and I appreciate the time you’ve spent putting all this together. I’m very interested in this speedify/auto wifi/mifi connect you’ve set up and wondering if you have a more comprehensive guide? I think I have it all installed but I want to be sure it’s working correctly.

    I’m also wondering, do you have the auto wifi/speedify configuration setup on the same raspberry pi as you have Home Assistant? If so, did you do a manual install of HA on raspbian using a virtual env? I want to be able to connect to my home wifi and then when I drive away (in my RV), my jetpack/mifi takes over and everything is seamless. Thanks so much,

    neal

    • Thanks for dropping by & saying so, Neal.

      I’d like to refine this article a bit. Would you mind dropping me a line so we can chat through where you’re at? Briefly… (1) Speedify. You don’t really need anything special here. If you’ve followed their instructions, it should auto-connect to the best available network. But I haven’t had great luck with their support TBH, so LMK if you need help. (2) The WiFi auto-connect. This can be a bit trickier. If you’re using my scripts, the logs should tell you what’s going on, so you can observe exactly how it’s working.

      Here at the cabin, I no longer run Speedify (we have only one internet connection). I use my DIY Raspberry Pi router, which is basically the same thing except without Speedify. This router is also the Kubernetes master node. You can actually see my home network diagram here and my approach to using Kubernetes to deploy Home Assistant here.

      FWIW, I think this is what I’d do in your case. Put the Raspberry Pi in the car with Speedify + Home Assistant. Presumably, Speedify has 2 interfaces, one for the Jetpack (secondary) and one for the home WiFi (primary). You shouldn’t need my WiFi script unless you **also** want to use anonymous WiFi networks, not just your home network, since your Pi will already automatically connect to known networks (e.g., your house) and Speeify will select the primary interface (WiFi) when applicable.

      Hope that helps! Always glad to edit the post with updates if you have any suggestions.

      – Zane