This is a quick tutorial on how to start an OpenVPN connection when your Raspberry Pi system boots.
Do you need a VPN for Linux?
If you’re a Linux user, you’re probably aware that Linux is one of the most secure OS out there. It has a small but dedicated user base, it exists across multiple different distributions, it limits user admin privileges, and the open-sourced code is scoured by hawk-eyed developers looking for vulnerabilities to patch up. All of that is true, but that doesn’t mean a VPN isn’t still a vital tool for Linux users.
First of all, Linux still has the greatest security vulnerability of them all – human users. The starting point for some of the most common and effective hacks are tricks of social engineering that take advantage of human trust or oversight. Linux users are still vulnerable to such attack vectors – even if they might be targeted at a lower rate.
Some VPN security and privacy benefits apply no matter what OS you use. NordVPN will still protect your sensitive traffic from snooping or MITM attacks (read more about Man In The Middle and other types of attacks here). It will still protect you from government surveillance and data harvesting by your ISP.
The benefits of a VPN don’t just depend on your own system. Regardless of your OS, you’ll still enjoy access to geo-blocked content, evade censorship when traveling, and find the best international deals. Leading VPNs like NordVPN will also provide additional security and privacy features like CyberSec.
How to connect to NordVPN using Linux Terminal?
- Open terminal (keyboard shortcut: Ctrl + Alt + T).
- Install OpenVPN client by entering:
sudo apt-get install openvpn
If you are requested a password, enter the password which you have used when creating your account
- Navigate to OpenVPN configuration directory with command:
- Download OpenVPN configuration files with command
sudo wget https://downloads.nordcdn.com/configs/archives/servers/ovpn.zip
In case you will get `ERROR: The certificate of `nordvpn.com’ is not trusted.`, please install `ca-certificates` package with command:
sudo apt-get install ca-certificates
- If you do not have `unzip` package installed, download it by typing in
sudo apt-get install unzip
- Extract `config.zip` with command:
sudo unzip ovpn.zip
- Remove files which will be no longer used:
sudo rm ovpn.zip
- Enter the directory where the server configurations are. These folders are either ovpn_udp or ovpn_tcp:
- To see the list of all available servers, simply enter the following command and it will print full configuration file list.
- Choose a server which you would like to connect to.Server file that you choose = For the sake of the tutorial, we have used us936.nordvpn.com, but you should connect to a server suggested to you at https://nordvpn.com/servers/#recommended . You can find the server hostname right under the server title.
Auto-connect using OpenVPN via terminal
1. Create auth.txt file inside /etc/openvpn directory via this command:
sudo nano /etc/openvpn/auth.txt
Fill it with your NordVPN credentials:
2. Then open the file which you are using to establish a connection:
sudo nano /etc/openvpn/ovpn_udp/de75.nordvpn.com.udp.ovpn
And change this line:
Save the file and change its name:
sudo mv /etc/openvpn/ovpn_udp/de75.nordvpn.com.udp.ovpn /etc/openvpn/de75.conf
3. Then you will have to edit the startup on boot file via this command:
sudo nano /etc/default/openvpn
When the text editor opens, add this line above
Save the file and reboot your Linux device.
4. After the reboot – open the terminal and type in:
sudo traceroute 126.96.36.199
The first hop address should be 10.8.8.1 and in ipleak.net you should see Germany 75 servers IP address.