How to check if WireGuard client/peer is connected?
You can use wg show
to check if a client is connected:
wg_show_output.txt
interface: Computer
public key: X6NJW+IznvItD3B5TseUasRPjPzF0PkM5+GaLIjdBG4=
private key: (hidden)
listening port: 19628
peer: H3KaL/X94984cLDNWFsM4Hx6Rs/Ku0bW2ECkDUn7wFw=
endpoint: 10.9.1.108:19628
allowed ips: 10.217.59.2/32
latest handshake: 27 seconds ago
transfer: 13.19 MiB received, 12.70 MiB sent
persistent keepalive: every 1 minute
Look for this line:
wg_latest_handshake.txt
latest handshake: 27 seconds ago
If it’s less than two minutes old, the client is connected.
If the latest handshake
line is missing entirely, the peer has never connected successfully!
If in doubt, you can often ping
the client to verify. It depends on the client configuration and possibly firewall settings if it will answer the ping but it never hurts to try.
Check out similar posts by category:
Networking, Wireguard
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow