2026-04-02 23:12:36 +08:00

53 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Docker自建Zerotier Planet
createTime: 2024/10/26 19:02:54
tags:
- ZeroTier
- Docker
categories:
- 随记
---
## 前言
在[ZeroTier 组网的简单应用](2024-07-01.md)中,我们自建了 Zerotier Moon并使用 Moon 优化了连接延迟。
但是在实际使用中,很多时候明明可以 ping 通 Moon 所在 IP但出现了断开连接的问题猜测可能原因是与 Planet 服务器连接不稳定,导致根本走不到 Moon 这一步,因此考虑自建 Planet 和 Controler。
## 卸载 Zerotier One 环境
由于[docker-zerotier-planet](https://github.com/xubiaolin/docker-zerotier-planet)使用容器化部署,为了避免端口冲突等问题,干脆把原来的 Zerotier-One 卸载掉:
```bash
sudo dpkg -P zerotier-one
sudo rm -rf /var/lib/zerotier-one/
```
## 配置 docker 环境
参考[ubuntu 安装 docker](../note/docker/2023-06-27.md)
## 配置 Planet
```bash
# 下载源码
git clone https://ghproxy.imoyuapp.win/https://github.com/xubiaolin/docker-zerotier-planet.git
# 执行安装脚本
cd docker-zerotier-planet
sudo ./deploy.sh
```
安装过程很安逸,按提示操作就完事了,安装结束后进入 web 页面新建网络、配置 ip 等操作与官方 Zerotier Controller 类似
## 客户端配置
### Windows
下载`planet`文件,覆盖到`C:\ProgramData\ZeroTier\One`
`Win+R` `services.msc`找到 Zerotier One重启服务然后就可以加入新建的网络了
### Linux
类似地,下载`planet`文件,覆盖到`/var/lib/zerotier-one`中,然后重启服务`sudo service zerotier-one restart`,重启好久可以加入网络了