【Zerotier】自建PLANET服务器内网地址连接

之前已经完成了【Zerotier】通过docker自建PLANET服务器,但是遇到一个问题,因为各种原因,内网里面的ZeroTier Client无法通过PLANET服务器的公网地址连接,愁怀了这下。在经过多方测试验证后,可以采取重新生成一个PLANET文件来解决,具体方法如下:

环境:Ubuntu 22.04

  1. 安装编译组件
bash 复制代码
apt install gcc g++ -y
  1. 下载源码
bash 复制代码
git clone https://github.com/zerotier/ZeroTierOne
  1. 修改源码
    找到ZeroTierOne/attic/world/mkworld.cpp并打开,仿照mkworld.cpp原来的代码,将我们自定义的Planet服务器添加进去。注意,需要删除或注释掉原来的Planet服务器,再增加自己的服务器,否则后续执行我们编译的可执行程序时程序会崩溃。
bash 复制代码
// =========================================================================
// EDIT BELOW HERE

std::vector<World::Root> roots;

const uint64_t id = ZT_WORLD_ID_EARTH;
const uint64_t ts = 1567191349589ULL; // August 30th, 2019

// Test.com
roots.push_back(World::Root());
roots.back().identity = Identity("填写identity.public里的字符串");
roots.back().stableEndpoints.push_back(InetAddress("服务器内网ip地址/通讯端口"));

// END WORLD DEFINITION
// =========================================================================

如果是按照之前的安装的,identity.public的位置可以通过以下去找到:

bash 复制代码
root@X-01:/home/x# docker volume inspect zerotier-one
[
    {
        "CreatedAt": "2023-12-13T13:56:21+08:00",
        "Driver": "local",
        "Labels": {
            "com.docker.volume.anonymous": ""
        },
        "Mountpoint": "/var/lib/docker/volumes/zerotier-one/_data",
        "Name": "zerotier-one",
        "Options": null,
        "Scope": "local"
    }
]
root@X-01:/home/x# cat /var/lib/docker/volumes/zerotier-one/_data/identity.public
1316eeb56a:0:2e5ced97a6c0fd1256c4a2acd4db4bb89c2a21029cd4902252552ec5e7c67b6e14da2f3d7d11bf27d317e970a1992ddc186e48960814796a1e1fdcc6d72a1dcc
root@X-01:/home/x#
  1. 编译配置文件
bash 复制代码
 cd ./ZeroTierOne/attic/world/
 source ./build.sh
 ./mkworld
 mv ./world.bin ./planet
  1. 替换客户端中PLANET文件,重启服务,内网设备即可通过内网地址去连接PLANET了。
相关推荐
虎头金猫1 天前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
AI职业加油站1 天前
AI智能体应用工程师证书:政策红利下的职业新风口
大数据·运维·人工智能·学习·职场发展
此冬歌咏1 天前
K8s 节点故障实战:优雅驱逐 31 秒,硬故障 331 秒,以及那个永远 Pending 的 Pod
运维·k8s
-梅2 天前
linux(8) 软硬链接
linux·运维·服务器
Wang's Blog2 天前
Java 项目实战: 外卖平台-文件下载与ServletOutputStream回写浏览器
服务器·项目开发
张洛闻Eren2 天前
k8s云原生【第十课】:水平 Pod 自动扩缩容
运维·数据库·云原生·kubernetes·github
琥珀色糖2 天前
SimlpeHttp
linux·服务器
其实防守也摸鱼2 天前
内网穿透与反向代理:原理、工具与实战指南
android·大数据·运维·安全·网络安全·自动化·渗透
第十人i2 天前
Linux 日志管理系统:journald 配置与优化
linux·服务器
布裘2 天前
【银河麒麟】V4桌面图标消失,右击鼠标没反应排查
运维·银河麒麟·桌面环境