Kennisbank › Windows Server › Networks and VPN on your own server: Practical guide for developers and system administrators
windows server gemiddeld 07 July 2026

Networks and VPN on your own server: Practical guide for developers and system administrators

Learn how to set up a VPN on your own server with WireGuard and OpenVPN. Practical steps and tips for developers and system administrators.

As a developer or system administrator, you know better than anyone how important it is to work securely and efficiently. A VPN (Virtual Private Network) is an essential tool in this regard. It encrypts your traffic, protects your privacy, and allows you to access your own server or network remotely. But why use a third-party VPN service when you can set this up yourself? In this article, we explain how to configure a VPN on your own server, with concrete steps and practical tips.

Why a VPN on your own server?

There are several reasons to use a VPN on your own server. First, you have full control over the configuration and security. Additionally, you can make your own choices about where you store which data, which is particularly important for companies that process sensitive information. Moreover, it is often cheaper than a monthly subscription with a commercial VPN provider. Finally, you can configure your VPN for specific use cases, such as accessing internal networks or bypassing geographical restrictions.

WireGuard: simple and fast

WireGuard is a modern VPN technology known for its simplicity and speed. It is lightweight, quick to configure, and has a minimal codebase, which makes it safer. Below, we explain how to install and configure WireGuard on your own server.

Installing WireGuard

To install WireGuard on a Linux server, perform the following steps:

  • Install WireGuard via your package manager:

sudo apt-get install wireguard

  • Generate a key pair for the server:

wg genkey | sudo tee /etc/wireguard/privatekey | wg pubkey | sudo tee /etc/wireguard/publickey

  • Create a configuration file for the VPN tunnel:

[Interface]
PrivateKey = {{server_private_key}}
Address = {{server_ip}}/24
ListenPort = 51820

Setting up a VPN tunnel with wg-quick

WireGuard is often used in combination with wg-quick, a tool for quickly setting up tunnels. Here is how you activate a tunnel:

wg-quick up {{interface_name}}

And to remove the tunnel:

wg-quick down {{interface_name}}

With these simple steps, you have a working VPN tunnel on your server.

PiVPN: simple OpenVPN installation

If you prefer to use OpenVPN, PiVPN is an excellent choice. This tool makes installing and managing OpenVPN easy, even if you have no experience with VPN configuration.

Installing PiVPN

Run the following commands to install PiVPN:

curl -L https://install.pivpn.io | bash

During the installation, you will be given the choice between OpenVPN and WireGuard. Choose what best fits your use case.

Adding a new client

To add a new client, use the following command:

sudo pivpn add

This generates a configuration file that you can use to connect to your VPN network.

Alternative VPN options

In addition to WireGuard and OpenVPN, there are other VPN options available, such as Mullvad and ProtonVPN. These are especially useful if you prefer a ready-made solution instead of setting something up yourself.

Mullvad CLI

Mullvad offers a CLI client that allows you to easily connect to their VPN network:

mullvad account set {{account_number}}

ProtonVPN CLI

ProtonVPN also has a CLI client for Linux:

protonvpn init

After initialization, you can easily connect with:

protonvpn connect

Practical tips for setting up a VPN

  • Security first: Make sure your server is up to date and use strong encryption.
  • Test your configuration: Before putting the VPN into production, test it thoroughly.
  • Document your steps: This makes it easier to troubleshoot and adjust the configuration later.
  • Monitor traffic: Use tools such as wg to monitor VPN traffic.

Conclusion

Setting up a VPN on your own server is not only possible, but also offers many benefits. You have full control, can save costs, and customize it to your specific needs. Whether you choose WireGuard, OpenVPN via PiVPN, or a commercial solution such as Mullvad or ProtonVPN, with the right tools and knowledge, you will be well on your way. Take the time to carefully test and optimize your configuration so that you can benefit from a secure and reliable VPN connection.

← Terug naar kennisbank