How to create your own VPN with a VPS only $5/month

My article helps you how to create a VPN server to use by yourself, not to share with others, so you do not have to worry about slowing down the connection. I often use this VPN to access some websites that limit Vietnam’s IP, and also to use when our country’s fiber optic cable is broken (when there is VPN, the network traffic will take a detour, not go by fiber optic cable. should be disconnected faster than when connecting directly).

Instructions on how to create your own VPN, only $ 5 / month

First, you need to register a VPS at Digital Ocean. Create your VPS with the Digital Ocean promo code, so you will get 1 month for free (it gives $ 50 to use in 30 days), but if you register yourself, it will not work.

If you do not use Digital Ocean, then you can create a VPS on or you can create on Google Cloud and Amazon AWS but remember to open the port.

I chose the Digital Ocean because it’s simple.

After registration is complete, we will create a server to install the VPN on. You go to the green Create button on the edge of the screen, select Create Droplet (droplet is essentially the definition of Digital Ocean on a virtual server, not at all).

create digital ocean vps

In the next step, you choose the operating system is Ubuntu 18.04, choose the cheapest configuration (1 CPU, 1 GB RAM, the price only $ 5 / month), select the region that is the country you want, and finally give your server a name you want.

After clicking Create, you wait a bit for the server to be started. About 2 minutes later, an email will be sent to you about the server login information, in which the account name is root and the password will be a long string.

We will then log into the server. On the interface of Digital Ocean, if you refresh the page, you will see your newly created server appear. Select it> Access> Launch Console.

launch digital ocean console

Wait a moment, you’ll see a black screen appear. In that screen, press any key on the keyboard to activate the Terminal interface (the command line driver used with the newly created server). When asked for the login information, enter the user as root, and the password is the messy email.

Note: when entering the password, the word will not appear, but actually there is recognition there. Enter finished and press Enter.

The first time you log in, the server will ask what “Current password” is, retype the email. Then the computer will ask to set a new password, you can set any password you feel familiar with.

Now that we have configured the server, we will continue installing the VPN. The installation is extremely simple, you just need to type the following command, press Enter and wait.

wget -O && sudo sh

When the installation is completed (takes about 5 minutes), the following information will appear on the screen.

install vpn ip sec

Make notes about this information in Evernote or any of your note-taking apps. The Server IP part is the address of the VPN server, PSK is called the private shared key (roughly as another password layer of the type of VPN we use – the L2TP protocol), the username and password are clearly familiar.

Now it’s time to connect your computer and your phone to the VPN server you just created. That part has not changed compared to my old post, so I will copy it for you to reference.

How to connect devices with VPN (OS X, Windows, iOS, Android)

VPN uses L2TP + IPSec security. This is a protocol supported by many operating systems, even available but you do not need to install anything. Here I only guide with 4 popular platforms, other OSs, you guys will be curious. Usually, the VPN setting will be in your settings.

Windows 10 and other:

  1. Right-click the network icon in the clock bar
  2. Select Open Network and Sharing Center> Set up a new connection or network
  3. Select Use my Internet connection (VPN)
  4. Enter the IP address of your server, and the Destination name box, enter what you like. Click Create
  5. Right-click the network icon, select Open Network and Sharing Center again
  6. On the left-hand panel, select Change adapter settings. Right-click on the newly created VPN> Properties
  7. Switch to the Security tab, select Layer 2 Tunneling Protocol with IPsec (L2TP / IPSec)
  8. Click the Allow button, continue to “Challenge Handshake Authentication Protocol (CHAP)” and uncheck the rest
  9. Click the Advanced settings button> Use preshared key for authentication> enter your VPN password (in the example above is tinhte1234)
  10. Click OK to close all windows
  11. Find the Command Prompt application, right-click on it, select “Run as administrator”, then enter the below command (you can copy and paste). Reboot the computer.

REG ADD HKLM \ SYSTEM \ CurrentControlSet \ Services \ PolicyAgent / v AssumeUDPEncapsulationContextOnSendRule / t REG_DWORD / d 0x2 / f

From now on, you can connect to the VPN by clicking the network icon> selecting your VPN> Connect. You will be asked for a username and password.

Mac OS X

  1. Open System Preferences> Network.
  2. Click the + in the upper left corner
  3. Choose VPN
  4. Select L2TP over IPSec in the “Type” box
  5. Enter something in the Service Name box> click Create
  6. Enter the server’s IP address
  7. Enter the username of the server
  8. Click the Authentication Settings button
  9. In the User Authentication section, select the Password box, enter your password
  10. Under Machine Authentication, select the Shared Secret box, and enter the password again
  11. Click OK, select the “Show VPN status in menu bar” box
  12. Select Advanced> check the Send all traffic over VPN connection box
  13. Click OK, then Apply

From now on, you can connect to the VPN by clicking the VPN icon on the menu bar (located at the top of the screen)> selecting your VPN> Connect.  If you are unable to connect to the VPN for the first time, then you should try it a few times.


  1. Run the Settings application
  2. Select More> Wireless & Networks> VPN
  3. Select “Add VPN Profile” or the + sign
  4. Enter something you like in the Name box
  5. In the Type box, select L2TP / IPSec PSK
  6. In the Server box, enter the server’s IP address
  7. In the IPsec PSK (or Pre-shared Key) box, enter your password
  8. Click Save
  9. Select the newly created VPN
  10. Enter your username and password
  11. Click Save
  12. Click Connect


  1. Go to Settings -> General -> VPN.
  2. Select Add VPN Configuration…
  3. Select Type> L2TP
  4. Back, in the Description box, enter a name of something you like
  5. In the Server box, enter the server’s IP address
  6. In the Account box, enter the username of the VPN
  7. In the Password box, enter your password
  8. In the Secret box, enter the password again
  9. Select the “Send All Traffic” line, make sure the switch is green
  10. Click Done
  11. Connect to the VPN

Test your VPN IP with this website:

About the Author: admin
The best hosting, domain and VPS servers coupon codes at help you save money when buying hosting, domain names, and servers.
You might like

Leave a Reply

Your email address will not be published. Required fields are marked *