Site Tools


freshtomato_zerotier

Connecting FreshTomato to Zerotier

ZeroTier lets you build modern, secure, multi-point virtualized networks of almost any type. From robust peer-to-peer networking to multi-cloud mesh infrastructure, you can achieve global connectivity as easily as setting up a local LAN.


  1. Register an account on the Zerotier website. Zerotier
  2. Create a network on ZeroTier Central
  3. Note down the network ID
  4. Use Entware to install Zerotier on your router. (At the command line, type “opkg install zerotier”).
  5. If your router is MIPS-based, the Zerotier version may be very old (~ 1.1.4). If so, it can't use some functions such as 'join orbit'.
    Download the newest version ZeroTierOne 1.10.6 mipsel static-bin and use it to replace the old version.
  6. Use the script below to control Zerotier operation. You can auto-start the daemon, join the network, stop, unload tun and more.
  7. (Replace the NETWORK_ID in this script with your own).



#!/bin/sh
 
 
PREFIX="/opt/bin"
NAME="zerotier-one"
CTL_NAME="zerotier-cli"
FRIENDLY="ZeroTier ONE"
NETWORK_ID="e4da3344b2c13e80"
WORKING_DIR="/opt/var/lib/zerotier-one"
CMDLINE="-d $WORKING_DIR"
LOG_FILE="/var/log/${NAME}.log"
 
 
alias elog="logger -t $NAME -s"
 
 
COND=$1
[ $# -eq 0 ] && COND="start"
 
 
start() {
    if [ -n "$(pidof $NAME)" ]; then
        elog "$FRIENDLY is already running."
        exit 1
    fi
    elog "Starting $FRIENDLY Services: "
    lsmod | grep -q "tun" || modprobe tun
    $PREFIX/$NAME $CMDLINE
    sleep 5
    $PREFIX/$CTL_NAME join ${NETWORK_ID}
    if [ "$?" = "0" ]; then
        elog "succeeded."
    else
        elog "failed."
    fi
}
 
 
stop() {
    if [ ! -n "$(pidof $NAME)" ]; then
        elog "$FRIENDLY is not running."
    fi
    elog "Shutting down $FRIENDLY Services: "
    killall -SIGTERM "$NAME"
    sleep 5
    lsmod | grep -q "tun" && modprobe -r tun
    if [ "$?" = "0" ]; then
        elog "succeeded."
    else
        elog "failed."
    fi
}
 
 
do_info() {
    elog "Starting $FRIENDLY Services info mode: "
    $PREFIX/$CTL_NAME info
}
 
 
do_restart() {
    stop
    sleep 3
    start
}
 
 
case "$COND" in
start)
    start
    ;;
stop)
    stop
    ;;
restart)
    do_restart
    ;;
info)
    do_info
    ;;
*)
    elog "Usage: $0 (start|stop|restart|info)"
    ;;
esac
exit 0



When zerotier runs and has finished joining the network, go to ZeroTier Central and authorize the new (router) device. This completes the setup process.

Check the ZeroTier Knowledge Base for more info about Zerotier.



freshtomato_zerotier.txt · Last modified: 2023/05/28 05:46 by hogwild