前提概要
Zerotier One 版本:v1.2.10
10.0.0.2是一个公网IP, 根据实际情况设定
deadbeef00是根服务器的ID, sudo zerotier-cli info获取

根服务器节点

通过 identity.public 生成一个 moon.json 文件

sudo zerotier-idtool initmoon /var/lib/zerotier-one/identity.public >> moon.json

编辑 moon.json 文件,写入根服务器IP "stableEndpoints": [ "10.0.0.2/9993"]

{
"id": "deadbeef00",
"objtype": "world",
"roots": [
{
"identity": "deadbeef00:0:34031483094...",
"stableEndpoints": [ "10.0.0.2/9993"]
}
],
"signingKey": "b324d84cec708d1b51d5ac03e75afba501a12e2124705ec34a614bf8f9b2c800f44d9824ad3ab2e3da1ac52ecb39ac052ce3f54e58d8944b52632eb6d671d0e0",
"signingKey_SECRET": "ffc5dd0b2baf1c9b220d1c9cb39633f9e2151cf350a6d0e67c913f8952bafaf3671d2226388e1406e7670dc645851bf7d3643da701fd4599fedb9914c3918db3",
"updatesMustBeSignedBy": "b324d84cec708d1b51d5ac03e75afba501a12e2124705ec34a614bf8f9b2c800f44d9824ad3ab2e3da1ac52ecb39ac052ce3f54e58d8944b52632eb6d671d0e0",
"worldType": "moon"
}

生成 .moon 文件

sudo zerotier-idtool genmoon moon.json

移动 .moon 文件到 moons.d 文件夹中(需要手动创建该文件夹)

sudo mv 000000deadbeef00.moon /var/lib/zerotier-one/moons.d/

重启 zerotier-one

sudo killall -9 zerotier-one

常规节点

将根服务器添加到常规节点

sudo zerotier-cli orbit deadbeef00 deadbeef00

如果自动加载moon文件失败,请手动拷贝000000deadbeef00.moon文件到常规节点的机器上

Windows: C:\ProgramData\ZeroTier\One
Macintosh: /Library/Application Support/ZeroTier/One (在 Terminal 中应为 /Library/Application\ Support/ZeroTier/One)
Linux: /var/lib/zerotier-one
FreeBSD/OpenBSD: /var/db/zerotier-one

重启 zerotier-one

sudo killall -9 zerotier-one

查看节点列表,出现根服务器的MOON节点表示成功

$ sudo zerotier-cli listpeers
200 listpeers
200 listpeers 8841408a2e 159.203.2.154/9993;7723;2322 244 1.1.5 PLANET
200 listpeers 9d219039f3 154.66.197.33/9993;1527750499073;2055 479 1.1.5 PLANET
200 listpeers deadbeef 00 10.0.0.2/33389;2552;7773 189 1.2.10 MOON
200 listpeers e4da7455b2 - -1 1.2.5 LEAF
05-04 00:13