文档/安装 wantasticd4 分钟OpenWrt · procd

在 OpenWrt 上安装

通过 SSH 在 2 分钟内于 OpenWrt 路由器上安装 wantasticd:添加 TUN 驱动,运行一条 wget 命令,扫描二维码,点击 Claim Device。

完成后你将得到

wantasticd 作为 procd 服务在路由器上运行,可自动重启、开机自启,路由器在控制台中显示为 Online。

开始之前

  • OpenWrt 19.07 或更高版本,并可通过 SSH 以 root 身份访问。
  • 约 6 MB 可用闪存空间。
  • 路由器时间准确(NTP 默认开启)。
  • 一部手机或一个浏览器,用于登录 Wantastic 控制台。

快速安装(2 分钟)

通过 SSH 以 root 身份连接路由器。两条命令即可安装 TUN 驱动和 wantasticd,然后显示二维码。无需令牌。

  1. 1通过 SSH 以 root 身份登录路由器(ssh root@192.168.1.1)。用下方第一条命令安装 TUN 驱动。
  2. 2粘贴安装命令。它会安装 wantasticd,然后显示二维码。
  3. 3设备会打印 Claim URL 和二维码。用手机扫描二维码,或在浏览器中打开 Claim URL。
  4. 4登录 Wantastic 控制台。Claim Wantastic Device 窗口会打开,密钥已自动填好。点击 Claim Device。
  5. 5终端打印 "Device claimed"。按 Ctrl+C,然后运行下方的重启命令。
  6. 6在控制台中打开 Devices。设备显示为 Online。
安装 TUN 驱动sh
opkg update && opkg install kmod-tun ca-bundle
安装并认领sh
wget -qO- https://get.wantastic.app/install.sh | sh; wantasticd genkey
出现 "Device claimed" 后:按 Ctrl+C,然后重启服务sh
/etc/init.d/wantasticd restart
安装并认领
$ root@OpenWrt:~# wget -qO- https://get.wantastic.app/install.sh | sh; wantasticd genkey
…
Skipping login. Run 'wantasticd login' to authenticate.
Service registered with procd and started.
…
Generated device claim key: /etc/wantastic/device-claim-key.json
Public key: Vd3hK1oQ7mR2sT9uW4xY6zA8bC0dE2fG4hJ6kL8mN0P=
Server URL: https://console.wantastic.app
Claim URL: https://console.wantastic.app/#desktop?claim_public_key=Vd3hK1oQ…%3D&wantastic_server=https%3A%2F%2Fconsole.wantastic.app1
 
█▀▀▀▀▀█ ▄▀▄ ▀█▄ █▀▀▀▀▀█
█ ███ █ ▀█▄▀▄█ █ ███ █
█ ▀▀▀ █ ▄▀█ ▀▄ █ ▀▀▀ █
▀▀▀▀▀▀▀ ▀ ▀ █ ▀ ▀▀▀▀▀▀▀
▀█▄▀▄▀▀█▀▄█▀▄▀▀▄█▀▄▀█▄
█▀▀▀▀▀█ █▄▀▄▀█ ▀▄█ ▄▀
▀▀▀▀▀▀▀ ▀▀ ▀▀▀ ▀▀▀ ▀▀▀
 
2026/10/29 09:14:03 Waiting for claim. Press Ctrl+C to stop.
2026/10/29 09:15:12 Device claimed. Configuration saved to /etc/wantastic/config.conf2
^C
$ root@OpenWrt:~# /etc/init.d/wantasticd restart3
  1. 1打开此链接,或扫描二维码
  2. 2已认领:现在按 Ctrl+C
  3. 3重启一次服务
genkey 打印 Claim URL 和二维码后进入等待。你在控制台中点击 Claim Device 后,它会打印 "Device claimed"。然后按 Ctrl+C 并重启服务。
控制台视图
Claim Wantastic Device
1
Claim public key
q3Xv…9f2Q= (44 characters)
2
Wantastic server
https://console.wantastic.app
Cancel3Claim Device
  1. 1Claim public key 已自动填写
  2. 2Wantastic server 保持默认即可
  3. 3点击 Claim Device
Claim Wantastic Device。Claim URL 和二维码会自动填入密钥,你只需点击 Claim Device。

警告: 大多数 MIPS 路由器(MT7621、MT7628)需要的版本与安装程序选择的不同。如果安装程序停止并提示 "downloaded binary does not report target version",请按照 MIPS 路由器指南操作。

提示: 手边没有手机?从终端复制 Claim URL,在任意电脑上打开即可。

注意: 认领之前,安装程序可能会打印 "Error: procd service did not become healthy"。这在新路由器上是正常的。OpenWrt 24.10 及更新版本使用 apk 代替 opkg:apk update && apk add kmod-tun ca-bundle

检查是否正常工作

  1. 1运行 wantasticd status。它会显示 Status: Connected 和一个 VPN IP。
  2. 2在控制台中打开 Devices。设备显示为 Online。
检查sh
wantasticd status
wantasticd status
$ root@OpenWrt:~# wantasticd status
Status: Connected1
Version: v1.0.54+377f3c0
Mode: TUN (wantastic0)
VPN IPs: 10.200.0.14/322
Public key: q7ZkV3m1yH0dTn8pXo2bLwR4sE6uJ9cA1fG5hK8iN0M=
Server: wg.wantastic.app:51820
Exit node: false
Local access: false
Auto update: true
Traffic: ↓ 18.4 KiB ↑ 9.2 KiB
Peers: 2 (direct 1, relay 1)
Uptime: 4m12s
  1. 1隧道已建立
  2. 2你的覆盖网络地址
Status: Connected 加上 VPN IP 表示隧道已建立。
控制台视图
Devices
1
Search by name, IP, or key...
Select AllAdd Device
DeviceTypeVPN IPStatusSeenActions
HQ-CCR2004MikroTik310.88.0.22Online4Now
Branch-hAP-ax3MikroTik10.88.0.3Online12s ago
Tower-12-OpenWrtwantasticd10.88.0.4Online4s ago
NOC-Ubuntu-01wantasticd10.88.0.5Offline3 h ago
  1. 1按名称搜索
  2. 2状态显示 Online
  3. 3覆盖网络 IP 与 wantasticd status 一致
  4. 4Last seen 持续更新
Devices 窗口:新设备以其名称出现,并在几秒钟内变为 Online。

管理服务

procd 和 logreadsh
/etc/init.d/wantasticd restart
/etc/init.d/wantasticd stop
/etc/init.d/wantasticd start
logread -e wantasticd          # log lines

注意: 正常的日志行会以 daemon.err 级别出现。请看文本内容,而不是级别。

可选:访问路由器的局域网

这样你的其他设备就可以通过 Wantastic 访问路由器的局域网(例如 192.168.1.0/24)。

开启本地访问sh
/etc/init.d/wantasticd stop
wantasticd connect --config /etc/wantastic/config.conf --allow-local-access
# wait a few seconds, press Ctrl+C, then:
/etc/init.d/wantasticd start

注意: 该设置会保存在配置中,因此服务会一直保留它。

其他安装方式

仅在自动化或特殊情况下才需要这些方式。上面的快速安装是最简单的方法。

当你用脚本安装大量设备,或无人能扫描二维码时,请使用令牌。在控制台中创建一次令牌即可:Account → Secrets → + New Secret → Generate。用它替换 <TOKEN>。

令牌安装sh
wget -qO- https://get.wantastic.app/install.sh | sh -s -- --token <TOKEN>

像对待密码一样对待令牌。在其过期之前,任何持有它的人都能向你的账户添加设备。

控制台视图
My Account
ProfileSecuritySessions2FA1SecretsSnapshotsWidgetsMCP
Enrollment Secrets
2+ New Secret
3
Secret Name
noc-rollout
Expiry (Days, 0 for never)
7
Max Uses (0 for unlimited)
25
4Generate
5
noc-rolloutwnt_••••••••3f9a3 / 25 uses · 6 days left
Device claim QRShow Enrollment Script
  1. 1打开 Secrets 选项卡
  2. 2点击 + New Secret
  3. 3为其命名
  4. 4点击 Generate
  5. 5复制新密钥
Account → Secrets → + New Secret。密钥的值就是令牌。

验证结果

wantasticd status 显示 Status: Connected。
logread -e wantasticd 显示 "Wantastic agent started successfully"。
路由器在 Devices 中显示为 Online,重启后依然如此。

常见问题

服务一启动就立即停止。Failed to start agent: create device: create tun: CreateTUN("wantastic0") failed; /dev/net/tun does not exist服务日志
原因

内核 TUN 驱动未加载。

解决方法

加载 TUN 驱动,然后重启服务。

修复sh
opkg update && opkg install kmod-tun
/etc/init.d/wantasticd restart
验证: ls -l /dev/net/tun 显示该设备。
安装程序以 procd 错误结束。Error: procd service did not become healthyinstall.sh
原因

路由器尚未认领,或缺少 kmod-tun。

解决方法

安装 kmod-tun,认领路由器,然后重启服务。

修复sh
opkg update && opkg install kmod-tun
wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
/etc/init.d/wantasticd restart
安装程序在下载后立即停止。Error: downloaded binary does not report target version v1.0.54+377f3c0install.sh
原因

路由器使用小端 MIPS CPU,而安装程序选择了大端版本。

解决方法

手动安装 mipsle 版本。MIPS 路由器指南中提供了可直接复制粘贴的命令。

下载失败。wget failed: https://get.wantastic.app/…install.sh
原因

缺少 CA 证书包、路由器时间不准确,或路由器没有 DNS。

解决方法

安装 CA 证书包并设置时间,然后重新运行快速安装。

修复sh
opkg update && opkg install ca-bundle
ntpd -q -p pool.ntp.org
wget -qO- https://get.wantastic.app/install.sh | sh; wantasticd genkey
安装程序无法写入二进制文件。Error: /usr/bin is still not writable after remounting /install.sh
原因

闪存已满。

解决方法

检查可用空间,移除不用的软件包,然后重试。

检查空间sh
df -h /overlay
安装程序无法重新挂载文件系统。Error: could not remount / read-write. Run as root or unlock the filesystem.install.sh
原因

固件锁定了文件系统(厂商固件)。

解决方法

刷入原版 OpenWrt,或按照《手动安装 tarball》指南安装到可写位置(USB)。

服务无法启动,或反复重启。Failed to load configuration: validate config: private key requiredlogread
原因

wantasticd 已安装,但设备尚未认领,因此其配置文件为空。

解决方法

认领设备,然后重启服务。

认领并重启sh
wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
/etc/init.d/wantasticd restart
验证: wantasticd status 显示 Status: Connected。
你已点击 Claim Device,但终端始终没有打印 "Device claimed"。Claim polling not ready: claim config rejected (401): invalid signature or timestamp out of windowwantasticd genkey
原因

设备时钟不准确。只有当时钟与实际时间相差在 30 秒以内时,认领才能成功。

解决方法

修正时钟。genkey 会继续等待,并自行完成。

设置一次时间sh
ntpd -q -p pool.ntp.org
date
出现了第二个接口(wantastic1),或日志显示端口冲突。Port 51820 in use, using random port服务日志
原因

genkey 仍在终端中运行,而服务也在运行。现在有两个副本在争用。

解决方法

在运行 genkey 的终端中按 Ctrl+C,然后重启服务。

重启sh
/etc/init.d/wantasticd restart
wantasticd status 打印 Offline。Status: Offline — daemon not running (start: sudo systemctl start wantasticd (OpenWrt: /etc/init.d/wantasticd start))wantasticd status
原因

后台服务已停止、已崩溃或仍在启动中。status 命令不会启动服务。

解决方法

启动服务。

启动服务sh
/etc/init.d/wantasticd start
status 显示 Running (tunnel down),或 peers 显示 (server) 为 HANDSHAKE never。Device health check failed: …服务日志
原因

网络阻止了到中心节点(wg.wantastic.app)的出站 UDP 51820 端口,或 DNS 不可用。

解决方法

在防火墙中放行出站 UDP 51820,然后重启服务。

测试 DNS 并重启sh
nslookup wg.wantastic.app
/etc/init.d/wantasticd restart
验证: wantasticd peers 显示 (server) 有最近的握手(例如 "8s ago")。
你想把设备迁移到另一个账户,或重新进行认领。Config already exists at /etc/wantastic/config.conf — skipping login.install.sh
原因

即使重新运行安装程序,设备也会保留其配置。你必须先移除旧配置。

解决方法

将旧配置移到别处,然后用新密钥重新认领设备。

从头开始sh
mv "/etc/wantastic/config.conf" "/etc/wantastic/config.conf.bak"
wantasticd genkey --force
# after "Device claimed": press Ctrl+C, then:
/etc/init.d/wantasticd restart
验证: 设备出现在新账户中,wantasticd status 显示 Connected。
令牌安装在下载后立即失败。Login failed: registration rejected (401): invalid or expired login tokeninstall.sh / wantasticd login
原因

令牌错误、已过期、已用完(达到 Max Uses)或已被删除。

解决方法

不使用令牌,改为认领设备。

改用认领sh
wantasticd genkey
# after "Device claimed": press Ctrl+C, then:
/etc/init.d/wantasticd restart
验证: 设备出现在 Devices 中并显示为 Online。
认领或登录被拒绝。Login failed: account has reached its device limit — upgrade your plan or remove an existing devicewantasticd login / 控制台
原因

你的套餐设备数量已满。控制台显示 "You have reached the maximum number of devices for your plan."

解决方法

在 Devices 中删除一台不再使用的设备(设备行 → Delete),或升级套餐。然后重新认领。

继续阅读

仍然无法解决?

请通过邮件发送设备名称、平台和完整的错误文本。切勿发送令牌、密钥或密码。

hello@wantastic.app