使用zerotier建立局域网

最近不知道怎么了,某米ac2100的ipv6防火墙开不了,导致只能用frps去连接群晖,太慢了。详情点击这里

于是又想尝试zerotie

群晖上的操作比较简单,官网上说的很详细

https://docs.zerotier.com/devices/synology/

1.首先添加虚拟网卡

Write script to /usr/local/etc/rc.d/tun.sh that will setup /dev/net/tun on startup

echo -e '#!/bin/sh -e \ninsmod /lib/modules/tun.ko' > /usr/local/etc/rc.d/tun.sh

Set executable permissions on script

chmod a+x /usr/local/etc/rc.d/tun.sh

Run script once to create a TUN

1
/usr/local/etc/rc.d/tun.sh

Check for the TUN

1
2
3
ls /dev/net/tun

/dev/net/tun

If you experience trouble getting the TUN to work check out

扩展阅读:tun是什么?https://segmentfault.com/a/1190000009249039

2.去群晖官方套件中心添加docker

3.启动容器

Make directory to store ZeroTier’s identity and config

1
mkdir /var/lib/zerotier-one

Make Docker container called zt (Repo: zerotier/zerotier-synology)

1
2
3
4
5
6
7
8
docker run -d           \
  --name zt             \
  --restart=always      \
  --device=/dev/net/tun \
  --net=host            \
  --cap-add=NET_ADMIN   \
  --cap-add=SYS_ADMIN   \
  -v /var/lib/zerotier-one:/var/lib/zerotier-one zerotier/zerotier-synology:latest

4.添加网络

Previous versions of our package contained a GUI, however this is no longer the case and it is for the better. The CLI can be used as follows:

View node status

docker exec -it zt zerotier-cli status Join your network

docker exec -it zt zerotier-cli join 你的网络id Authorize the NAS on your network. Then view the network status:

docker exec -it zt zerotier-cli listnetworks Show running container (optional)

docker ps Enter the container (optional)

docker exec -it zt bash

j接下来就是让win本加入这个网络,官网下载安装包,点join network就行了

在官网就能看到两个设备的ip了,

速度也不是很快,300KBps吧