- Run zrepl on TrueNAS
- Run ZeroTier on TrueNAS <== you are here
/var as a temporary filesystem (tmpfs) that is erased on every reboot. This includes the ZeroTier database located at
/var/db/zerotier-one. This guide demonstrates how to setup ZeroTier in a way that survives reboots and OS updates while preserving
service zerotier XXX functionality.
- a mesh VPN, like Tailscale and Nebula
- a way of securely connecting your devices over the public internet in a p2p network, without the hassle of VPN
- an emulated, secure Layer 2 ethernet network that sits on top of the public internet
- absolutely awesome software
In this case I’m installing it on TrueNAS as one piece of my “secure, offsite backup of my zfs pool” puzzle.
- TrueNAS (tested on version 12.0-U7)
- Web GUI access
- ssh access (with root/sudo)
- A ZeroTier network and the associated network id
Install on TrueNAS (using FreeBSD packages):
Do not reboot yet.
Start the service
Validate the database was created
Pools and create a dataset called
tank/zerotier mounted at
/mnt/tank/zerotier. You can put this somewhere else if you like, as long as it’s on a storage pool.
Move your db to the dataset:
Mount the dataset dir as the db where zerotier will look for it:
zerotier-cli join <NETWORK-ID>
- Authorize the node in ZeroTier Central
- Make sure
ifconfigshows the ZeroTier interface. Optional:
The ZeroTier service rc script located at
/usr/local/etc/rc.d/zerotier will get erased on reboot, just like the
/var/db/zerotier-one/ directory. To fix this, we copy it to our dataset:
We now need a startup script that performs the following actions on TrueNAS boot:
- Re-mount the ZeroTier DB in our dataset to the /var/db/zerotier-one directory.
- Symlink our backup copy of the rc.d service script back to the
- Re-enable the rc service (using
- Start the rc service
To accomplish this, use my zerotier-start.sh script:
The contents of the script are straightforward:
Validate that your zerotier dataset now looks like this:
zerotier-start.sh to TrueNAS as a Pre-Init startup script:
- Go to Web GUI -> Tasks -> Init/Shutdown Scripts -> Add
- Description = “ZeroTier Startup”
- Type = “Script”
- Select /mnt/tank/zerotier/zerotier-start.sh
- When = “Pre Init” Submit
- Go to Web GUI -> Power (top-right) -> Restart (or
- ssh back in
- Verify zerotier is running:
And we’re done! Your TrueNAS machine should now reliably remain on your ZeroTier network.