Make a VPN server for yourself with $5/month

Sy Truong
5 min readAug 7, 2021

--

First, you create a Digital Ocean account using this link. This link uses my referral code, so you will get 1 month for free (it gives you $ 50 to use for 30 days), but if you register yourself, it is not there. If you do not use Digital Ocean, you can create your own server on Google Cloud or Amazon AWS EC2, remember to open the port. I choose Digital Ocean because it’s simple.

After registration is complete, we will create a server to install the VPN. You go to the Create button on the top edge of the screen, select Create Droplet (droplet is actually Digital Ocean’s definition of a virtual server, nothing more).

In the next step, you choose the operating system as Ubuntu 18.04, choose the cheapest configuration (1 CPU, 1 GB RAM, cost $ 5 / month), choose the region as the country you want (I usually choose Germany). then the connection time to your place will be faster), and finally name your server (temporarily set it to “my-vpn-server”, so for simplicity).

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

Then we will login to the server. On the interface of Digital Ocean, you refresh the page and you will see the server you just created appear. Select it > Access > Launch Console.

Wait a moment, you will see a black screen appear. In that screen, type any key on your keyboard to activate the Terminal interface (which is the command line driver used with the server you just created). When asked for login information, enter the user as root, and the password as the clutter sent in the email.

Notice: when entering the password, the word will not appear, but in fact there is a record there. After typing, press Enter.

The first time you access it, the server will ask what is “Current password”, re-enter the one in the email. Then the machine will ask to set a new password, you just set the password you feel familiar.

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

When the installation is complete (it takes about 5 minutes), information will appear on the screen as shown below.

Make a note of this information in Evernote or your other note-taking app. The Server IP part is the address of the VPN server, PSK called the private shared key (temporarily understood as another password class of the type of VPN we use — L2TP protocol), the username and password are clearly familiar.

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

To connect a device to a VPN (OS X, Windows, iOS, Android):

Our VPN uses L2TP + IPSec security. This is an interface that is supported by many operating systems, even available, but you do not need to install anything. Here I only guide with 4 popular platforms, other OS, you guys can find out by yourself. Usually the VPN settings will be in your settings.

Windows 10 & Windows 8.x:

  1. Right-click the network icon on 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 in the Destination name box, enter whatever name you like. Click Create
  5. Right-click on the network icon, select Open Network and Sharing Center again
  6. In the left hand panel, select Change adapter settings. Right-click 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, select “Challenge Handshake Authentication Protocol (CHAP)” and uncheck the rest.
  9. Click the Advanced settings button > Use preshared key for authentication > enter your VPN password
  10. Click OK to close all windows
  11. Find the Command Prompt application, right-click it, select “Run as administrator”, then enter the command below (can be copied and pasted). Restart the computer.

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

Mac OS X:

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

From now on, you can connect to a VPN by tapping the VPN icon in the menu bar (located at the top of the screen) > selecting your VPN > Connect

Use this website to check if your IP address is the same as the server address.

--

--