WireGuard Handshake did not complete: how to fix it

Handshake did not complete means the client sent the server its first packet and got nothing back. WireGuard answers only peers it knows: with wrong keys the server stays silent exactly as if it were off. So there are four places to look: the address and port in Endpoint, whether UDP gets through, the keys on both sides and the server's firewall. With AmneziaWG there is a fifth: its disguise parameters must match the server.

Updated

On this page

What the error looks like

In the Windows app's log it reads Handshake for peer 1 (203.0.113.5:51820) did not complete after 5 seconds, retrying (try 2); clients built on wireguard-go write Handshake did not complete after 5 seconds, retrying after the peer's key. On Linux the kernel module writes such lines only with debugging turned on, so there you usually just see that wg show has no latest handshake line.

Meanwhile the app may even show the tunnel as active: WireGuard has no connection in the usual sense, so the tunnel comes up on the device whether the server answers or not. The sure sign is the counters: data is sent, almost nothing is received.

What you see, why, and what to do

  • Nothing from the client arrives at the server in tcpdump

    CauseA wrong address or port in Endpoint, or the network doesn't pass UDP

    What to doCheck Endpoint; try mobile data or another network

  • Nothing arrives, though the address is right and other networks work

    CauseThe network blocks plain WireGuard: its handshake is recognized by the first packets

    What to doAmneziaWG, or a TCP protocol such as VLESS Reality

  • Nothing arrives, the server's port is right

    CauseThe server's firewall or the hosting panel's firewall closes the UDP port

    What to doOpen the port over UDP: ufw allow 51820/udp, and the same in the panel

  • Packets arrive at the server, it doesn't answer

    CauseThe client's public key isn't among the server's peers, or the client has the wrong server key

    What to doCompare the keys in both files' [Peer] sections

  • The tunnel won't start, or the handshake goes to an old address

    CauseEndpoint is a name that doesn't resolve, or resolved to an old IP

    What to doCheck the name with nslookup; put the IP into Endpoint or restart the tunnel

  • AmneziaWG: packets arrive, no answer

    CauseS1, S2 or H1–H4 differ from the server's, or the client is plain WireGuard

    What to doCopy the AmneziaWG lines from the server's file as they are

  • The handshake happens, then breaks again and again

    CauseThe same key on two devices

    What to doGive each device its own key and its own [Peer] on the server

  • The handshake is there, but no internet

    CauseNot the handshake: forwarding, NAT or AllowedIPs on the server

    What to doTurn on net.ipv4.ip_forward, check the NAT rule and the peer's AllowedIPs

Check from the client

With the tunnel on, wg show tells you whether the server has ever answered.

Linux: Terminal
sudo wg show

Under the peer there should be latest handshake: … seconds ago. No such line — the server has never answered; transfer: with 0 B received confirms it. For AmneziaWG the same command is sudo awg show.

Linux: Terminal
sudo wg show wg0 latest-handshakes

One line per peer: its key and the time of the last handshake in Unix seconds. 0 means there has never been one.

Windows: PowerShell as administrator
& "C:\Program Files\WireGuard\wg.exe" show

The WireGuard app for Windows ships wg.exe; the output is the same as on Linux.

  • Endpoint by name — nslookup vpn.example.com must return the server's address. WireGuard looks the name up once, when the tunnel starts: if the server's IP has changed since, restart the tunnel.
  • Another network — turn the tunnel on over mobile data or another Wi-Fi. If the handshake happens there, the server is fine and the first network doesn't let WireGuard through.

Check on the server

On the server you can see whether the client's packets arrive at all. That splits the problem in two: the way to the server, or the server itself.

On the server
sudo tcpdump -ni any udp port 51820

Turn the tunnel on on the client and watch. Lines with the client's address — the packets arrive. None — they don't reach the server. Ctrl+C stops it; put your own port in place of 51820.

On the server
sudo wg show

The server's public key is under interface, the peers below it. The client's public key must be among them.

On the server
echo "CLIENT_PRIVATE_KEY" | wg pubkey

Derives the public key from the PrivateKey in the client's file. The result must be the PublicKey of one of the server's [Peer] sections.

On the server
ss -uln | grep 51820

Whether anything listens on the UDP port. Nothing — the interface is down: sudo wg-quick up wg0. With ufw on, sudo ufw status must show 51820/udp as ALLOW.

  • Packets arrive, nothing goes back — the keys. WireGuard silently drops packets it can't verify, so wrong keys look like a dead server.
  • Packets don't arrive — the way to the server: a wrong Endpoint, a closed firewall (on the server or in the hosting panel), or a network that doesn't let UDP or WireGuard through.

AmneziaWG: the parameters must match

AmneziaWG is WireGuard with changed packets, and the server recognizes them only by its own rules. S1, S2 and H1–H4 must be the same on the client and the server, and so must S3 and S4 where the file has them (AmneziaWG 2.0): S1 and S2 are the random bytes added to the handshake packets, S3 and S4 the same for the other packets, H1–H4 the markers in place of WireGuard's packet headers. If one of them differs, the server sees noise and stays silent, which gives the same Handshake did not complete. Jc, Jmin and Jmax, the junk packets before the handshake, may differ.

Hence two typical mistakes: an AmneziaWG file opened in plain WireGuard (the app refuses the unknown lines, and with them deleted the server doesn't take its packets), and a client with S1, S2 or H1–H4 set against a plain WireGuard server. Only junk packets, Jc, Jmin and Jmax with no other AmneziaWG lines, work against a plain WireGuard server: it simply ignores them.

When plain WireGuard is blocked

If the handshake never happens on one network but works on another, that network recognizes WireGuard: its first packets have a fixed size and a fixed header and are easy to spot. Changing the port doesn't help for long. AmneziaWG helps, since it changes exactly those signs, or a protocol that looks like ordinary HTTPS from outside, such as VLESS Reality over TCP. Where filtering is serious, AmneziaWG gets found over time too, so keep a profile over TCP at hand.

In Veli

WireGuard in Veli: a file and a real check

In Veli a WireGuard or AmneziaWG .conf goes into Profiles → Add: through “Open a file”, by dragging it into the window, or pasted as [Interface] / [Peer] text. The app tells the two apart by itself, and an AmneziaWG file connects as it is, with its parameters. On a computer, Profiles checks each WireGuard and AmneziaWG server with one real handshake, without touching the computer's network: a silent server shows “no answer”, and one whose address answers but whose handshake doesn't go through shows “blocked”. The profile the tunnel is on right now isn't checked.

On a computer, if the app recognizes a plain WireGuard file, a note under the field offers to add AmneziaWG obfuscation: random packets go out before the handshake, and the server stays as it is. That is the next step when a network has learned to spot WireGuard; the same switch is in the profile's settings later. If the server is yours, the app can install AmneziaWG on it (Profiles → Add → “Your own server”): the keys and parameters then match on both sides by themselves, and each device gets its own.

FAQ

What does Handshake did not complete after 5 seconds mean?

The client sent the server its first packet, got no answer and tries again every 5 seconds. Either the packets don't reach the server, or the server doesn't recognize the client's key.

wg show has no latest handshake. What is wrong?

The server has never answered this client. Check Endpoint, whether UDP gets through from this network, the keys on both sides and the server's firewall.

Why does WireGuard work on Wi-Fi but not on mobile data?

Some operators don't pass UDP or recognize plain WireGuard. AmneziaWG or a protocol over TCP, such as VLESS Reality, helps there.

Can a plain WireGuard client connect to an AmneziaWG server?

Not if the server has S1, S2 or H1–H4 set: it doesn't understand ordinary WireGuard packets. You need a client that knows AmneziaWG, with the same parameters as the server.

WireGuard and AmneziaWG files go straight into Veli

Drop the .conf into the window, and if a network spots WireGuard, add AmneziaWG obfuscation without touching the server.