DEV Community

Thien DX
Thien DX

Posted on • Originally published at Medium on

3 2

Set up your own VPN with OpenVPN and DigitalOcean

What is a VPN and why you need it ?

VPN — Virtual Private Network, allows you to create a secure connection over the public Internet to private networks at a remote location.

A VPN can provide protection if you are traveling or using untrusted WiFi networks as all your traffic will be going through an encrypted tunnel, it also provide some privacy bonuses since websites you connect to won’t know your starting location and IP.

OpenVPN

OpenVPN is an open-source commercial software that implements virtual private network (VPN) techniques.

Set up OpenVPN on DigitalOcean

Since we are going to host our own VPN, first we need a server, and DigitalOcean is easy to start with, you can also try AWS or Google Cloud if you want more options.

Sign Up for DigitalOcean account with the following URL to get $100 credits.

https://m.do.co/c/7d6bf3bf13c0 (and yes, it’s my referral link)

Step 1 : Creating cloud server with OpenVPN enabled on DigitalOcean_

After you create your account, go straight to CREATE > DROPLETS to create a “droplet” — cloud server.

You don’t need to start fresh on a new Ubuntu, there’s already an image that support OpenVPN. Marketplace > choose OpenVPN Access Server.

For personal or family usage, the cheapest plan with 1TB data should be enough and it costs only 5$/month; Remember ? With my referral link you got 100$ credit.

For region you will want to choose the closest.

For Authentication, since you are going to create your own VPN, I assume you should have fundamental technical background and care about privacy, please choose SSH. If you have not had a pair of public-private key yet, please check ssh-keygen for Ubuntu or PuTTy for Window.

Step 2 : A little configuration

On the MANAGE panel, go to Droplets > Click on your droplet.

You may want to wait a bit if it’s showing the droplet is being created, once it’s ready, you can proceed.

  1. Log on via SSH to start the setup procedure, you will be asked a number of questions that need to be answered, mostly you can just use default by pressing Enter.
  2. Once that is complete, enter the command “passwd openvpn” to set a password for your Access Server.
  3. Now open the address of your server in a web browser https://your_droplet_IP/admin/, for example: https://123.45.67.89/admin/
  4. If you see any SSL certificate warnings, that is normal, proceed anyway.
  5. Now log on with username ‘openvpn’ and the password you set.

OpenVPN Access Server is ready, you can now add more users if you want to share this VPN with friends by adding users in the User Permissions table.

Step 3 : Almost done, just the client left

Go to https://your_droplet_IP, there’s no “/admin” part this time.

Download the suitable version of client for your OS.

After installing the client, go ahead and open it to find the Access Profile already there for you, turn it on > Enter username +passwords that you set in User Permissions table of the admin tools, THAT’S IT.

Now you can enjoy your very own self-hosted VPN.

You can double check if everything is working by https://www.whatismyip.com , it should point to your droplet IP.

Image of AssemblyAI

Automatic Speech Recognition with AssemblyAI

Experience near-human accuracy, low-latency performance, and advanced Speech AI capabilities with AssemblyAI's Speech-to-Text API. Sign up today and get $50 in API credit. No credit card required.

Try the API

Top comments (1)

Collapse
 
vpnprogramlari profile image
VPN Programları

Good idea 💡

Imagine monitoring actually built for developers

Billboard image

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay