Own VPN on VPS: how WireGuard works and what it is needed for

Own VPN on VPS: how WireGuard works and what it is needed for

Most users envision a VPN as a ready-made application: download, select a country, press a button — and use it. This is convenient, but in such a scheme, all the technical aspects remain on the side of the VPN service. The user does not know who else is using the same IP address, how the server is configured, and what connection data the company retains.

There is another way — to rent a VPS and create your own VPN on it. The server will be used by one person, a family, a team, or a company, and all access keys and network rules will be controlled by the owner.

For such a task, WireGuard is often used — a modern VPN protocol that does not require powerful hardware and works on computers, smartphones, and servers with various operating systems. Let's figure out how a personal VPN differs from ready-made services, where it can be useful, and what to consider before installation.

What is WireGuard and how does it work

WireGuard is an open protocol for creating encrypted connections between devices. It works on Linux, Windows, macOS, Android, iOS, and other platforms, so you can connect, for example, a work laptop, a home computer, and a phone to one server.

The principle is quite simple. The server and each connected device receive a pair of cryptographic keys: a private key and a public key. The private key remains on the device, while the public keys are exchanged among the participants of the connection. This allows the server to understand who can be granted access, without traditional logins and passwords.

WireGuard uses a modern set of cryptographic algorithms, including ChaCha20, Poly1305, Curve25519, and BLAKE2s. However, the main feature of the protocol is not the long list of complex names. Its architecture is significantly more compact than that of many older VPN solutions. The code is easier to audit, and the protocol itself requires fewer server resources to operate.

Read also: Infrastructure as Code on VPS: how to simplify infrastructure management

WireGuard is often compared to OpenVPN and IPsec and is said to be faster than them. This is only partially true. The protocol does indeed create relatively low CPU load and works well even on basic VPS. However, the speed of a VPN also depends on the network channel, the distance to the server, the route between countries, the number of users, and the quality of the internet on the device itself. In other words, installing WireGuard will not turn a slow connection into a lightning-fast one, although it should not take a significant part of its speed.

How a personal VPN differs from a VPN service

Commercial services sell ready-made infrastructure. They have servers in dozens of countries, their own applications, technical support, and additional features. The user does not need to work with Linux, configure the network, or create keys on their own.

The downside of such convenience is the lack of control over the server. One IP address can be used by hundreds of people, which sometimes leads it to be flagged as suspicious. Some websites show captchas, block authorization, or do not accept connections from known VPN addresses at all.

In the case of a personal VPS for VPN, the IP address belongs to a specific server. The owner adds devices, defines available resources, and can remove a specific user without changing settings for the entire network. This is convenient when a static IP address is needed for accessing a CRM, an administrative panel, a database, or another system with restricted access.

But let's also say this: a personal VPN does not guarantee absolute anonymity. Regular websites will see the VPS IP address instead of the home one, but this address is tied to one server. Moreover, the traffic still passes through the hosting provider's network. In fact, the user does not eliminate the need to trust someone; they simply shift that trust from the VPN service to the VPS provider.

Where a private VPN may be needed

The most obvious example is connecting to public Wi-Fi in a hotel, café, train, or coworking space. In such networks, the user does not control the equipment and does not know who administers it. WireGuard creates an encrypted tunnel between the device and the VPS, so the owner of the local network cannot see the contents of the traffic passing through the tunnel.

However, after exiting the VPS, the data moves through the regular internet route again. Therefore, a VPN does not eliminate the need to use HTTPS and other secure protocols.

The second common scenario is remote work. A company can close its CRM, internal storage, accounting system, or control panel from general internet access. Employees first connect to the VPN and then access work services through it. For an outsider, these systems remain inaccessible, even if they know their domain or IP address.

WireGuard is also used for:

  • connecting to a home server, NAS, or video surveillance system;

  • secure server administration;

  • accessing corporate services from allowed IP addresses;

  • working with testing environments and DevOps tools;

  • connecting offices, warehouses, or other remote networks;

  • connecting external specialists to a specific part of the infrastructure.

For example, a developer can be granted access to a test server but not to the accounting system. A separate configuration is created for each device, so permissions can be adjusted according to work tasks.

Read also: Virtual servers in development: how to make life easier for programmers

Which VPS to choose for WireGuard

For a small private VPN, a server with dozens of CPU cores and a huge disk is not needed. WireGuard consumes few resources, so the basic plan is usually sufficient for a few devices.

It is much more important to check the speed of the network port, the amount of allowed traffic, the availability of a dedicated IP address, and root access. Full access to the system is necessary, as during installation, software packages will need to be added, network parameters changed, a UDP port opened, and firewall rules created. This is impossible on regular hosting.

The country of server location also matters. The longer the packets travel, the higher the latency will be. If all team members are in Ukraine, there is no particular sense in routing their traffic through a server on another continent. However, the difference between nearby European locations may be almost imperceptible. It is better to conduct several tests here than to rely solely on a map.

To launch a private VPN, VPS-UP offers separate VPS configurations with servers in Ukraine, the Netherlands, and Germany. Even the basic plans have 2 GB of RAM, NVMe disk, and dedicated IP addresses, which is quite enough for a personal VPN or a small team. The owner can choose WireGuard or OpenVPN, create separate profiles for different devices, and manage them through a web panel. If there are many users or large files are constantly transmitted through the VPN, when choosing a plan, it is worth considering future load: the number of profiles is not limited, but the speed of operation depends on the server resources and network channel.

How to install WireGuard on VPS

First, you need to rent a VPS and install Linux on it. Current versions of Ubuntu or Debian are well-suited for WireGuard, as the necessary packages are available in their standard repositories.

After installing the operating system, the server is updated, SSH access is secured, and WireGuard is installed. Then, server keys and a configuration file for the network interface are created. It specifies the internal IP address, the port for connection, and the rules for added devices.

The work does not end here. The server needs to be allowed to forward network packets, and the selected UDP port must be opened in the firewall. If the user plans to route all internet traffic through the VPN, NAT needs to be configured additionally.

A separate client configuration is created for each computer or smartphone. It can be imported into the official WireGuard application. On a phone, the configuration is often added using a QR code — this is quick and convenient, but the QR code itself needs to be protected just like a password. A person who receives it will be able to connect to the VPN on behalf of that device.

Detailed configuration options for individual users, routing all traffic, and merging networks can be found in the official Ubuntu Server documentation.

If you lack experience with Linux or do not want to deal with network settings on your own, this work can be handed over to VPS-UP specialists. They will fully prepare the VPN server: install WireGuard, configure routing and firewall, create configurations for the required number of devices, and check the connection. The client will only need to install the WireGuard application on their computer or smartphone and import the ready file or scan the QR code.

Is it necessary to route all traffic through the VPN

No, and this is one of the useful features of WireGuard. The user can route all traffic through the tunnel or only requests to certain servers and internal networks.

In the first case, websites will open, messengers will work, files will be downloaded, and DNS queries will be made through the VPS. Websites will see the server's IP address. This mode is convenient when working through unfamiliar Wi-Fi networks.

In the second case, regular internet works through a home or mobile operator, and the VPN is used only for accessing corporate infrastructure. For example, the CRM and database are accessed through WireGuard, while YouTube or video conferencing is accessed directly. This option is called split tunneling. It does not create unnecessary load on the VPS and is often better suited for daily work.

Routes are determined by the AllowedIPs parameter in the client configuration. If it specifies 0.0.0.0/0 and ::/0, all IPv4 and IPv6 traffic is routed through the tunnel. If only the internal subnet of the company is specified, the VPN will be used only for it.

Who is responsible for the security of a personal VPN

Renting a VPS provides more control, but along with it, the user also takes on the responsibilities of an administrator. The hosting provider ensures the operation of the hardware and network, while the configuration of the installed system remains the responsibility of the server owner.

Private keys should not be published, sent in open chats, or stored in a folder accessible to outsiders. A separate pair of keys needs to be created for each device. If a laptop is lost or an employee leaves the company, their access can be revoked from the server configuration without affecting other users.

It is also important to regularly update the operating system, secure SSH access, check firewall rules, and not open the internal network wider than necessary for work processes.

There is another point that is sometimes overlooked. A VPN connection works both ways. After connecting, a device can access the remote network, but participants in that network can potentially reach the device itself. To avoid unwanted connections, networks need to be properly segmented and the firewall configured.

What WireGuard does not protect against

On the internet, VPNs are often attributed almost magical properties. In reality, it is a tool for encrypting connections and building a private network, not a universal protection against all threats. WireGuard will not help in situations such as:

  • Phishing websites. If a user enters their password or banking details on a fake page, the VPN cannot stop them from being transmitted to attackers.

  • Infected files and malware. WireGuard protects the network connection but does not check downloaded files and does not replace antivirus software.

  • Weak or stolen passwords. If an outsider obtains login data, they can authorize in the account regardless of whether the owner uses a VPN.

  • Ads and online trackers. Separate extensions, DNS filters, or other protective measures are needed to block them.

  • Tracking on websites. Instead of the home IP address, resources will see the VPS IP address, but they can still recognize the user by cookies, login data, and browser fingerprinting.

Some services also recognize data center IP addresses and may show captchas, limit access, or require additional login confirmation. This behavior occurs both when using personal servers and when connecting through commercial VPNs.

Who should create their own VPN

WireGuard on VPS is well-suited for users who need a static IP address, control over connections, or secure access to specific infrastructure. This could be a small company with remote workers, a developer, a system administrator, or a home server owner.

If the main goal is to constantly switch between dozens of countries, a ready-made VPN service will be more convenient. A personal server usually has one location and one IP address. Instead, it provides a stable entry point, individual access rules, and the ability to decide how the private network will operate.

You can start with a basic VPS configuration for VPN and one connected device. After launching, it is worth checking the speed, latency, DNS operation, and access to necessary resources from different networks. VPS-UP servers are available in Ukraine, the Netherlands, and Germany, so you can choose the location closest to the main users. And a 30-day money-back guarantee provides enough time to test WireGuard in real scenarios and understand if the chosen configuration is suitable.

Author

Богдана Гайворонська

Журналіст (з 2003 року), IT-копірайтер (з 2013 року), контент-маркетолог Cityhost.ua. Спеціалізується на статтях про технології, створення та просування сайтів.