The official ZeroTier tutorial for Synology currently has the following limitations:
- No ARM64 - Docker (Container Manager) package cannot be installed on older ARM64/aarch64 Synology models (RS819, DS119j, DS418, DS418j, DS218, DS218play and DS118 particularly). Even if you manage to install Docker yourself (might be tricky), the official zerotier-synology image is amd64 only at the moment (there’s a pull request for arm support, hopefully it will be merged some day).
- Older ZeroTier client: at the time of writing zerotier-synology uses ZeroTier 1.10.6 while the latest version is 1.12.2
If you want to use the latest ZeroTier and/or if you have ARM64-based Synology and/or simply prefer to avoid Docker, this tutorial is for you.
1. Create a persistent TUN
SSH to your synology as root and proceed with commands.
ssh user@synology-ip
sudo -i
echo -e '#!/bin/sh -e \ninsmod /lib/modules/tun.ko' > /usr/local/etc/rc.d/tun.sh
chmod a+x /usr/local/etc/rc.d/tun.sh
/usr/local/etc/rc.d/tun.sh
Check for the TUN
ls /dev/net/tun
The command output should be /dev/net/tun.
2. Install ZeroTier
Create ZeroTier folder:
mkdir /volume1/Work/.zerotier
cd /volume1/Work/.zerotier
then download and run zerotier-download.sh script:
wget https://raw.githubusercontent.com/crystalidea/zerotier-linux-binaries/main/zerotier-download.sh
./zerotier-download.sh
The script downloads zerotier-one executable (with zero dependencies) for the target cpu architecture along with zerotier-cli symlink. If interested, learn how we compiled ZeroTier without dependencies here.
Finally, download zerotier-start.sh script that will be run by Synology as root (see next step).
wget https://raw.githubusercontent.com/crystalidea/zerotier-linux-binaries/main/zerotier-start.sh
Do not close the SSH window yet.
3. Create DSM scheduled task
Open DSM and go to Control Panel -> Task Scheduler and create zerotier triggered task that will be automatically executed by Synology every boot:
The task must be Boot-up and executed under root, the task name can be arbitrary. Task settings should include full path to zerotier-start.sh
It’s highly recommended to record all tasks output to some folder:
To avoid reboot now run the scheduled task manually:
Go back to SSH and check if the ZeroTier service is running:
sudo ./zerotier-cli status
Which should output something like this
200 info 339748e2d0 1.12.2 ONLINE
If not, you should check the log folder. Now you can join the networks you need and authorize them online.
Final thoughts
- The method successfully survives DSM updates
- Updating ZeroTier is as easy as replacing one file and reboot
- We failed to compile ZeroTier static on Raspberry Pi 2b 1GB for older armv7 32-bit Synology models