DEV Community

Cover image for  Free VPN for 1 Year
MG
MG

Posted on

Free VPN for 1 Year

In this article, I am going to setup a free VPN server and I will use this server for my personal use for 1 year.

Prerequisite:
Setup AWS account(which comes with a Free Tier Eligibility for 12 months)

Now before starting you need to decide in which region you want to host the VPN server

Screenshot 2020-12-06 at 1.14.02 PM

You can check latency across different regions and decide accordingly, and if you have any certain reasons like in my case, some of the Anime on Netflix is only allowed in USA regions so I decided to host my VPN server in the US 😛

Let’s start

Screenshot 2020-12-06 at 12.37.50 PM

  1. Open EC2 service in AWS
  2. Change region from the top to the region where you want to host the VPN server
  3. Click on Launch Instance

Screenshot 2020-12-06 at 12.39.14 PM

Next, it will ask you to choose AMI,

We will be using ubuntu machine which already has OpenVPN server installed, so you need to select AWS Marketplace and search OpenVPN, then you have to select OpenVPN access server which has Free tier eligible tag

Screenshot 2020-12-06 at 12.41.30 PM

OpenVPN is a free and Open Source VPN, but it’s a commercial service but although we can be allowed to open two VPN accounts for free without being charged anything using the Bring Your Own License(BYOL) option and that’s the essence of the page being displayed here.

Screenshot 2020-12-06 at 12.41.47 PM

Choose an Instance Type

  1. Select t2.micro which has Free tier eligible tag
  2. Click on "Review and Launch"

Screenshot 2020-12-06 at 12.42.39 PM

Select Launch

Screenshot 2020-12-06 at 12.43.04 PM

Now you will see a pop-up like above

  1. Choose Create a new key pair
  2. Type key pair name(which can be any string)

  3. Download key pair(Note: It is important to Save this file properly, you will need this file to ssh to this machine)

  4. Click Launch Instance

Screenshot 2020-12-06 at 12.43.48 PM

Screenshot 2020-12-06 at 12.44.53 PM

Now connect to this instance by choosing to connect

Screenshot 2020-12-06 at 12.45.25 PM

In the SSH-client tab, you will see how to connect to this machine using SSH

Screenshot 2020-12-06 at 12.53.48 PM

  1. Open terminal or PowerShell
  2. Change the permission of the private key file if required
  3. Now SSH to the machine as a root user in order to configure the admin side of the VPN
ssh -i "/<path_of_the_file>/<your-key-pair>" root@<your-public-instance-domain>
Enter fullscreen mode Exit fullscreen mode

Screenshot 2020-12-06 at 1.00.24 PM

Press yes and enter

Screenshot 2020-12-06 at 1.02.33 PM

Now keep pressing enter if you want to have a default setting for VPN

After it's done you’ll see an instruction to no longer login as root but as user openvpnas which is created by default.

Screenshot 2020-12-06 at 1.04.20 PM

Now SSH to the instance again, but not as root but as user “openvpnas” using the command below:

ssh -i "/<path_of_the_file>/<your-key-pair>" openvpnas@<your-public-instance-domain>
Enter fullscreen mode Exit fullscreen mode

Now you have to create a password for this user so that you can access the admin and client page of the OpenVPN portal

sudo passwd openvpn
Enter fullscreen mode Exit fullscreen mode

Screenshot 2020-12-06 at 1.05.12 PM

Now get the public IP of the instance and type in the browser
like below:
http://<public IP address>:943/admin

Enter username -> openvpn, password ->

Click sign in

Screenshot 2020-12-06 at 1.05.28 PM

Agree on T&C

Screenshot 2020-12-06 at 1.05.47 PM

Now on this page, select VPN setting
Screenshot 2020-12-06 at 1.06.21 PM

Scroll down and find Should client Internet traffic be routed through the VPN? and enable this

Screenshot 2020-12-06 at 1.06.29 PM

Scroll down and save the settings

Screenshot 2020-12-06 at 1.06.38 PM

When you change the settings, you’ll need to update the server, so click on “Update Running Server”

Screenshot 2020-12-06 at 1.07.05 PM

Now to connect to this VPN, go to a new tab in browser and type
http://<public IP address>:943/

Screenshot 2020-12-06 at 1.07.20 PM

Choose a device for which you want to download OpenVPN client

Screenshot 2020-12-06 at 1.08.42 PM
I downloaded for mac device and installed it now open the app and click on + icon

Screenshot 2020-12-06 at 1.08.59 PM

Now enter the public IP address of the ec2 machine
Screenshot 2020-12-06 at 1.09.18 PM

Enter username and password(It is same that you used to login for admin panel)
Congrats, Now you have successfully connected to the VPN

You can also check your IP by googling what is my IP

Thanks

Top comments (1)

Collapse
 
the_dark_code profile image
MG

Thanks, i didn't use WireGuard earlier, Surely i will check it out now that how good performance it is providing.