用 wg show 查看 WireGuard VPN 状态
隧道到底通不通?看握手时间和流量计数就知道。
执行 sudo wg show 查看接口、对端、最近握手时间和收发流量——握手超过 2 分钟没有更新,通常说明隧道已断。
01命令
命令
$ sudo wg show02作用说明
wg show 输出 WireGuard 接口的运行状态:公钥、监听端口、每个对端的端点、AllowedIPs,以及排障最关键的两项——最近握手时间和传输字节数。握手时间新鲜(2 分钟内)且流量增长说明隧道正常;握手停滞则可能是 UDP 被封、密钥填错或对端掉线。加接口名(sudo wg show wg0)只看单个接口。
03风险
!注意: wg show 会显示公钥和端点地址(不含私钥),输出仍属敏感信息。有握手记录只代表密钥交换成功,不代表内网可达——排障时记得在隧道内 ping 一下实际地址。
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- wg(8) — Debian bookworm依据: Same wg(8) manual: show command reports current configuration and runtime status including latest-handshakes and transfer counters.
- wg(8) — Arch Manual Pages依据: Documents wg show and its output sections: peer public keys, latest handshakes, transfer (received/sent) and endpoint addresses.
最后验证: 2026-09-19 · 分类: 网络