22.12.2024

How to create and set up your VPN server

Set up your own VPN on the server to get internet freedom.

How to create and set up your own VPN server

Choosing hosting

To set up a VPN, you need a VPS – a virtual private server. You can choose any hosting provider, as long as the following conditions are met:

  • The server is located in a country that does not fall under the jurisdiction of Russian authorities, but is close enough to your real location.
  • Random access memory (RAM) must be at least 512 MB.
  • Speed network interface – 100 MB/s or more.
  • Network traffic – 512 GB or more or unlimited.

The amount of allocated hard disk space and type of drive does not matter . You can find a suitable solution for 3-4 dollars a month. Here are some of the most popular VPS providers:

  • Amazon Web Services;
  • DigitalOcean;
  • Arubacloud;
  • Hostinger;
  • Hetzner;
  • Liquid Web;
  • Bluehost;
  • Vultr.

Choose KVM when buying a server. OpenVZ and Xen will also work if they have TUN connected – you need to ask the technical service of the hosting provider about this.

With KVM, you won’t have to do any additional manipulations, although some hosting providers on it may limit the ability to create a VPN. You can also check this with the support service.

How to create and configure your own VPN server

When setting up the server, you can enter any value in the “Host name” item: for example, test.test. The prefixes NS1 and NS2 are also not important: we write ns1.test and ns2.test.

The operating system is CentOS 8 64 bit or any other distribution kit, there are no fundamental differences in the settings. Leave the network traffic at 512 GB or choose an additional amount if you are afraid that the existing one will not be enough. Location – the closer the better. The Netherlands will do.

How to create and configure your own VPN server

After payment, you will receive an email with all the necessary data to set up a VPN. You have purchased a place on a server in another country, it remains to redirect all traffic to it.

Setting up VPN

To connect to the server and send commands, we will use the Putty program. I received a link to it in a letter with registration data for hosting. You can download the program here. Putty and its analogues are also available on macOS, the settings will be identical.

Launch Putty. On the Session tab, in the Host Name field, enter the IP address that came in the letter and click Open.

How to create and configure your VPN server

If a warning window appears, click Yes. After that, the console will start, through which you will send commands to the server. First you need to log in – authorization data is also in the letter from the host. Login will be root, print it by hand. Copy the password to the clipboard. To paste the password into the console, right-click and press Enter. The password will not be displayed in the console, but if you are logged in, you will see information about the system or server number.

How to create and configure your VPN server

It shouldn't take long between entering your login and password . If an error message appears, restart Putty and try again.

To set up the VPN, I used the ready-made OpenVPN road warrior script. This method does not guarantee complete anonymity, so that when committing illegal actions, the user is easy to find. But it is enough to bypass the blocking. If all VPN services stop working, this connection will continue to function as long as I pay for hosting.

To use the script, paste the line wget https://git.io/vpn -O openvpn-install into the console. sh && bash openvpn-install.sh.

How to create and configure your VPN server

After successfully adding the script, a dialog with the setup wizard will start. He independently finds the optimal values, you just have to agree or choose the appropriate option. All actions are confirmed by pressing the Enter key. Let's go in order:

  1. The IP address must match the IP address that you received in the letter from the hoster.
  2. Leave the default protocol as UDP.
  3. < li>Port:1194 – Agree.

  4. Which DNS to use – Select Google. Delete 1, write 3 and press Enter.
  5. Client name – Specify the username. You can leave client.
  6. Press any key – press Enter again and wait for the configuration to complete.

After the configuration is completed, you need to create a file using which you will be connecting to the VPN. Enter the command cat ~/client.ovpn.

How to create and configure your VPN server

The contents of the file will appear in the console. Scroll up to the cat ~/client.ovpn command and select everything below except the last line. The selection must end with </tls-auth>. To copy a fragment, press Ctrl + V.

How to create and configure your VPN server

Launch Notepad, paste the copied snippet and save the file to your desktop as client.ovpn.

How to create and configure your VPN- server

Open the “File” menu, select “Save As”, set the type to “All files” and enter a name with the extension – client.ovpn.

Connecting to the server

To connect using the generated file, you need an OpenVPN client. The PC version can be downloaded here. Download and install the program, but don't run it. Right-click the client.ovpn file and select Start OpenVPN.

How to create and configure your own VPN server

A console window will appear with the connection initialized. If the connection was successful, the status below will be Initialization Sequence Completed. While connecting, a network selection window may appear, click on a public network.

How to create and configure your own VPN server

To make sure the connection is correct, check the IP address. It must match the one that the hoster wrote in the letter. To stop sending requests to a server in another country, close the OpenVPN window.

OpenVPN also has clients for mobile devices.

How to create and configure your own VPN server

OpenVPN Connect – Fast & Safe SSL VPN ClientOpenVPN Price: Free “How to create and configure your VPN server” />

Download

Price: Free

How to create and configure your own VPN server

OpenVPN ConnectOpenVPN TechnologiesPrice: Free

How to create and configure your VPN server

Download

Price: Free

To establish a connection, transfer the client.ovpn file to the phone's memory. Launch the application and select OVPN Profile. Specify the path to the file and move the slider to the “On” position.

How to create and configure your VPN server

How to create and configure your own VPN server

An icon will appear at the top VPN connections. To verify that traffic is being redirected through a server in another country, open any IP address checking service in your mobile browser.