Creating and using your own VPN or virtual private network has various benefits. When you create your VPN, you can download, upload, browse and do other activities without anyone storing logs.
In today’s date, the data we store in our computer and our information is priceless for VPN providers and other parties sitting on the other side. We install VPN to protect our network from ISP providers and cybercriminals. But exactly how safe is it to trust VPN providers?
There are several reasons you should consider creating and using your own VPN. It protects you from frauds, unknown people stealing your data, advertisers etc. In this post, I talk about the method of creating your VPN.
Moreover, the first step to start is creating an account on Linode.
Must Read: How To Set Up And Manage VPN On Windows 11
Create Your VPN
Step 1: Add a Server or Linode.
Step 2:Â Select a district or image from the list of images. I would suggest you go for the latest version of your operating system, for example, Ubuntu 20.04 LTS.
Step 3:Â Choose the location that is physically close to you and select the cheapest Linode Plan.
Don’t worry if you want to set up a website and do other activities on the web. Their cheapest plan will cover all of it for an individual.
Step 4:Â You can rename the Linode label to whatever you want. After that, choose a strong password and upload the SSH key. You can do this later.
Step 5:Â Lastly, tick the Private IP box and click on Create.
Create Your VPN: Generating SSH Keys
Step 1:Â Open the terminal command on your operating system. On Linux, it is available in the applications section, and for Windows, you have to open a power shell with administrator privileges.
Step 2:Â Either way, after you open the terminal command, type Add-Windows Capability -Online -Name Open SSH.Client ~~~0.0.1.0.
Step 3: Furthermore, type ~ssh-keygen -t rsa -b 4096 and press enter.
Step 4:Â Once again, press enter when the command terminal will ask for a key location to save it to the default one. Then enter your password and tap enter.
Step 5:Â After that, your server will start, and you’re ready to log in. Furthermore, copy the IP address from the server control panel by going back to the terminal command and typing ssh root@139.162.245.193.
Step 6:Â Type yes and press the enter key.
Updating The Packages
Step 1:Â Update your operating system and software. To do that, type apt-get update && apt-get upgrade, and the updation will automatically start.
Step 2:Â You can also upgrade your favourite text editor.
Create A Non-Root User
While many users are okay with not adding another layer of password for their authentication, some are paranoid and would prefer to enter a password along with the two-factor authentication to protect their data. If you are one of those users, then read further.
Step 1: In the terminal command, type useradd – G sudo -m your username -s /bin/bash.
Step 2:Â Enter your local password and then enter your new password twice, and you’re all set.
Create Your VPN: Configuring SSH
After you have set your user profile, you have to copy the public SSH key to the server. To do that:
Step 1:Â Open a second terminal window for your local terminal and enter ssh-copy-id username and IP address.
Step 2:Â It will prompt you to enter your user password to authenticate. Furthermore, go back to the terminal window with your server but don’t close the other window yet.
Step 3:Â At this point, you have to restrict the authentication to the public key only.
Step 4:Â To edit the SSH configuration, we have to change the default port, but it will not do much for security. However, it will help in dealing with the obnoxious SSH scanners that try to log into your server with fake credentials.
Step 5:Â Take any available port and disable the passwords. Furthermore, you will only be able to log in using a Public key password and disable root login.
Step 6:Â In addition, save the file, restart the SSHD servers using system ctl, and restart sshd.
Step 7:Â Go back to the local machine and log in with the key. If it prompts you to enter your password, you will be good to go.
Create Your VPN: Installing And Configuring OpenVPN
In comparison to other VPN, OpenVPN has wider support for client applications.
Step 1:Â Go to Github OpenVPN and download the script by a user named Nyr. To do that, click on Raw and choose Copy the link from your browser.
Step 2:Â Moreover, log in to your server and install wget. If you already have it in your operating system, no need to do it twice.
Step 3:Â In the terminal command, type wget and paste the link you copied before.
Step 4:Â Launch the script and answer its questions; wherein most cases, it is better to pick up a default answer.
Step 5:Â After you are done answering all the questions, press any key and the installation process will begin. It is an automatic system, and you do not have to do anything manually.
Step 6:Â Moreover, in the configuration file, change verb 3 to verb 0.
Step 7:Â Now restart the OpenVPN, and you will see how it no longer keep any logs.
Step 8: Moreover, now you can change the local host’s name if you don’t like it.
Step 9:Â Download the configuration file to your local machine so that you can use the VPN. So open a terminal in your local machine and type the sftp server name.
Step 10:Â Download the file using the command sftp> get config name. ovpn and finally type exit.
Moreover, if you want to use this VPN for all your traffic, download tunnel blick on mac, Open VPN on Windows or load it into the network manager on Linux. After this, the server will think you’re from somewhere else and cannot locate you when you start searching for something.
Conclusion
If you want to increase the strength of protection, you can use mosh. There is no complicated configuration file. Just install mosh on both your local and remote machine. After that, you simply use the mosh command to replace SSH.
Also Read: How To Enable VPN Blocked By Your Router?