Connecting to our OpenVPN server
To connect to our OpenVPN server, we first need the configuration file which was generated by the script at the end of its execution.
This jivendra.ovpn file in our configuration file, we need to download this in order for us to connect to it. Now, there are ways to download it, you can set up an FTP server, or use SCP. The easiest way to get this file is to copy the contents of this file, create a new file on the client device, paste the contents and save this file as the name of the configuration file. You can print the contents of the configuration file with the following command.
cat jivendra.ovpn
Copy the output from the terminal, create a new file on your local machine, paste the contents and save it as ‘jivendra.ovpn’, or you can name it anything, the name does not matter. Now, You need to download the client software on your machine.
Step 1: Let’s see how you connect to your VPN server from a Linux client. Download OpenVPN on your device with the following command
sudo apt install openvpn
Step 2: Now to connect to the server, execute the following command
sudo openvpn –config path_to_client_configuration_file
After that, we should see the following at your terminal.
Our device is successfully connected to your self-hosted OpenVPN server. To close the connection, press Ctrl + C.
How to install and setup the OpenVPN server on Ubuntu/Debian?
A VPN is a tool that acts as a middleman between you and the Internet that you browse. Whatever you do online, the VPN acts as a connecting bridge between your computer and the Internet. To the services that you are using, for example – visiting a website), to them, it appears as if your VPN is the client, but in reality, the VPN relays the information back to your computer, and in turn, hides your identity (IP address). A good VPN encrypts your connection, so whatever data goes between your computer and the VPN server is encrypted, and your ISP cannot read your internet traffic. There are a lot of VPN services that you can subscribe to, but using them means trusting them with your browsing data. So, what is the alternative? Well, you can go on to create your own VPN server, and doing so is not that tricky at all. You would require the following to create your own VPN server:
- A Linux virtual machine with at least 1GB RAM and 1vCPU.
- A VPN software like OpenVPN.
There is a lot of VPN software that let you host a VPN server on a Linux virtual machine, in this article, we will be focusing on one of them, which is OpenVPN.