前言
这个很有意思,特别是对于纯ipv6的机子,有点类似直接拿了一个ipv4地址。
前置
打开TUN/TAP开关。一般在面板上就可以操作
安装
- apt install curl -y
- curl -s https://install.zerotier.com | bash
处理报错
- 如果直接运行,会看到以下错误。虽然zerotier控制面板能看到授权,但主机上无法获取ip
- # service zerotier-one status
- ● zerotier-one.service - ZeroTier One
- Loaded: loaded (/lib/systemd/system/zerotier-one.service; enabled; vendor preset: enabled)
- Active: active (running) since Tue 2025-01-07 01:35:59 UTC; 2min 44s ago
- Main PID: 249 (zerotier-one)
- Tasks: 24 (limit: 76936)
- Memory: 14.0M
- CGroup: /system.slice/zerotier-one.service
- └─249 /usr/sbin/zerotier-one
- Jan 07 01:35:48 gufi.ippp.ml zerotier-one[254]: Control Plane Stopped
- Jan 07 01:35:48 gufi.ippp.ml zerotier-one[254]: V6 Control Plane Stopped
- Jan 07 01:35:48 gufi.ippp.ml zerotier-one[254]: terminate called without an active exception
- Jan 07 01:35:48 gufi.ippp.ml systemd[1]: zerotier-one.service: Main process exited, code=killed, status=6/ABRT
- Jan 07 01:35:48 gufi.ippp.ml systemd[1]: zerotier-one.service: Failed with result 'signal'.
- Jan 07 01:35:48 gufi.ippp.ml systemd[1]: Stopped ZeroTier One.
- Jan 07 01:35:59 gufi.ippp.ml systemd[1]: Started ZeroTier One.
- Jan 07 01:35:59 gufi.ippp.ml zerotier-one[249]: Starting V6 Control Plane...
- Jan 07 01:35:59 gufi.ippp.ml zerotier-one[249]: Starting Control Plane...
- Jan 07 01:35:59 gufi.ippp.ml zerotier-one[249]: ERROR: unable to configure virtual network port: could not open TUN/TAP device: No such file or directory
处理过程
- nano /lib/systemd/system/zerotier-one.service
- #在ExecStart=/usr/sbin/zerotier-one 后添加 -U参数,结果如下
- [Unit]
- Description=ZeroTier One
- After=network-online.target network.target
- Wants=network-online.target
- [Service]
- ExecStart=/usr/sbin/zerotier-one -U
- Restart=always
- KillMode=process
- [Install]
- WantedBy=multi-user.target
- #重载并重启服务
- systemctl daemon-reload
- systemctl restart zerotier-one
- #加入网络
- zerotier-cli join 网络ID
- #授权后,查看连接状态。一般也可以通过ip a命令查看示
- zerotier-cli listnetworks