How to set up a personal VPN tunnel in 5 min

Hi, everybody. Today I will show you how to set up a personal VPN tunnel in 5 min. First and foremost, we need a server. I use Digital Ocean for this.

Digital Ocean Account

Register at Digital Ocean. In order to do so use my referral link and you will receive $10 on your digital ocean score. That will be enough for you for the two-month use of the Digital Ocean.

SSH

We will use ssh for easy connectivity to your droplet in the future. If you have the ssh key on your computer, then use the following command for copying it to the clipboard:
Create your first Droplet. Select One-click apps and select Docker in the list of apps. (I use Docker 17.06.0-ce on 16.04 for example)
If you don’t have the ssh key on your computer, then execute the following command to generate it and save it to the clipboard

If you have the ssh key, then you should only execute the following :

After that add your ssh key to your Digital Ocean profile. In order to do so go to Settings.

Image for post
Image for post

Select security tab in the setting screen and click ‘Add SSH Key’

Image for post
Image for post

Paste your ssh key into the dialog and add the name for it, For example, HOME_COMPUTER or WORK_COMPUTER.

Create Droplet

Create your first Droplet. Select One-click apps and select Docker in the list of apps. (I user Docker 17.06.0-ce on 16.04 for example)

Image for post
Image for post

Select a price model. I recommend using the cheapest one — 5$ per month. Then click “Create” in order to create your Droplet.
Check the Private networking box and the checkbox with the name of your ssh.

Image for post
Image for post

Click “Create” to create your Droplet.
After this, you can see the new Droplet in the Droplets page. It should look similar to this.

Image for post
Image for post

Configurate VPN

To connect to your droplet from your computer execute the following command:

When 188.166.168.252 is IP Address of your droplet.

Then 188.166.168.252 becomes your IP Address of your droplet.

For creating your VPN server use following command (Thanks umputun for his docker container) :

After the previous command is finished, execute the following command:

After a few seconds you will see https address in response from the command. Like this : https://188.166.168.252:8080/

Create VPN certificate

Put the https address from the previous step to address line.
Perhaps your browser will ask you about changing the https certificate, click continue.
Rename the downloaded file to MyVPN.ovpn. It is your VPN certificate.

Connect to your VPN server

Install any VPN program on your computer. I will use Tunnelblick.
Open MyVPN.ovpn file in your VPN client program, in the Tunnelblick, you can drag and drop it. Wait several minutes until you get connected to your VPN server.

Also publish on my web site

Android developer at PMLAB.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store