WireGuard peers see each other's packets but the handshake never completes
Two machines, both behind NAT, both running a recent kernel with the module built in, both listening on the same port. One side updates a DNS record with its current address and the other uses that name as the endpoint.
The interface comes up, the endpoint resolves, and packets are visibly leaving. The handshake never completes — the last handshake time stays empty and no traffic passes.
I have rechecked the keys twice. What else causes a handshake to hang rather than fail outright?
@tunnel_tuva · 2w ago
Two suspects account for the overwhelming majority of these, and they present identically.
Both ends behind NAT with no port forwarding. WireGuard has no concept of a client and a server — but NAT does. If neither side has an inbound path, neither can initiate, and each is waiting for the other. The side with a forwarded port or a public address must exist; if neither has one, no amount of correct configuration will help.
The usual fix is
PersistentKeepalive = 25on the side behind NAT, which punches and maintains a mapping outward. If both sides are behind restrictive NAT, you need one of them to have a real inbound path, or a relay in the middle.A key that is subtly wrong. You have checked twice, but the specific mistake is easy to miss: each peer's configuration must contain the other peer's public key, and its own private key. Putting your own public key in the peer section produces exactly this silent hang, because the packet is undecryptable and WireGuard's design is to not respond at all to anything it cannot authenticate.
Reply
Report