How to set up a VPN connection on a Linux server?

VPN adds encrypted security between your computer and the remote server with which information is being exchanged. The user operating the VPN will have their actual location masked since the IP address in use will be that of the VPN Connection server. All traffic to and from the VPN server and the remote servers is also encrypted.

VPN users have the option to use a free VPN, which is not secure or recommended. They may get a VPN subscription for a monthly fee, which is easy to do, but reliable nonetheless, since the VPN service provider takes responsibility for securing traffic.

Or, users can set up their own VPN connection on their private server. Although this may appear to be a difficult task, even the newest programmers can set up a VPN connection of their own using tutorials and guides. A custom-built VPN connection on a private server leaves users in command of running all encryption and is arguably the most secure VPN anyone could ask for.

This is also a beginner’s guide to set up a VPN connection on a custom Linux server.

Prerequisites for a Linux based VPN

To get started, you need two computers. A client computer and a private server. The client may be your home computer or laptop. The private server is where the VPN will be installed and configured for use as a VPN provider on your virtual or physical server.

This demonstration will be completed using OpenVPN, which is an open-source program available in all Linux distros and one of the most popular ones too.

Installation and configuration – OpenVPN and cURL

vpn connection free

cURL is needed to download the VPN installation script This script makes the installation very easy and free of errors. You may also choose to install it manually and instructions to do so are widely published online. But, this VPN installation script is a combined effort of numerous programmers and also very trusted within the online community.

The script needs to be made executable once it is downloaded. The command to do so is as follows

curl -O

chmod +x

Then the script needs to be run as a superuser to install and configure OpenVPN on your server.

vpn connection free online

Then simply follow the assistant and answer a few questions. You can keep the default settings if you just press Enter for every question. Only give a name to your VPN configuration and it is also recommended to encrypt the configuration with a password.

How to setup a VPN connection on a Linux server? - CloudSurph - 1$ VPS

When you see a file in. ovpn, it would mean installation on the private server is complete. This is a file you will need to configure the client computer.

How to setup a VPN connection on a Linux server? - vpn connection windows 10

Client computer setup

On the client computer, install OpenVPN and OpenVPN extensions for the network manager.

vpn connection authentication information

You may install NetworkManager-OpenVPN for Plasma 5 on Arch Linux. Search for these two packages in your distro. Their names may differ slightly. If you use Ubuntu GNOME, for example, you need to install NetworkManager-OpenVPN-gnome. The command is as follows :

vpn connection user authentication failed

After this is done, download the VPN configuration file from your server using the following command

vpn connection problems

The file will be downloaded to your local Downloads folder.

Connect to the VPN through Command Line-

Connecting to the VPN through the Command line is more reliable and lets users test the VPN connection as well. Copy the downloaded *.ovpn configuration file to the client folder of your OpenVPN.

vpn connection name and server address

Command to test the connection-

vpn connection google chrome

The command screen should appear as below.

How to setup a VPN connection on a Linux server? - vpn connection name

If no error appears. It means the VPN works fine. You may run an internet test by opening any website on the browser. If you check your public IP address, your server IP should be seen and this would tell that traffic is running through the private server.