containers/containers/mikrotik-tailscale/start-tailscale.sh
Xaver Russ fce015279f
All checks were successful
Build and Push mikrotik-tailscale Container / build-and-push-arch (arm64) (push) Successful in 10s
Build and Push mikrotik-tailscale Container / build-and-push-arch (amd64) (push) Successful in -5s
Build and Push mikrotik-tailscale Container / merge-images-via-manifest (push) Successful in -10s
added toggle nat added set depends on up being set
2025-10-23 03:28:58 +02:00

36 lines
859 B
Bash

#!/bin/sh
echo "Starting Tailscale with ARGS: $up"
echo "Setting Tailscale ARGS: $set"
# Enable IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
# Enable NAT masquerading if requested (nat=true|yes|1)
case "${nat:-}" in
true|yes|1)
if iptables -t nat -A POSTROUTING -o tailscale0 -j MASQUERADE 2>/dev/null; then
echo "NAT masquerading enabled"
else
echo "Warning: Could not enable NAT masquerading (kernel modules or iptables not available)"
echo "Tailscale will still work for basic connectivity"
fi
;;
*)
# nat not set to true/yes/1 — skip NAT setup
;;
esac
# Initialize and start Tailscale
tailscaled > /dev/null 2>&1 &
sleep 5
tailscale up ${up}
if [ -n "${set}" ]; then
tailscale set ${set}
fi
while true; do
tailscale netcheck
sleep 600
done