Skip to content

Instantly share code, notes, and snippets.

@S1M0N38
Last active March 4, 2023 13:42
Show Gist options
  • Save S1M0N38/77ad8d3cb5e481aa802d43636881279c to your computer and use it in GitHub Desktop.
Save S1M0N38/77ad8d3cb5e481aa802d43636881279c to your computer and use it in GitHub Desktop.
Configuring Nord VPN using openvpn

Installations and downloads

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

Choose the right configuration

  • 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.

Automatic authentication

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

Test that everything is working

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

Enable VPN on boot

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:

I wrote them to recall to myself in the future how to setup vpn with openvpn and enable it on boot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment