Jeremy's Wiki

everything but the kitchen sink

User Tools

Site Tools


qnap_nas

Qnap NAS

TBH I would NOT buy or recommend QNAP branded NAS units. Too many problems. Poor experience.

QLocker Ransomware Recovery 😞 😞 😞

Best to run in a ssh + screen session

https://docs.google.com/document/d/17RMJECU9tPURW_Z6qIJDleXaKswltO15AJBVyezPLdw/edit

RED disk health recovery

Rebooting

Each stage can be slow.

Stages:

  1. stopping services
  2. (disconnect)
  3. connection timeout
  4. connection refused
  5. able to ssh login

ZeroTier

Installation

I've found that Entware's builds are MORE up to date than the official ZeroTier QNAP binaries found here https://github.com/zerotier/ZeroTierNAS

Install via Entware:

  1. opkg install zerotier

Entware

/opt/etc/profile

Startup script

You DON'T want to use the Qnap auto run script (https://wiki.qnap.com/wiki/Running_Your_Own_Application_at_Startup) to start ZeroTier because this runs before Entware has started. This method is also rather tedious to edit the boot script.

How you SHOULD boot up ZeroTier is via Entware's init.d

Create /opt/etc/init.d/S90zerotier with the below script content

Don't forget to chmod a+x 🙂

#!/bin/sh

# Based on
# https://www.snbforums.com/threads/a-guide-about-installing-zerotier-on-asus-ac68u-router.42648/

start() {
    if ( pidof zerotier-one )
    then echo "ZeroTier-One is already running."
    else
        echo "Starting ZeroTier-One" ;
        
        # start TUN, or else will get `ERROR: unable to configure virtual network port: could not open TUN/TAP device: No such file or directory`
        modprobe tun

        /opt/bin/zerotier-one -d;
        
        echo 1 > /proc/sys/net/ipv4/ip_forward

        # QNAP
        iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
        iptables -A FORWARD -i eth1 -o ztmjfmodu -m state --state RELATED,ESTABLISHED -j ACCEPT
        iptables -A FORWARD -i ztmjfmodu -o eth1 -j ACCEPT

        echo "$(date) Started ZeroTier-One" >> /opt/var/log/zerotier-one.log ;
    fi
}

stop() {
    if ( pidof zerotier-one )
    then
        echo "Stopping ZeroTier-One";
        killall zerotier-one
        echo "$(date) Stopped ZeroTier-One" >> /opt/var/log/zerotier-one.log
    else
        echo "ZeroTier-One was not running" ;
    fi
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        start
        ;;
    status)
        if ( pidof zerotier-one )
        then echo "ZeroTier-One is running."
        else echo "ZeroTier-One is NOT running"
        fi
        ;;
    *)
        echo "Usage: $0 {start|stop|restart|status}"
        exit 1
        ;;
esac

exit 0
qnap_nas.txt · Last modified: 2022/09/17 01:32 by superuser

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki