WireGuard is a fast, simple VPN: one configuration file, modern cryptography and apps for Windows, macOS, Linux, iOS and Android. Here is how to deploy it on three kinds of MyCloud servers — a VPS with a public IP, VPS-NAT without its own address and a Linux container (LXC) — so your staff can securely reach your servers and internal services.
Which option to choose
| Option | Address to connect to | Price |
|---|---|---|
| LXC container on NAT | shared address + your external port | from 1 650 UZS a day |
| VPS-NAT | shared address + your external port | from 2 250 UZS a day |
| LXC container or VPS with a public IP | your own IP address, any port | from 2 650 UZS a day |
1 vCPU and 1 GB of memory are enough for a VPN for 10–30 people. The WireGuard module is available in LXC containers, so installation is the same as on a regular server.
Important: a VPN on VPS-NAT or in a NAT container is for your own team and office. Public VPN services and open proxies for third parties are not allowed on the shared address.
Step 1. Install WireGuard
Connect to the server over SSH (on VPS-NAT, via the personal port shown in the server card) and install the package. Ubuntu and Debian:
apt update && apt install -y wireguard qrencode
AlmaLinux and Rocky Linux:
dnf install -y epel-release && dnf install -y wireguard-tools qrencode
Step 2. Generate keys
cd /etc/wireguard && umask 077
wg genkey | tee server.key | wg pubkey > server.pub
wg genkey | tee user1.key | wg pubkey > user1.pub
Create a separate key pair for each employee (user2, user3…), so you can revoke one person’s access without touching the others.
Step 3. Choose a port
- VPS or container with a public IP — the standard UDP port 51820 is fine.
- VPS-NAT and NAT containers — on the “Firewall” tab of the server card, open one of your three external ports for UDP. Note the external port (clients connect to it) and the internal server port it leads to — use the latter as ListenPort.
Step 4. Configure the server
Find the network interface name with ip route | grep default (usually eth0) and create /etc/wireguard/wg0.conf:
[Interface]
Address = 10.8.0.1/24
ListenPort = 51820
PrivateKey = <contents of server.key>
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]
# user1
PublicKey = <contents of user1.pub>
AllowedIPs = 10.8.0.2/32
On VPS-NAT, set ListenPort to the internal port from step 3. Enable packet forwarding and start the tunnel:
echo "net.ipv4.ip_forward=1" > /etc/sysctl.d/99-wireguard.conf && sysctl --system
systemctl enable --now wg-quick@wg0
wg show
If ufw is enabled on the server, allow the port: ufw allow 51820/udp.
Step 5. Connect an employee
Create user1.conf:
[Interface]
PrivateKey = <contents of user1.key>
Address = 10.8.0.2/32
DNS = 1.1.1.1
[Peer]
PublicKey = <contents of server.pub>
Endpoint = <address>:<port>
AllowedIPs = 10.8.0.0/24
PersistentKeepalive = 25
- Endpoint — the server’s public IP and 51820, or for VPS-NAT the shared address from the server card and the external port from step 3.
- AllowedIPs = 10.8.0.0/24 — only traffic to the server and the internal network goes through the VPN; the rest of the internet goes direct. To reach your other servers, add their networks separated by commas.
The easiest way to get the configuration onto a phone is a QR code: qrencode -t ansiutf8 < user1.conf — then scan it in the WireGuard app. On a computer, import the file into the WireGuard app for Windows, macOS or Linux.
Step 6. Check it
Turn the tunnel on on the device and run ping 10.8.0.1. On the server, wg show shows the latest handshake time and the traffic for each employee.
If it doesn’t connect
- No handshake in
wg show— check the port: on VPS-NAT, the external port must be open for UDP and lead to ListenPort. - The tunnel is up but services are unreachable — check
sysctl net.ipv4.ip_forwardand the interface name in the PostUp rules. - The connection “falls asleep” behind NAT — keep PersistentKeepalive = 25 in the client configuration.
What next
To connect a whole office to the cloud rather than individual employees, read “VPN Between Your Office and the Cloud: How to Connect Employees to the Server Securely”. Servers for a VPN are on the VPS and Linux containers pages. If something doesn’t work, message us on Telegram and we will help.
Need help with the task from this article?
We’ll pick a configuration, calculate the cost and help with the move.