The Core

Why We Are Here => Hardware & Technology => Topic started by: ergophobe on June 11, 2022, 04:38:02 PM

Title: Raspberry Pi + Speedify + two ISPs
Post by: ergophobe on June 11, 2022, 04:38:02 PM
I keep bringing this up in threads that are really about Starlink or RPi supply chain issues. Here's why I'm actually interested in RPi all of the sudden.

The goal is to bond two crappy ISP connections into one more stable connection

First, get two internet connections in and one out from the RPi
WAN
1 wifi connection to ISP 1, or possibly an ethernet connection via wireless bridge from router 1 (Starlink) to router 2 (cabled into RPi)
1 ethernet connection to ISP 2

LAN
1 wifi hotspot to broadcast the signal (either a USB wifi adapter for RPi or a USB ethernet adapter to a hotspot router/switch)

The setup will depend a bit on how I can get the best range. I'm not sure if  the on-board wifi for the RPi or a USB wifi adapter will have the power and range of a large, power-hungry router.

Then add Speedify channel bonding
Speedify with DNS ad blocking which
- bonds the two connections with near-instant failover (based on reviews). This is key - IP does not change when you switch connections.
- provides a VPN
- provides rules-based VPN bypass for streaming services (apparently Netflix, Hulu, et cetera block VPNs). This saves you from having to disconnect from your VPN just to stream something.
- provides DNS-level ad-blocking (think Pi-Hole)

I am not sure whether I should just install the command-line Raspberry Pi OS Lite, or the desktop version, or possibly Ubuntu. Speedify has some fancy GUI stuff you can use for config that might simplify my life.

Once set up and running, I don't imagine doing anything with the RPi as it will be in a location that would be a fairly unpleasant place to work. I'm also not expecting to have a keyboard and monitor attached to it except for setup.

This person is doing almost the same (bonding his home connection to the restaurant next door who is, no doubt, thrilled).
https://speedify.com/blog/better-internet-anywhere/best-pi-hole-alternative-bonded-internet-ad-blocking-dns/

He is using onboard ethernet for the main ISP connection, on-board wifi for the client connections and USB wifi to poach the restaurant's connection

Other docs/marketing stuff

Hardware
USB ethernet
https://www.amazon.com/UGREEN-Ethernet-Internet-Compatible-Raspberry/dp/B091TL1VQ4

USB wifi. Something like this I suppose
https://www.amazon.com/dp/B07FCN6WGX


High-level overview of RPi + Speedify
https://speedify.com/blog/how-to/raspberry-pi-vpn-router/

RPi + Speedify Install overview
https://speedify.com/blog/how-to/install-speedify-raspberry-pi/
https://support.speedify.com/article/562-install-speedify-linux

Managing connections (i.e. setting the priority for multiple connections)
https://support.speedify.com/article/236-connection-settings

Speedify for Linux overview
https://speedify.com/linux-vpn/
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: littleman on June 11, 2022, 07:08:46 PM
Seems like a cool project.

>I am not sure whether I should just install the command-line Raspberry Pi OS Lite, or the desktop version...

One thing you could do is install the full OS, but then set it up so it boots to the command line instead of the full desktop.  This way you have the option of entering the desktop if you want to, but don't have to have the ram being sucked up for no reason while not in use.

The setting for that is in:
sudo raspi-config -> 1 -> System Options ->S5
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: ergophobe on June 11, 2022, 08:06:26 PM
Ah. Thanks! That's perfect.

I should have plenty of room on the SD card for anything I want so no problem there, but as you say, no reason to use up all that RAM if I won't typically have a monitor attached.

I'm kind of excited. It's been a while since I've done a new tech thing. I always find it stimulating as long as there is no hard deadline, and in this case there is not.
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: littleman on June 11, 2022, 08:12:53 PM
I know what you mean.  Tech projects that have practical applications just feel so nice.  They kinda make you feel like a wizard.
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: ergophobe on June 11, 2022, 08:39:29 PM
Unless there's a deadline that you are failing to meet, in which case they make you feel like an incompetent fool with a high resting heart rate :-)

My wife used to work with a guy (great guy, very funny and still a friend) who would figure something out and say, "I'm a genius!" and then realize that there was a wrinkle he hadn't understood and would say, "I'm an idiot!" Some days she would hear him say both of those several times if he was making progress on a hard problem. I think that pretty much sums it up.
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: rcjordan on June 12, 2022, 01:07:37 AM
>two ISPs

About 2000 I read that Willie Nelson paid big buck$ to have his tour bus rigged to merge multiple ISPs. I have always been jealous.
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: ergophobe on June 13, 2022, 02:52:43 PM
You can now get Starink for RV. Get Starlink plus a couple of 4G/5g routers for when you're on the move (Starlink for RVs does not work if you're in motion), RPi with 4-5 network cards and Speedify and you could roll like a star.
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: littleman on June 25, 2022, 02:58:33 AM
How's the project going?
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: ergophobe on June 27, 2022, 04:05:24 AM
Got the Raspberry Pi on Friday, but realized I need the HDMI to micro HDMI adapter to connect a monitor and really get started. That comes on Tuesday.
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: ergophobe on June 27, 2022, 10:49:09 PM
Turns out they shipped an HDMI cable with it. I just noticed.

I also got lucky. I thought the RPi had two USB-C ports, but it has 2 USB3 and 2 USB2. I thought I bought a USB-C wifi card that wasn't going to work, but it turns out I accidentally ordered the right card. Should be here tomorrow :-)

First try was a total failure - could not get the Speedify app to run. That made me wonder if it isn't ready for the new 64-bit RPi OS so I'm starting over with 32-bit. I guess if that fails, I'll try a Ubuntu LTS release

Also, man that thing gets hot! I bought a case fan, but I am thinking I might be better with no case.
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: ergophobe on June 28, 2022, 01:24:45 AM
Halfway there.

I am posting this from my RPi connected to Speedify. Since I do not have the additional wireless card, I'm just using the RPi as a computer, not a router/hotspot yet. I think that will be the challenging part.

Typical linux project - some mucking around on the command line, lots of apt install and apt upgrade and working through error messages (turns out that something in the pipe does not like the fact that my random password generator uses "&" in passwords) and such things.

Also, not nearly as hot running outside the case. I think I will put it in some much much larger case to give it room to breathe. I suspect that running a monitor is probably adding to the heat a lot, and that won't be typical.

We'll see how it works. I may also switch out the onboard wifi card for a USB ethernet card. That would potentially reduce interference with the USB wifi card which I'll use for the hotspot since it has better range.

I was thinking that ethernet would draw less power and generate less heat than wifi, but apparently with modern cards that is not generally true. And one guy says that doing this because of heat is like emptying your ashtray and expecting your car to faster :-)
https://forums.anandtech.com/threads/ethernet-card-vs-wifi-power-consumption.2384201/
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: littleman on June 28, 2022, 10:01:41 PM
>Heat

Are you using the standard Pi plastic case?  There are a lot of passively/semi-passively cooled metal cases out there.  I'm using the Argon One, but there are some that are basically just giant heat sinks.  Also, I've found that the CPU clocking makes a pretty big difference with heat.  Mine runs a bit hot (typically 55-58C, more when playing videos)  because I have mine over volted and overclocked, but I've found that it does a lot for desktop performance. 

Here's my mods at the top of /boot/config.txt:

over_voltage=6
arm_freq_min=1000
arm_freq=2100
gpu_freq=750


You could probably underclock it when it's just running speedify.
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: ergophobe on June 29, 2022, 08:20:43 PM
Yes, just the plastic case. I looked up "best cases" for RPi and the Argon got kudos for cooling. Might have to spring for one of those. I'm mostly worried about dust and spiders as its final location will be a rather dirty storage area, but space isn't an issue. So it could just go bare in a large cardboard non-flammable metal box, at least during the testing phase.

At the very least, I could probably way underclock the gpu_freq. When it's running Speedify, I probably won't have a monitor attached at all and Speedify shouldn't be running any big calcs on the GPU.

We'll see. Turns out the USB wifi adapter doesn't come until tomorrow (don't know why I thought it was coming yesterday). So still on hold maybe until next week as the next several days are fairly busy.
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: ergophobe on July 14, 2022, 04:36:32 AM
Sort of getting there.

- RPi set up with onboard wifi adapter and USB wifi
- Speedify setup
- Access Point set up and I can access the internet over the Access Point

A couple of key sticking points solved
- get the AP to start up and show as an available network when booting headless
- getting SSH and all that to work headless

What's not working:
- the internet

I can load five pages and it will be super fast, then the next page it will just spin and timeout. It is currently way worse over this setup than the direct Starlink connection.

Not sure why but I have some theories to test
- it's just a crappy router
- the VPN is intolerant of packet loss
- there's some interference among the network cards
- Satan and God are having an argument (see Book of Job)
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: littleman on July 14, 2022, 06:02:45 AM
>Satan and God are having an argument (see Book of Job)

Supernatural causes are the easiest to deal with most of the time. 
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: ergophobe on July 19, 2022, 11:15:29 PM
Okay... I've now got the two connections bonded and running through the RPi

It seems to work well. Just did a Facetime call and Starlink dropped multiple times including two 12s and two 15s outages. Quality degrades when switching to Hughesnet and things freeze momentarily, but it works okay.

Also, I am using the Speedify automatic DNS which defaults to running Adguard. It's basically like running a Pi Hole for the network, but the processing happens on the VPS server end rather than at the router itself.

I haven't really noticed anything except when I tried to visit Volaris Air ( https://www.volaris.com/ ). The site will not load at all. I have never been to the site before and probably will never go again, but was just testing things and ended up there. Pretty interesting though. Unlike an Ad Blocker, I have no insight into exactly what is getting blocked.
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: ergophobe on July 19, 2022, 11:28:17 PM
Other key element - getting it set up for headless access. This was helpful
https://desertbot.io/blog/headless-raspberry-pi-4-ssh-wifi-setup

I tried to get it set up for headless GUI via various methods (Remote Desktop, X11, etc) and couldn't get any of them to work. Mostly, I don't need it, but some Speedify settings are way way easier to manage via the GUI than via the command line. Also there is some nice reporting that I can't get via the CLI.
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: littleman on July 20, 2022, 05:05:10 AM
Sorry if you already knew this, but if you pass '-X' into your ssh session you should be able to launch GUIs from remote computers.

Example:
ssh -X tom@192.168.1.13
...
tom@raspberrypi:~ $ speedifyui (assuming that launches the GUI interface)

That *should* be enough to launch the GUI remotely.
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: ergophobe on July 20, 2022, 05:45:55 PM
Thanks. I couldn't get the ssh -X to work.

I'm using Ubuntu + bash + Windows Subsytem for Linux (WSL) and I'm not sure WSL is primed for that.

I end up with:

Quotetom@raspberrypi:~ $ Unable to init server: Could not connect: Connection refused

(speedify_ui:23334): Gtk-WARNING **: 08:59:42.042: cannot open display:

No big deal. Almost everything is as easy or easier via CLI.

You probably know this, but one little improvement that I like in life is setting up SSH aliases in a ~/.ssh/config file

QuoteHost rpi
Hostname 123.456.789.1
Port 12345
User ergophobe
IdentityFile ~/.ssh/id_rsa

And whatever parameters you want, then you just type

>ssh rpi

and you're in!
Title: Re: Raspberry Pi + Speedify + two ISPs
Post by: littleman on July 20, 2022, 08:15:33 PM
>SSH aliases

Yeah, they're pretty nifty! 

>No big deal.

I don't use WSL, but errors like this get under my skin.   It looks like your DISPLAY isn't being set on the client side. 

You could do that by adding a display variable:
export DISPLAY=localhost:0.0

Try setting that in the term before using ssh with X enabled.