Your own VPN server · WireGuard, Outline, AmneziaWG · 6 cities · Pay in BTC, USDT, USDC, ETH, SOL, LTC, XMR
Language: English
Get a VPN server

Help center · WireGuard setup · official commands read 16 November 2026

How do I install WireGuard on my TunnelVPS server?

Last updated: · 5 min read

Quick answer

How do I install WireGuard on a TunnelVPS server?

Log in to the TunnelVPS server as root and run apt install wireguard on Debian, or sudo apt install wireguard on Ubuntu. Then make a key pair, write /etc/wireguard/wg0.conf, turn on IP forwarding and start the wg0 interface. Each device gets its own keys and one [Peer] block. The whole setup fits in about 10 commands.

In brief
  • Install: sudo apt install wireguard (Ubuntu) or apt install wireguard as root (Debian), per wireguard.com.
  • Keys: wg genkey | tee privatekey | wg pubkey > publickey, after umask 077.
  • Config: one [Interface] for the server and one [Peer] per device.
  • Port: any free UDP port; TunnelVPS leaves inbound ports open.
  • Clients: official apps for iOS, Android, Windows and macOS; OpenWrt with opkg install wireguard.

Which command installs WireGuard on each TunnelVPS image?

The same package name on all four images; only the sudo prefix differs. TunnelVPS read WireGuard's install page on 16 November 2026.

WireGuard install command for each TunnelVPS system image, from wireguard.com, read 16 November 2026
TunnelVPS imageInstall commandNote from wireguard.com
Ubuntu 24.04 LTSsudo apt install wireguardUbuntu command as published
Ubuntu 22.04 LTSsudo apt install wireguardUbuntu command as published
Debian 13apt install wireguardRun as root
Debian 12apt install wireguardRun as root; backports only for releases older than Bullseye

How do you install the package and make the server keys?

Update the package list, install, then create the key pair inside /etc/wireguard. You log in as root, so sudo is optional. The first SSH login guide covers getting that far.

Install WireGuard and create the server key pair
apt update
apt install wireguard
cd /etc/wireguard
umask 077
wg genkey | tee privatekey | wg pubkey > publickey
cat privatekey publickey

What goes in wg0.conf?

An [Interface] section for the server, then one [Peer] section per device. The sample below uses obvious dummy values. Replace every word in capitals with a real key from your server or device.

  • Address is the server's address inside the tunnel, here 10.8.0.1/24.
  • ListenPort is the UDP port devices connect to. 51820 is common; any free port works.
  • PostUp and PostDown let tunnel traffic out to the internet. Replace eth0 with the name shown after dev in ip route.
  • AllowedIPs under each peer is that device's own tunnel address, one per device.

On Debian, install iptables with apt first if the command is missing.

/etc/wireguard/wg0.conf (sample with dummy values)
[Interface]
Address = 10.8.0.1/24
ListenPort = 51820
PrivateKey = SERVER_PRIVATE_KEY_HERE
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE

[Peer]
# phone
PublicKey = PHONE_PUBLIC_KEY_HERE
AllowedIPs = 10.8.0.2/32

[Peer]
# laptop
PublicKey = LAPTOP_PUBLIC_KEY_HERE
AllowedIPs = 10.8.0.3/32

How do you turn on forwarding and start the tunnel?

Allow the kernel to forward packets, then start wg0 and set it to start at boot. wg show then lists the interface and, once devices connect, each peer with its latest handshake and bytes sent and received.

If you enabled a firewall such as ufw, open the WireGuard port in it. Inbound UDP and TCP ports are open on the server; the customer chooses the VPN port and sets the firewall.

Enable forwarding and start WireGuard
echo "net.ipv4.ip_forward=1" > /etc/sysctl.d/99-wireguard.conf
sysctl --system
systemctl enable --now wg-quick@wg0
wg show

How do you add a phone or a laptop?

Make a key pair for the device, add its public key as a [Peer] on the server, and give the device a client file. Run the same wg genkey line in a separate folder for each device. After editing wg0.conf, restart with systemctl restart wg-quick@wg0.

The client file below points at the server. 203.0.113.10 is a documentation address: put your server's IPv4 there, as shown in the dashboard. AllowedIPs = 0.0.0.0/0 sends all IPv4 traffic through the tunnel.

Each device guide shows how to import the file. Start with the guides hub, which links iPhone, Android, Windows, macOS and routers. The iPhone guide is the most detailed.

phone.conf, the client file (sample with dummy values)
[Interface]
PrivateKey = PHONE_PRIVATE_KEY_HERE
Address = 10.8.0.2/32
DNS = DNS_RESOLVER_IP_HERE

[Peer]
PublicKey = SERVER_PUBLIC_KEY_HERE
Endpoint = 203.0.113.10:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25

What should you keep a copy of?

The /etc/wireguard folder, off the server. No plan includes backups; daily backups kept 7 days can be added at checkout for 15% of the plan price. Without them, keep a copy of the VPN configuration and keys off the server. Reboot, reinstall and delete are sent from the dashboard and carried out by a person; a reinstall erases the disk, VPN keys included.

With a copy of wg0.conf and the server keys, a reinstalled server takes the same configuration back, and devices reconnect without new files. If WireGuard is blocked on a network you use, the WireGuard VPS page points to AmneziaWG and Outline.

WireGuard install questions

Does TunnelVPS offer a server with WireGuard already set up?

No. A ready-made VPN image is not offered today; the four Debian and Ubuntu images are the systems Amnezia lists as officially supported for its self-hosted server. The install takes the commands on this page.

Which port should I use?

Any free UDP port. The sample uses 51820; the same number goes in ListenPort on the server and in Endpoint on each device.

Can I add IPv6 to the tunnel?

Yes. Each server has a routed IPv6 /64. Add an IPv6 tunnel address and ::/0 to the client's AllowedIPs once IPv6 forwarding is set up.

Is there a web panel instead of config files?

wg-easy runs WireGuard with a web admin page in Docker, under the AGPL-3.0 licence. Docker installs with curl -sSL https://get.docker.com | sh, then follow the wg-easy docs.

How do I see which devices are connected?

Run wg show. Each peer shows its latest handshake and the bytes received and sent.

Verdict
  • One command installs WireGuard on every TunnelVPS image; keys, wg0.conf and forwarding finish the job.
  • Keep /etc/wireguard backed up off the server, since a reinstall erases it.
Sources (5)
  1. Installation — WireGuard (read 2026-11-16)
  2. Quick Start — WireGuard (read 2026-11-16)
  3. Protocol & Cryptography — WireGuard (read 2026-11-16)
  4. wg-easy — GitHub (read 2026-11-16)
  5. IPv4 Address Blocks Reserved for Documentation (RFC 5737) — IETF (January 2010)

Need a server for WireGuard?

Solo covers one person for $2.25 a month on 12 months.

From $2.25/mo on 12 months · no KYC

Get a server