Update the system and install openvpn and unzip
sudo apt update && sudo apt upgrade
sudo apt install openvpn
sudo apt install unzip
Now reboot the raspberry (this fix TUN/TAP error).
sudo reboot
Move inside openvpn directory.
cd /etc/openvpn
From now on all commands require sudo
because /etc
require root permission.
(e.g. use sudo nano file_to_edit.txt
instead of nano file_to_edit.txt
)
Download opvn configurations from NordVpn and unzip them
sudo wget https://downloads.nordcdn.com/configs/archives/servers/ovpn.zip
sudo unzip ovpn.zip
sudo rm ovpn.zip
- https://nordvpn.com/servers/tools/ suggest the best sever based on your location
- Which protocol? TL;RD UDP is faster and TCP in more reliable.
In the following I choose
/etc/openvpn/ovpn_udp/it195.nordvpn.com.udp.ovpn
. If you choose a different one, do the corresponding substitutions.
Go to https://my.nordaccount.com/dashboard/nordvpn/ .
Copy Service credentials (manual setup) inside /etc/openvpn/auth.txt
(first line the username, second line the password) e.g.
jhasd893nd98njKS89h3n909
d89j283hxjmx892dk0234I99
Inside /etc/openvpn/ovpn_udp/it195.nordvpn.com.udp.ovpn
change line
auth-user-pass
to auth-user-pass /etc/openvpn/auth.txt
This way openvpn to establish the connection to NordVpn server will
use the credentials inside /etc/openvpn/auth.txt
Print out your current IP with vpn disable
curl text.wtfismyip.com
Open a new terminal window and enable the vpn with
sudo openvpn /etc/openvpn/ovpn_udp/it195.nordvpn.com.udp.ovpn
and then inside the previous terminal window rerun curl text.wtfismyip.com
.
If everything is set up correctly the two IPs must be not equal.
Stop openvpn with Ctrl+C
Copy /etc/openvpn/ovpn_udp/it195.nordvpn.com.udp.ovpn
to /etc/openvpn/it195.conf
sudo cp /etc/openvpn/ovpn_udp/it195.nordvpn.com.udp.ovpn /etc/openvpn/it195.conf
Inside /etc/default/openvpn
change line #AUTOSTART="all"
to AUTOSTART="it195"
(no space around equal sign). With this change, openvpn at system boot will enable
the VPN using the configuration at /etc/openvpn/it195.conf
Reboot the system
sudo reboot
These note are heavily based on:
- https://www.raspberrypi-spy.co.uk/2020/06/raspberry-pi-vpn-setup-guide/
- https://www.codingnagger.com/2021/03/06/how-to-easily-install-nordvpn-using-openvpn-on-linux/
I wrote them to recall to myself in the future how to setup vpn with openvpn and enable it on boot.