【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 分钟前
Linux下大文件切割与合并实战:解决FAT32文件系统传输限制
linux·运维·服务器
IMPYLH16 分钟前
Linux 的 nice 命令
linux·运维·服务器·bash
l1o3v1e4ding1 小时前
排查linux CentOS7.6的mysql磁盘 I/O 延迟过高问题
linux·运维·mysql
yleihj1 小时前
vCenter计算机SSL证书续期
服务器·网络协议·ssl
航Hang*1 小时前
Windows Server 配置与管理——第12章:配置数字证书服务器
运维·服务器·windows
爱学习的小囧2 小时前
vSphere Supervisor 服务配置指南:自签名容器注册表使用教程
服务器·网络·esxi·虚拟化·vcf
Edward111111112 小时前
linux创建普通用户
linux·运维·服务器
Fanfanaas3 小时前
Linux 基础开发工具(二)
linux·运维·服务器·c语言
齐落山大勇3 小时前
Linux的文件IO
linux·运维·服务器
七七powerful4 小时前
运维养龙虾--Tmux 终端复用器完全指南:从入门到 AI Agent 远程操控
运维·服务器·人工智能