docker-zerotier-planet/README.md
2021-11-21 17:01:29 +08:00

81 lines
2.2 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.

# Docker-zerotier-planet
私有部署zeroteir-planet服务
zerotier是一个非常好用的私有组网的软件,但是官方提供的服务器离我们比较远,自建planet服务器可以帮我们解决很多与网络有关的问题
# 准备条件
- 具有公网ip的服务器
- 安装docker
# 开始
## 1.下载项目源码
```
git clone https://github.com/xubiaolin/docker-zerotier-planet.git
```
## 2.修改项目中的patch/patch.json
将其中的ip地址修改为你服务器的ip地址,端口保留不变即可
## 3.在包含Dockerfile的目录下打包镜像
```
docker build -t zerotier-planet .
```
打包预计需要2-5分钟,具体需要看网络与机型
# 启动项目
```
docker run -d --name zerotier-planet -p 3443:3443 -p 9993:9993 -p 9993:9993/udp -v /var/lib/zerotier-one:/var/lib/zerotier-one --restart unless-stopped zerotier-planet
```
# 创建网络
服务器需要开放3443端口
然后访问http://ip:3443 即可进入管理后台
![ui](webui.png)
使用默认账号为admin
默认密码为 password
进入后创建一个网络可以得到一个网络ID
# 客户端配置
首先将服务器/var/lib/zerotier-one 目录下的planet文件下载到本地以备用
## linux 客户端配置
安装zerotier-one客户端
```
curl -s https://install.zerotier.com | sudo bash
```
进入/var/lib/zerotier-one目录下
删除目录下的planet文件然后把从服务器下载的planet文件替换过来
然后执行zerotier-cli join 网络ID
成功后可以在管理后台上面看到一个新增的members,此时我们需要授权,否则将无法访问。
![auth](auth.png)
其他客户端加入也是一样要进行授权操作操作
## windows 客户端配置
windows
将planet文件覆盖粘贴到C:\ProgramData\ZeroTier\One中
windows搜索服务并重启zeroiter-one
powershelladmin中执行zerotier-cli listpeers查看planet是否生效
## 安卓客户端配置
[Zerotier 非官方安卓客户端发布:支持自建 Moon 节点 - V2EX](https://www.v2ex.com/t/768628)
# 参考链接
[zerotier-虚拟局域网详解](https://www.glimmer.ltd/2021/3299983056/)
[五分钟自建 ZeroTier 的 Planet/Controller](https://v2ex.com/t/799623)