Tailscale Setup on Entware - davygravy/net-multitool-dg GitHub Wiki

Install Entware

Set up MTD3 for Entware

Prep rootfs in mtd2 for Entware mounting:

#!/bin/sh
# /etc/init.d/S98prep4entware

case "$1" in
	start|"")
		#  attach ubi device to a mtd device
		ubiattach /dev/ubi_ctrl -m 3 -d 3
		#  mount the ubifs parttion to mount, 
		#  choose rw or ro - **enable only one**
		#mount -o rw -t ubifs ubi3:ENTWARE /opt
		mount -o ro -t ubifs ubi3:ENTWARE /opt
	
		#  Next 4 lines are to ensure that any attached USB device
		#  settles and mounts before Entware packages start up.
		#  Example:  a USB SATA drive used for samba data and SWAP
		sleep 2
		mount -a
		swapon -a
		sleep 2
		;;
	stop) 
		;;
	*)
		echo "Usage: S98prep4entware {start|stop}" >&2
		exit 1
        ;;
esac


Mount /opt, check contents; e.g.

root@rescue:~$ ll /opt/etc/init.d/
total 16
drwxr-xr-x    2 0        0              440 Oct  7 20:02 .
drwxr-xr-x    8 0        0             1376 Sep 25 04:13 ..
-rwxr-xr-x    1 0        0             2822 Jul 16 15:55 rc.func
-rwxr-xr-x    1 0        0              966 Jul 16 15:55 rc.unslung

Now symlink to /opt/etc/init.d/rc.unslung:

cd /opt/etc/init.d/
ln -s /opt/etc/init.d/rc.unslung S99rc.unslung

This yields assured setup of the /opt partition and the required startup script links:

root@rescue:~$ ls -lna /etc/init.d/S9*
-rwxr-xr-x    1 0        0              626 Sep  5 12:26 /etc/init.d/S98prep4entware
lrwxrwxrwx    1 0        0               26 Sep  5 12:24 /etc/init.d/S99rc.unslung -> /opt/etc/init.d/rc.unslung

Tweak /opt/init.d/S06tailscaled

#!/bin/sh
#   /opt/etc/init.d/S06tailscaled
#   *** NOTE : see options for advertising routes on last lines

ENABLED=yes
PROCS=tailscaled
ARGS="--state=/opt/var/tailscaled.state"
PREARGS=""
DESC=$PROCS
PATH=/opt/sbin:/opt/bin:/opt/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:
##### Check this line above ... looks suspicious to me...

modprobe tun
sleep 2
mount -o rw,remount /opt

. /opt/etc/init.d/rc.func
   
#  enable forwarding for ipv4/6
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding 

#  adjust to your own subnet!
tailscale up --advertise-routes 192.168.11.0/24 --accept-routes