Skip to content

Instantly share code, notes, and snippets.

@seltzered
Forked from openoms/add_zerotier.sh
Last active May 15, 2022 01:25
Show Gist options
  • Save seltzered/ec9c115ba056234326e6f4ab281531a4 to your computer and use it in GitHub Desktop.
Save seltzered/ec9c115ba056234326e6f4ab281531a4 to your computer and use it in GitHub Desktop.
Add zerotier to TrueNAS
#! /usr/bin/env sh
pkg install wget -y
echo "# Check the latest version at: https://www.freshports.org/net/zerotier/"
echo "# Which version to install?"
echo "# Example:"
echo "1.6.5"
read VERSION
echo "# Input the space seperated list of networks to join:"
echo "# Example is the public network Earth:"
echo "8056c2e21c000001"
read NETWORKS # Space seperated list of networks to join, default here is the public network Earth
FREEBSD_MAJOR_VERSION=`freebsd-version | sed 's/\..*//'`
wget http://pkg.freebsd.org/freebsd:${FREEBSD_MAJOR_VERSION}:x86:64/latest/All/zerotier-${VERSION}.txz -O /tmp/zerotier-${VERSION}.txz
pkg add -f /tmp/zerotier-${VERSION}.txz
#autostart
echo 'zerotier_enable="YES"' > /etc/rc.conf
service zerotier start
for n in $NETWORKS; do
zerotier-cli join ${n}
done
zerotier-cli status
# if shows PORT_ERROR PRIVATE - acivate 'allow_tun' in the 'Custom Properties' of the jail
zerotier-cli listnetworks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment