DEV Community

Cover image for Secure Your Online World for Under $6: Why You Need a Personal VPN
Mustafa Baysal
Mustafa Baysal

Posted on

Secure Your Online World for Under $6: Why You Need a Personal VPN

Ever felt like you’re being watched while surfing the web? No, it's not your nosy neighbor peeking through the blinds; it’s something a lot sneakier. That’s right, we’re talking about hackers, ISPs, and those pesky ad companies tracking your every move online. But fear not, friends! The superhero cape for your online life could well be a DIY VPN. Why settle for off-the-shelf when you can tailor-make your digital suit of armor?

Building your own VPN is like brewing your own beer; it’s satisfying, tailored to your taste, and impresses the heck out of your friends. "Oh, you use a commercial VPN? That's cute. I prefer my custom blend." With your own VPN, you control the server, meaning you know exactly who accesses what data – spoiler: it’s just you. Plus, you get to bypass those annoying geo-blocks. Ever tried watching your favorite show abroad only to find it’s blocked? With your own VPN, it’s like you never left your couch!

So, whether you’re a digital nomad, a privacy enthusiast, or just someone who doesn’t like being tracked like a FedEx package, setting up your own VPN could be the way to go. It’s not just about avoiding Big Brother; it’s about creating a safer, freer internet experience, on your own terms. Join the DIY VPN revolution—because if you want something done right, sometimes you just have to do it yourself.

5 reasons to have your own VPN

  • Total Control Over Data: You control your data without relying on third-party providers.
  • Customized Security Protocols: Tailor your security measures to fit your specific needs.
  • Faster Speeds: Enjoy quicker internet connections without sharing bandwidth with others.
  • Cost-Effective in the Long Run: Potentially lower costs compared to ongoing VPN service fees.
  • Internet Freedom: Experience unrestricted internet access with no censorship.

Guide

Here's a quick guide I often use: Select a server location (I prefer Frankfurt) from providers like Vultr, DigitalOcean, or AWS, and follow the simple steps provided. It's that easy to get your own VPN up and running!

ssh your_username@your_server_ip
Enter fullscreen mode Exit fullscreen mode

First, ensure Docker is installed on your server. If it’s not, run:

curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
Enter fullscreen mode Exit fullscreen mode

Don't forget to replace "your_username" and "your_server_ip" with your actual details.

Now, enter the world of Docker! Grab the OpenVPN image kylemanna/openvpn using this magical incantation:

docker pull kylemanna/openvpn
Enter fullscreen mode Exit fullscreen mode

Next, conjure a volume to store all our precious OpenVPN configuration and certificates. A simple command should do the trick:

docker volume create --name openvpn-data
Enter fullscreen mode Exit fullscreen mode

Alright, now we're getting to the real juice. Commence the OpenVPN by creating the necessary configuration magic and start secreting those all-important certificates:

docker run -v openvpn-data:/etc/openvpn --rm kylemanna/openvpn ovpn_genconfig -u udp://YOUR_SERVER_IP_OR_DOMAIN
docker run -v openvpn-data:/etc/openvpn --rm -it kylemanna/openvpn ovpn_initpki
Enter fullscreen mode Exit fullscreen mode

Remember to put your server's actual IP address or domain in place of "YOUR_SERVER_IP_OR_DOMAIN".

Having done all that hard work, it's time to sit back and let our OpenVPN server fire up:

docker run --name openvpn-server --restart=always -v openvpn-data:/etc/openvpn -d -p 1194:1194/udp --cap-add=NET_ADMIN kylemanna/openvpn
Enter fullscreen mode Exit fullscreen mode

Before you could relax with a cup of coffee, there's one final thing to take care of. Make a user-specific OpenVPN certificate and create the .ovpn file for it:

docker run -v openvpn-data:/etc/openvpn --rm -it kylemanna/openvpn easyrsa build-client-full YOUR_USERNAME nopass
docker run -v openvpn-data:/etc/openvpn --rm kylemanna/openvpn ovpn_getclient YOUR_USERNAME > YOUR_USERNAME.ovpn
Enter fullscreen mode Exit fullscreen mode

Be sure to replace YOUR_USERNAME with your chosen username. Cherish this .ovpn file; it's your ticket to your very own VPN.

And there you have it! Your own custom VPN server, up and running, using Docker and your chosen cloud provider. Enjoy your new level of privacy and control over your internet experience!

Finally you can download OpenVPN Connect app and import your .ovpn file.
OpenVPN Connect for MacOS
OpenVPN Connect for Windows

Top comments (0)