Insights

WireGuard handshake did not complete: How to find the cause

A WireGuard timeout doesn't identify the cause. Check live handshake status, UDP reachability and peer keys before troubleshooting tunnel traffic.

Illustration of twin-bell timer with stalled striker.
On this page

WireGuard's retry message means the handshake didn't finish in time, but it doesn't tell you why. Send traffic to a destination that should use the affected peer and check its latest handshake to see if the failure is still happening.

In short:

  • Check live status. Watch for a fresh handshake during a test through the affected peer.
  • No fresh handshake. Check the endpoint, User Datagram Protocol (UDP) path and both peers' keys.
  • Fresh handshake, no traffic. Check the tunnel routes and AllowedIPs.

Check the peer while you send traffic

1. Watch WireGuard's live status on Linux.

Run these WireGuard inspection commands as an administrator. The examples use sudo from a normal Linux shell.

sudo watch wg

Find the affected peer and note its latest handshake value before you start the test. An active interface or an old timestamp doesn't show that the peer can connect now.

2. Send traffic to a known destination through that peer.

If the timestamp updates, the peers completed a handshake. If the timestamp stays old or absent while retries continue, follow the UDP packets next. If traffic already works through the peer, don't expect a fresh handshake for every test packet. The WireGuard Linux compatibility code can stop after a run of retries, so quiet logs don't prove recovery.

Follow the UDP packets in both directions

1. Check the active endpoint and listening port on Linux.

Replace wg0 with the WireGuard interface name on each host. Run the first command on the initiator and the second on the responder.

sudo wg show wg0 endpoints
sudo wg show wg0 listen-port

The initiator needs an endpoint address and UDP port it can reach. If you configured a hostname, check that the active address is the one you intend to reach. If a port forward changes the port, match its outside port to the initiator's endpoint and its inside port to the responder's actual listening port. A peer without a configured endpoint can learn it from authenticated packets when the side that knows where to send initiates.

2. Capture on the interfaces that carry the UDP packets while you repeat the test.

Suppose a port forward sends traffic from UDP port 45000 outside to UDP port 51820 inside. In a tool that uses libpcap capture filters, use this filter at the initiator:

udp port 45000

Use this filter at the responder:

udp port 51820

Use the port visible at each capture point. If the path preserves the port, you can use the same filter at both ends. The filter matches either the source or destination port, so use packet direction, addresses and timing to match what you see to your test.

3. Use the last place you see the packets to choose the next check.

  • Nothing leaves the initiator: Check that the test selects the affected peer and that you're capturing on the right interface.
  • Packets leave but don't reach the responder: Check the endpoint, the port forward and any firewall or upstream filter you manage along that path.
  • Packets reach the responder but no reply leaves: Check the listener and host firewall, then compare the peer keys.
  • A reply leaves but doesn't reach the initiator: Check the return path, including filtering and any address or port translation.

A silent capture narrows where to look. It doesn't identify the cause by itself.

4. Check for an idle-time pattern.

If the peer can send traffic but stops receiving new inbound traffic after it sits idle, its network address translation (NAT) mapping may have expired. PersistentKeepalive is off by default. Consider it on the peer behind NAT if that peer needs to stay reachable while idle. It can help keep the mapping active, but it won't fix a wrong endpoint or key.

Match the public keys on both peers

1. Compare the running public keys on both Linux hosts.

sudo wg show wg0 public-key
sudo wg show wg0 peers

Replace wg0 with the interface name on the host you're checking. The initiator's interface public key should appear in the responder's peer list, and the responder's interface public key should appear in the initiator's list. Check that each key belongs to the intended peer entry.

2. Check the optional preshared key in private.

If you use a preshared key, check both local configurations against the intended shared secret from your approved secret source. Don't post the key, export a full profile or share a configuration QR code.

Test what should work through the tunnel

1. Check the tunnel addresses and routes on Linux.

Replace wg0 with your WireGuard interface name.

ip route
ip addr show dev wg0

Check that the intended destination routes through the WireGuard interface and that the interface has the expected address. Then check AllowedIPs on both peers. This setting selects the peer for outgoing destinations and limits which source addresses that peer can send back through the tunnel.

2. Check forwarding if the destination is behind the peer.

If you can reach the peer itself but not the host behind it, check the onward route and the return route. For Internet Protocol version 4 (IPv4) traffic, check that /proc/sys/net/ipv4/ip_forward reads 1 on the Linux host that needs to pass traffic onward.

3. Repeat the request to the service you need.

Look for the expected response from the intended destination over the tunnel. That confirms the connection works for your task. A fresh handshake or a transfer counter alone doesn't prove the service answers.

Where doxx.net fits. After you send traffic over a doxx.net connection, the handshake and transfer details can help you check whether it's getting through. To connect a device to the private network, you can download the doxx.net app.

Ask an AI assistant

Share this article

Private Everywhere

Stop giving the internet everything

Keep your browsing, messages, files, and agents private.