连接与运行时错误
解决服务启动失败、配置错误、TUN 问题、没有握手以及 DNS 警告。
wantasticd status 显示 Connected,且设备处于 Online 状态。
开始之前
- 设备上的 root 或管理员权限。
- 服务日志(参见 故障排查:从这里开始 → 收集日志)。
如何阅读日志
- 以 "Failed to load configuration:" 或 "Failed to start agent:" 开头的行会使服务停止,随后服务管理器每 5 秒重启一次服务。
- 正常启动以 "Wantastic agent started successfully" 结束。
- 每 30 秒出现一次 "Device health check failed",表示代理在运行,但隧道没有流量通过。
- P2P、端口映射和 DNS 提示大多只是信息性的。
检查要点
- 1服务循环重启:读取第一条 "Failed to …" 行,并在下文中查找。最常见的原因是配置为空。
- 2服务在运行但没有握手:放行出站 UDP 51820,然后检查时钟。
- 3握手正常但无法访问某个对端:检查 Topology 中的组链接。
$ sudo journalctl -u wantasticd -n 3 --no-pagerwantasticd[812]: Failed to load configuration: validate config: private key required1systemd[1]: wantasticd.service: Scheduled restart job, restart counter is at 14.
- 1尚未认领
$ sudo wantasticd genkeyDevice claimed. Configuration saved to /etc/wantastic/config.conf1$ sudo systemctl restart wantasticdwantasticd[901]: Wantastic agent started successfully
- 1按 Ctrl+C
速查表
| 错误 | 最简单的修复方法 |
|---|---|
| Config not found at … / private key required | 使用 genkey 认领,然后重启。 |
| server public key … / server endpoint required | 删除配置,重新认领。 |
| failed to resolve endpoint <host> | 修复 DNS;服务会自动重试。 |
| /dev/net/tun does not exist | 安装 kmod-tun 或加载 tun 模块。 |
| operation not permitted | 以 root 身份运行或添加 NET_ADMIN。 |
| Device health check failed | 放行 UDP 51820;校正时钟。 |
| the running daemon is older than this CLI… | 重启服务。 |
| DNS: tunnel DNS not written (…) | 设置 WANTASTIC_DNS_MODE=off。 |
验证结果
错误与解决方法
connect 找不到配置。Config not found at <cfg>. Run `wantasticd genkey --out <key>` to create a claim key and wait for claim, or pass --wait-claim with an existing key.wantasticd connect
设备从未认领过,或配置位于其他位置。
使用 genkey 认领设备,然后重启服务。
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd安装后服务立即失败。Failed to load configuration: validate config: private key requiredwantasticd 日志
设备尚未认领,因此配置为空。
使用 genkey 认领设备,按 Ctrl+C,然后重启服务。
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd配置缺少中心节点密钥。Failed to load configuration: validate config: server public key requiredwantasticd 日志
配置不完整,或被手动编辑过。
移走损坏的配置并重新认领设备。
sudo mv /etc/wantastic/config.conf /etc/wantastic/config.conf.bad
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd中心节点密钥无效。Failed to load configuration: validate config: server public key must be a base64-encoded 32-byte WireGuard keywantasticd 日志
配置只是占位内容(例如 Windows 登录失败后),或密钥在复制粘贴时损坏。
移走损坏的配置并重新注册。在 Windows 上,使用新令牌登录。
sudo mv /etc/wantastic/config.conf /etc/wantastic/config.conf.bad
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd配置中没有端点。Failed to load configuration: validate config: server endpoint requiredwantasticd 日志
配置不完整。
移走损坏的配置并重新认领设备。
sudo mv /etc/wantastic/config.conf /etc/wantastic/config.conf.bad
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd启动时无法解析中心节点主机名。Failed to load configuration: validate config: failed to resolve endpoint <host>: …wantasticd 日志
启动时 DNS 尚未就绪,或解析器故障("no IP addresses found for hostname")。
检查 DNS。服务会自动重试。
nslookup wg.wantastic.app
sudo systemctl restart wantasticd无法创建隧道接口。Failed to start agent: create device: create tun: CreateTUN("wantastic0") failed; /dev/net/tun does not existwantasticd 日志
缺少 TUN 内核模块(OpenWrt 未安装 kmod-tun),或容器中没有 /dev/net/tun。
安装或加载 TUN,然后重启服务。
opkg update && opkg install kmod-tun # OpenWrt
sudo modprobe tun # Linux
docker run --device /dev/net/tun --cap-add NET_ADMIN … # Docker接口或路由出现权限错误。operation not permittedwantasticd 日志
wantasticd 未以 root 身份运行,或容器没有 NET_ADMIN 权限。
使用已安装的服务(它以 root 身份运行),或为容器添加 --cap-add NET_ADMIN。
sudo systemctl restart wantasticd启动重试次数已用完。failed to start agent after 10 attempts: …wantasticd 日志
另一个错误反复出现。冒号后面的文字才是真正的原因。
在此列表中查找冒号后面的文字,修复后重启服务。
监听端口被占用。Port N in use, using random portwantasticd 日志
另一个程序占用了该端口。"Port %d in use, retrying with port %d..." 含义相同,仅为提示信息。
无需操作。
隧道中没有对端。WARNING: No peers configured in WireGuard device!wantasticd 日志
配置中没有 [Peer] 部分。
移走配置并重新认领设备。
sudo mv /etc/wantastic/config.conf /etc/wantastic/config.conf.bad
sudo wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
sudo systemctl restart wantasticd健康检查持续失败。Device health check failed: …wantasticd 日志(每 30 秒)
与中心节点没有握手:出站 UDP 51820 被阻止、时钟错误或 MTU 过大。
在上游防火墙上放行出站 UDP 51820,并校正时钟。
sudo timedatectl set-ntp true
wantasticd peers本地控制端口失败。IPC API Error: failed to find open portwantasticd 日志
端口 127.0.0.1:9034 及后续端口均被占用。"Warning: failed to start local IPC API" 和 "IPC API Error binding to …, trying next port..." 与此相关。
停止占用该端口的程序,或使用 WTC_IPC_PORT 设置其他端口。
sudo ss -ltnp | grep 9034CLI 版本比服务新。the running daemon is older than this CLI and has no /api/…; restart it to load the installed version (sudo systemctl restart wantasticd)wantasticd status / peers / ping
二进制文件已更新,但服务仍在运行旧版本。
重启服务。
sudo systemctl restart wantasticdCLI 无法与服务通信。daemon returned HTTP N: …wantasticd CLI
本地控制 API 失败。"decode daemon response" 情况类似。
重启服务后重试。
sudo systemctl restart wantasticd对端一直走中继。direct handshake timeoutwantasticd 日志
NAT 阻止了直连路径。"promotion queue full"、"gateway does not answer NAT-PMP"、"no UPnP internet gateway found" 和 "router's external address is not public (CGNAT)" 同样无害。
无需操作,中继可以正常工作。如需直连路径,请在路由器上启用 UPnP 或 NAT-PMP。
本地访问找不到局域网。enable local access: no directly connected private IPv4 LAN subnet foundwantasticd (--allow-local-access)
该设备没有私有 IPv4 局域网。
在此设备上使用 --allow-local-access=false 关闭该选项。
macOS 或 Windows 上的本地访问。automatic local-access subnet routing is not supported on macOS yetwantasticd (--allow-local-access)
此功能仅适用于 Linux 和 OpenWrt(Windows 显示 "… on Windows yet")。
使用 Linux 或 OpenWrt 设备作为局域网网关。
伪装(masquerade)规则失败。iptables masquerade on <if>: …wantasticd (--allow-local-access)
缺少 iptables。
安装 iptables。
sudo apt-get install -y iptables
opkg install iptables-nft # OpenWrt无法启用转发。enable forwarding: …wantasticd (--allow-local-access)
系统设置为只读(例如在容器中)。
在宿主机上启用 IP 转发。
sudo sysctl -w net.ipv4.ip_forward=1本地访问设备过多。too many tenant local-access advertiserswantasticd (--allow-local-access)
你的账号中共享局域网的设备过多。
在不需要的设备上关闭 --allow-local-access。
无法写入 DNS。DNS: tunnel DNS not written (…)wantasticd 日志
另一个程序在管理 DNS。相关消息:"write <f>: read-only filesystem; remount it read-write or manage DNS through the platform resolver"、"<x> owns /etc/resolv.conf; DNS cannot be changed safely"、"<if> is not managed by NetworkManager"。
让系统管理 DNS:为该服务设置 WANTASTIC_DNS_MODE=off。
sudo mkdir -p /etc/systemd/system/wantasticd.service.d
printf '[Service]\nEnvironment=WANTASTIC_DNS_MODE=off\n' | sudo tee /etc/systemd/system/wantasticd.service.d/dns.conf
sudo systemctl daemon-reload && sudo systemctl restart wantasticd更新检查警告。Update check failed; will retry in an hour: …wantasticd 日志
设备无法访问 get.wantastic.app。隧道仍正常工作。
允许访问 get.wantastic.app 的 HTTPS。
curl -I https://get.wantastic.app/latest出现两个隧道,或出现 wantastic1 接口。ip link / wantasticd 日志
genkey 或 login 仍在前台与服务同时运行。
在 genkey 窗口中按 Ctrl+C,然后重启服务。
pgrep -a wantasticd
sudo systemctl restart wantasticd继续阅读
仍然无法解决?
请通过邮件发送设备名称、平台和完整的错误文本。切勿发送令牌、密钥或密码。