AirVPN on a Raspberry Pi

Published on Mon, 6 September, 2021 | 300 words
Tags: configuration howto networking raspberry pi openvpn vpn

I have a Raspberry Pi running a copy of the Deluge Torrent client. This box is also configured to connect to my VPN service of choice, AirVPN, which is an OpenVPN-based VPN provider. I don’t do anything particularly dodgy, mostly seeding Linux distros and stuff from the Internet Archive. But a lot of ISPs (including my my former ISP, Virgin Media) throttle torrent traffic, so you generally get a massive speed increase if you torrent over a VPN.

One of the nice features of AirVPN is that it’s passwordless by default, you log in and download an OVPN file containing encryption keys and all the information needed to log in. There are many other tutorials on the net showing how to run an OpenVPN client on the Raspberry Pi, but most are far more complicated than they need to be, in this very specific context. So I think this blog post is necessary.

To get a Raspberry Pi running on AirVPN, do the following…

sudo apt-get update
sudo apt-get install openvpn

Now use AirVPN’s web interface to generate a config file (with an OVPN extension). Save this and copy it to the Pi, named /etc/openvpn/airvpn.conf. Yes, you do need to change the extension from ovpn to conf.

Edit the file /etc/default/openvpn so that it contains the following line

AUTOSTART="airvpn"

Finally, enable the service

sudo systemctl enable openvpn@airvpn.service

Reboot the Pi, and do ifconfig. You should see a tun0 entry, meaning that the VPN is active.

That’s it. The Pi will now connect to AirVPN every time you turn it on, and route all traffic through that.

Please note, I am not paid by AirVPN. I’m just a satisfied customer. Other VPNs are available.