部署 PLANET 服务器
https://github.com/xubiaolin/docker-zerotier-planet?tab=readme-ov-file#3开始安装
Linux 客户端配置
https://github.com/xubiaolin/docker-zerotier-planet?tab=readme-ov-file#42-linux-客户端openwrt可以参考这个
安装 zerotier-one
官网提供的安装命令:
curl -s https://install.zerotier.com | sudo bash
安装完成之后检查客户端状态,以下为正常状态:
$ 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 Mon 2024-05-27 17:40:14 CST; 1min 24s ago
Main PID: 1901908 (zerotier-one)
Tasks: 23 (limit: 18922)
Memory: 3.9M
CPU: 230ms
CGroup: /system.slice/zerotier-one.service
└─1901908 /usr/sbin/zerotier-one
$ sudo zerotier-cli status
200 info ccd6037ea3 1.14.0 ONLINE
在 Deepin 上安装
该安装脚本没有兼容 Deepin 系统,故需要在其安装时走 Debian 的途径。
首先查看 Deepin 发行版对应的 Debian 版本:
cat /etc/debian_version
# 10.10
然后找个同版本的 Debian 系统,获取其发行版信息:
docker run -it --rm debian:10.10 cat /etc/os-release
内容类似于
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
然后我们替换默认的系统发行信息:
docker run -it --rm debian:$(cat /etc/debian_version) cat /etc/os-release > os-release.debian
sudo mv /usr/lib/os-release /usr/lib/os-release.deepin
sudo mv os-release.debian /usr/lib/os-release
重新执行安装命令:
curl -s https://install.zerotier.com | sudo bash
安装完成后检查系统服务状态:
$ 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 Mon 2024-05-27 17:00:30 CST; 18min ago
Main PID: 163168 (zerotier-one)
Tasks: 37 (limit: 38333)
Memory: 4.2M
CGroup: /system.slice/zerotier-one.service
└─163168 /usr/sbin/zerotier-one
最后不能忘了还原默认发行信息:
sudo rm -rf /usr/lib/os-release
sudo mv /usr/lib/os-release.deepin /usr/lib/os-release
# docker image rm debian:$(cat /etc/debian_version)
部署
准备自建服务器的 planet 文件,这里假设下载地址保存在环境变量 SER_PLANET
中。
# 备份默认的 planet
sudo mv /var/lib/zerotier-one/planet /var/lib/zerotier-one/planet.default
# 下载自建服务器的 planet
sudo wget -P /var/lib/zerotier-one -O planet $SER_PLANET
sudo chown zerotier-one:zerotier-one /var/lib/zerotier-one/planet
重启 zerotier-one 服务:
sudo service zerotier-one restart
客户端申请加入网络:
sudo zerotier-cli join $SER_NWID
管理后台同意客户端的申请:
- 勾选 Authorized 选项授权客户端加入 zerotier 内网
- 点击 IP assignment 查看客户端在 zerotier 内网的 ip
查看网络成员:
sudo zerotier-cli peers
评论区