Auto-connecting a VPN on a Wi-Fi connection from a mobile router on Debian 11
I’m travelling for work a little more now than I have been for a couple of years. I tether my laptop to my phone, rather than rely on Wi-Fi, and I need more data than I currently have in my phone’s plan.
A pre-paid SIM and a Mi-Fi
I could upgrade the plan - for another £12ish per month, I could get “unlimited” data - but £144/year seemed a lot for occasional connectivity.
I could move providers, but that’s not really an option for me at the moment.
So, since I’ve got a Mi-Fi - a small, battery-powered, router - I thought I’d try a pre-paid SIM with a reasonable amount of data.
I used this handy blogpost, “Best Bulk Data PAYG SIMs in the UK”, by Terence Eden to identify a suitable pre-paid SIM.
I went for the first item in his table: 120GB of data, valid for 12 months, for £50, pre-paid.
(Yes, I could have done this more cheaply if I were willing to take out a contract for an additional SIM. If I blitz through the 120GB, perhaps.)
Reminder for future me, when the data stops work:
One gotcha that hit a couple of us recently with the EE 120GB SIMs: approx 6 months after first use, they got deactivated for inactivity.
Needed temporarily moving to a device that could make voice calls, and a call to 150 followed by “dial 1 to reactivate”…
Auto-connecting a VPN
I’m using Debian 11, with GNOME.
The Wi-Fi connectivity tab in the normal “Settings” application does not allow me to automatically connect to a VPN when connecting to a specific Wi-Fi access point.
Oddly - to me, at least - I can do this when tethering to a mobile device. But not a Wi-Fi connection.
Fortunately, the Advanced Network Configuration tool does have this functionality. To do this, you:
- Select the network name, under “Wi-Fi”
- Click the settings icon - the cog - at the bottom of the pane, to edit the network’s settings
- Select the “General” tab
- And set “Automatically connect to VPN” to whatever VPN connection you want. (In the screenshot, it is
wg0
, a WireGuard profile.)
You might need to turn Wi-Fi off then on again, or connect to another network and back to the one you’ve configured to connect to the VPN automatically, before this takes effect.
A better Mi-Fi?
The Mi-Fi I have is quite old. It works, and it is such a shame to ditch working electronics.
But it has not had security updates for quite a few years, and that’s not great.
I quite like the GL.iNet routers. In particular, I like the fact that they use OpenWRT, and have Tor and WireGuard clients built in.
Hmm…
You may also like:
- But it's not unlimited...
- Browsers for people who just want a browser
- Migrating mastodon to Debian 11 Bullseye: fixing the segfault
- A quick and dirty approach to redacting PDFs on Debian 11 Bullseye
- Cloning a Raspberry Pi installation: slow, but working
- Implementing BusKill: shutting down a Debian 11 Bullseye machine when a specific USB device is removed
- Fixing 'tee: command not found' on Debian 11 Bullseye
- Installing Twitter client cawbird from the official Debian 11 Bullseye repo
- GNOME display fractional scaling
- WireGuard VPN plugin for NetworkManager in GNOME 3 on Debian 11 Bullseye
- PineTab running Mobian and GNOME: an iPad replacement?
- Debian 11 and printing on a Samsung ML-2525W
- Virtualising an existing macOS installation for VirtualBox on Debian 11
- Wi-Fi on a 2012 Mac Mini, running Debian 11