EQVPS

AmneziaWG on an $8 VPS: your own VPN that doesn't look like WireGuard

Set up AmneziaWG, a WireGuard fork with traffic obfuscation, on a Nano-IP server with Ubuntu 24.04: install from the official PPA, server and client configs, obfuscation parameters, apps. Tested end to end.

AmneziaWG is a fork of WireGuard made by the Amnezia team. It keeps WireGuard's encryption and speed, but changes what the traffic looks like: it sends a few junk packets before the handshake and changes packet sizes and headers, so the connection doesn't match the usual WireGuard pattern. That helps on networks that recognize and block WireGuard, for example some public Wi-Fi, office or hotel networks. This guide sets up your own AmneziaWG server on a Nano-IP plan for $8/mo (2 vCPU, 1 GB RAM, 15 GB NVMe, dedicated IPv4) with Ubuntu 24.04. We ran every command on a fresh server and checked the tunnel from a separate machine.

Step 1. Get a server with its own IPv4

A VPN listens on a UDP port, so the server needs its own public IPv4: on NAT plans only the personal SSH port is reachable over IPv4. Order Nano-IP or any larger plan with a dedicated IP, with Ubuntu 24.04. On the server page, the Access block shows the SSH command:

Access block of a Nano-IP server: SSH command on port 22, IPv6 address, login and password

The Network tab confirms that inbound traffic reaches the server on all ports:

Network tab: dedicated public IPv4, SSH port 22, outbound open except mail ports, inbound on all ports

Connect with ssh root@203.0.113.10 (your address instead of ours). If this is your first time, see how to connect to your VPS.

Step 2. Update the system and restart

AmneziaWG is a kernel module, and it's built for the kernel that is running right now. A fresh server usually has a newer kernel waiting, so update and restart first:

apt update && apt full-upgrade -y
reboot

Wait a minute and connect again. Right after the first boot the system may still be installing updates on its own; if apt says the lock is held by another process, wait a few minutes and run the command again.

Step 3. Install AmneziaWG

Install it from the official Amnezia repository, together with the kernel headers it needs to build the module:

apt install -y software-properties-common
add-apt-repository -y ppa:amnezia/ppa
apt install -y linux-headers-$(uname -r) amneziawg
modprobe amneziawg
awg --version

On our server the last command printed:

amneziawg-tools v3.1.20260812 - https://amnezia.org

The tools are called awg and awg-quick; they work like wg and wg-quick from WireGuard.

Step 4. Create the keys and the server config

Generate a key pair for the server and one for your first device:

mkdir -p /etc/amnezia/amneziawg && cd /etc/amnezia/amneziawg
umask 077
awg genkey | tee server.key | awg pubkey > server.pub
awg genkey | tee client1.key | awg pubkey > client1.pub

Now write the server config. The command below fills in the keys by itself; eth0 is the network interface of your server (check with ip route):

cat > /etc/amnezia/amneziawg/awg0.conf <<EOF
[Interface]
PrivateKey = $(cat server.key)
Address = 10.8.0.1/24
ListenPort = 39814
Jc = 4
Jmin = 40
Jmax = 70
S1 = 52
S2 = 93
H1 = 1813540275
H2 = 702845396
H3 = 2471139861
H4 = 3366024718
PostUp = iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE; iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT
PostDown = iptables -t nat -D POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE; iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT

[Peer]
PublicKey = $(cat client1.pub)
AllowedIPs = 10.8.0.2/32
EOF

Turn on packet forwarding and start the VPN, so it also comes back after every restart:

echo 'net.ipv4.ip_forward = 1' > /etc/sysctl.d/99-amneziawg.conf
sysctl -p /etc/sysctl.d/99-amneziawg.conf
systemctl enable --now awg-quick@awg0
awg show

awg show lists the interface with the listening port and the obfuscation values: listening port: 39814, jc: 4, jmin: 40, jmax: 70, s1: 52, s2: 93 and the four h values.

What the obfuscation parameters mean

  • Jc, Jmin, Jmax — how many junk packets are sent before the handshake (Jc, 4–12 is a good range) and their size in bytes (from Jmin to Jmax).
  • S1, S2 — random padding added to the handshake packets. Pick values from 15 to 150, and S1 + 56 must not equal S2.
  • H1–H4 — replace WireGuard's fixed packet type numbers. They must be four different numbers.

Don't copy our numbers: generate your own once and use the same S1, S2 and H1–H4 on the server and on every device. For example:

echo "S1 = $(shuf -i 15-150 -n 1)"; echo "S2 = $(shuf -i 15-150 -n 1)"
for h in H1 H2 H3 H4; do echo "$h = $(shuf -i 5-2147483647 -n 1)"; done

Step 5. Create the config for your device

Write the client config on the server. Put your server's IPv4 address in Endpoint:

cat > /etc/amnezia/amneziawg/client1.conf <<EOF
[Interface]
PrivateKey = $(cat client1.key)
Address = 10.8.0.2/32
DNS = 1.1.1.1
Jc = 4
Jmin = 40
Jmax = 70
S1 = 52
S2 = 93
H1 = 1813540275
H2 = 702845396
H3 = 2471139861
H4 = 3366024718

[Peer]
PublicKey = $(cat server.pub)
Endpoint = 203.0.113.10:39814
AllowedIPs = 0.0.0.0/0, ::/0
PersistentKeepalive = 25
EOF
cat /etc/amnezia/amneziawg/client1.conf

AllowedIPs = 0.0.0.0/0, ::/0 sends all of the device's traffic through the VPN, including IPv6, so nothing leaks around it. Copy the text into a file called client1.conf on your computer. For a phone, show the config as a QR code right in the terminal:

apt install -y qrencode
qrencode -t ansiutf8 < /etc/amnezia/amneziawg/client1.conf

Step 6. Connect your devices

  • AmneziaVPN (Windows, macOS, Linux, Android, iOS) — the official app from amnezia.org. Add a connection from the file client1.conf or scan the QR code.
  • AmneziaWG — a lightweight client that works like the WireGuard app, with the same import of a file or QR code.
  • Linux from the terminal — install the same amneziawg package and run awg-quick up ./client1.conf.

A regular WireGuard app won't work: it doesn't know the obfuscation parameters. We checked it with the same keys and no parameters: the server ignored it, with no handshake at all.

How we tested it

On a separate machine we connected with the config from Step 5. The result:

latest handshake: 3 seconds ago
4 packets transmitted, 4 received, 0% packet loss
rtt min/avg/max/mdev = 30.769/30.824/30.884/0.055 ms

The ping went to the server's tunnel address 10.8.0.1, and a website that shows your IP saw the server's address, not the machine's own: traffic really goes out through the VPN. With AmneziaWG running, the Nano-IP server still had about 600 MB of memory available.

Add another device

Each device needs its own key and its own address. On the server:

cd /etc/amnezia/amneziawg
awg genkey | tee client2.key | awg pubkey > client2.pub
awg set awg0 peer $(cat client2.pub) allowed-ips 10.8.0.3/32
awg-quick save awg0

Then make client2.conf the same way as in Step 5, with client2.key and Address = 10.8.0.3/32.

Common problems

  • "Could not get lock /var/lib/dpkg/lock-frontend. It is held by process … (apt-get)". A fresh server is still installing its first updates. Wait a few minutes and repeat the command.
  • "modprobe: FATAL: Module amneziawg not found in directory /lib/modules/…". The module wasn't built for the running kernel. Run apt install -y linux-headers-$(uname -r), then dkms autoinstall and modprobe amneziawg, or update and restart as in Step 2 and install again.
  • No handshake. The S1, S2 and H1–H4 values on the device differ from the server, the key is wrong, or the port in Endpoint doesn't match ListenPort. Compare both configs; awg show on the server shows latest handshake once a device connects.
  • "resolvconf: command not found" on a Linux client. awg-quick needs it for the DNS line: install it with apt install -y resolvconf, or remove the DNS line.
  • Connected, but no internet. Packet forwarding is off or the interface name in PostUp is wrong. Check sysctl net.ipv4.ip_forward (it must be 1) and the interface in ip route, then run systemctl restart awg-quick@awg0.

Use the VPN for your own devices; spam, attacks and scanning through it are against the rules, the same as on the server itself. If you only need plain WireGuard, see how to set up a WireGuard VPN. Plans with a dedicated IPv4: see plans.

Stuck? Write to the chat on the site or to info@eqvps.com with your server's hostname — a real person answers.

FAQ

Is AmneziaWG slower than WireGuard?

Not noticeably. It uses the same encryption and the same kernel-level design as WireGuard; the obfuscation only adds a few small junk packets around the handshake and changes packet headers.

Can I use the normal WireGuard app?

No. A regular WireGuard client doesn't know the obfuscation parameters, so the server ignores it. We checked: with the same keys but without the parameters there was no handshake at all. Use the AmneziaVPN or AmneziaWG apps.

Why do I need a plan with a dedicated IPv4?

The VPN listens on its own UDP port. On a NAT plan only the personal SSH port reaches the server over IPv4, so a VPN port isn't reachable. Nano-IP has its own IPv4 with all inbound ports open.

How many devices can connect?

As many as you add. Each device gets its own key pair and a [Peer] block on the server with its own address, for example 10.8.0.3 for the second one.

Comments

No comments yet. Be the first.

Leave a comment

Comments are moderated before they appear.