VPS Provider

WireGuard server on a VPS: setup, ports and cost

Published · updated

A WireGuard server is a Linux machine with a public IP address that runs the WireGuard interface and listens on one UDP port, usually 51820; your laptop and phone connect to it with a key pair each. A VPS with 1 vCPU, 1 GB of memory and 20 GB of NVMe is enough for a personal or small-team VPN, and on our price list it costs $4.60 a month.

The WireGuard and wg-easy facts below come from their own documentation as we read it on 25 November 2026. Our prices are from our price list on the same day, per month and without tax.

How big a server WireGuard needs

WireGuard runs inside the Linux kernel and keeps almost no state, so the server size is set by everything else you put on it. WireGuard itself publishes no minimum. With wg-easy you also run Docker and a small web application, which is why we suggest 2 GB for that setup.

VPS sizeForPer month
1 vCPU, 1 GB, 20 GB NVMeWireGuard alone, set up from the command line$4.60
1 vCPU, 2 GB, 40 GB NVMeWireGuard with the wg-easy web interface in Docker$6.67
2 vCPU, 4 GB, 80 GB NVMeThe VPN plus a few other services on the same server$13.34

These sizes are our suggestion. Each server has a 1 Gbit/s port, a dedicated public IPv4 address and an IPv6 /64 subnet, so you can give your clients IPv6 addresses too. What decides how a VPN feels is less the size than the distance: every packet goes to the server and back, so pick the location nearest the people who use it. We have 14 locations, and the configurator shows an estimated latency from where you are.

Install WireGuard

WireGuard's install page gives one command for Ubuntu and Debian: apt install wireguard, which brings the kernel module and the wg and wg-quick tools. For RHEL 8 it describes a longer route through the EPEL and ELRepo repositories, and it has no section for Rocky Linux or AlmaLinux. Of the systems we install, choose Ubuntu 24.04 LTS or Debian 12 for a WireGuard server.

Set umask 077 so only root can read the key files, create the server's private key with wg genkey and derive its public key from it with wg pubkey. Do the same on each client. In /etc/wireguard/wg0.conf the server gets an [Interface] with its private key, a private address such as 10.8.0.1/24 and ListenPort = 51820, and one [Peer] per client with that client's public key and AllowedIPs set to the single address you give it, such as 10.8.0.2/32. Start it with wg-quick up wg0 and make it start at boot with systemctl enable wg-quick@wg0.

WireGuard calls this Cryptokey Routing: each public key is tied to the tunnel addresses it is allowed to use. A packet from a client that claims another client's address is dropped.

Three things that stop a new WireGuard server from working

The UDP port is closed

Our servers start with a firewall that has only SSH open. On Ubuntu and Debian that firewall is ufw, so open the port with ufw allow 51820/udp. WireGuard runs over UDP only: opening 51820/tcp does nothing.

WireGuard's protocol page says the server "does not even respond at all" to a client it does not know. A port scan will show nothing even when everything works, so test with a real client and check with wg show on the server: a line "latest handshake" for the peer means the tunnel is up.

Traffic is not forwarded

To send all of a client's internet traffic through the VPN, set AllowedIPs = 0.0.0.0/0, ::/0 in the client's [Peer] section. The server then has to forward that traffic and hide the clients behind its own address. Set net.ipv4.ip_forward=1 in /etc/sysctl.conf and apply it with sysctl -p, and add a masquerade rule for the server's public interface. ufw also drops forwarded traffic by default, through DEFAULT_FORWARD_POLICY="DROP" in /etc/default/ufw; allow traffic from wg0 to the public interface with ufw route allow in on wg0 out on eth0, using the name your public interface has.

Clients behind NAT go quiet

WireGuard sends nothing when there is nothing to send, so a phone or laptop behind a home router can stop receiving after a while. Add PersistentKeepalive = 25 to the server's [Peer] section in each client's config. WireGuard's quickstart calls 25 seconds a sensible interval that works with a wide variety of firewalls; the default is 0, which turns it off.

wg-easy: a web interface, and a port to keep private

wg-easy runs WireGuard in a Docker container with a web page for adding clients and showing their QR codes. Its documentation installs it with Docker Compose from the compose file in its repository, and asks for a domain name or a public IP address and an x86_64 or arm64 server.

Use the image tag 15. The documentation says the latest tag still points to the v14 release and should be avoided, and recommends pinning the major version to avoid breaking changes. Start and stop it with docker compose up -d and docker compose down, not start and stop, as the documentation asks.

The compose file publishes two ports: 51820/udp for WireGuard and 51821/tcp for the web interface. The installation page tells you to open only UDP 51820 in your firewall, but that is not enough to keep 51821 private: Docker routes traffic to published ports before ufw's rules apply, so the login page is on the internet whatever ufw says. wg-easy's documentation wants the interface behind a reverse proxy with HTTPS. Its INSECURE=true option turns off that requirement, and the documentation says to use it only when the interface cannot be reached from outside your local network.

On a VPS there is no local network, so the simple safe setup is to change the port line to 127.0.0.1:51821:51821/tcp and reach the interface through SSH, which is open anyway: ssh -L 51821:127.0.0.1:51821 root@your-server, then open http://localhost:51821 on your computer. With that tunnel, INSECURE=true is acceptable, because the page never leaves the encrypted SSH connection.

Your own WireGuard server or a VPN service

A VPN service gives you many countries and shares its addresses with thousands of users. Your own server gives you one fixed address that only you and your team use, which is what you want for reaching servers that accept only known IP addresses, or for joining machines in different places into one private network. You also keep the server up to date yourself: install security updates and keep the wg-easy image current with docker compose pull.

Questions

Which port does WireGuard use?

The port you set with ListenPort; 51820 is the one used in WireGuard's own examples and in wg-easy. It is a UDP port: open it as UDP in your firewall. wg-easy also publishes its web interface on TCP 51821, which should not be open to the internet.

How much does a WireGuard VPS cost?

On our price list a VPS with 1 vCPU, 1 GB of memory and 20 GB of NVMe costs $4.60 a month, enough for WireGuard alone. With the wg-easy web interface in Docker we suggest 2 GB, at $6.67 a month. There is no setup fee.

Why can't I see my WireGuard port in a port scan?

WireGuard does not answer packets from clients it does not know, so a scanner gets no reply even when the server works. Check the tunnel with wg show on the server instead.

Is wg-easy safe to expose to the internet?

Its documentation asks for a reverse proxy with HTTPS in front of the web interface. On a VPS, the simplest option is to bind port 51821 to 127.0.0.1 and open the interface through an SSH tunnel.

Sources, read on 25 November 2026: WireGuard, WireGuard quick start, WireGuard installation, WireGuard protocol, wg-easy getting started, wg-easy without a reverse proxy, wg-easy on GitHub, Docker and ufw.

Written and checked by the VPS Provider team.