SELF-HOSTED VPN GUIDE

How to Set Up WireGuard on a VPS

Set up WireGuard on an Ubuntu VPS, configure a peer for each device and verify access to your private network.

Prepare the VPS

Choose a supported Ubuntu image with WireGuard kernel support, administrator access and an address reachable by your clients. Pick a UDP listening port and a tunnel subnet that does not overlap your client networks. Keep SSH access available while modifying firewall rules.

Install WireGuard and define peers

On Ubuntu, install the package with sudo apt install wireguard. Follow Quick Start to generate a separate key pair for the server and each peer. Keep each private key on its own device. Assign each client a distinct tunnel address and configure AllowedIPs for the routes that client should use.

Bring up the interface and test a client

Allow the configured UDP port. Bring up the tunnel using the upstream instructions and point a client at the VPS address and port. Use sudo wg show to check the handshake, then verify access to the intended resource. Enable forwarding and configure routing only if clients need access beyond the VPS.

Remove unused peers

Remove lost or retired devices from the server configuration. Back up the configuration securely and check the endpoint, port, public keys and routes if a peer cannot connect.

Documentation status and related products

Upstream documentation reviewed on 5 December 2026. Installation and client connectivity were not tested on VPSRoom for this guide.