blob: 68c5d6e647a3a2db3308413594744ed788a4ab99 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/bin/sh
export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/builtin/sbin:/usr/builtin/bin:/usr/local/sbin:/usr/local/bin:/opt/sbin:/opt/bin"
TAILSCALED="/usr/local/sbin/tailscaled"
PIDFILE="/var/run/tailscaled.pid"
# Extra flags you might want to pass to tailscaled.
FLAGS="--tun=userspace-networking"
mkdir -p /var/run/tailscale/ /usr/local/lib/tailscale
mkdir -p /dev/net
mknod /dev/net/tun c 10 200
chmod 777 /dev/net/tun
start-stop-daemon \
--start --background \
--exec $TAILSCALED \
--make-pidfile \
--pidfile "$PIDFILE" \
-- \
--statedir=/usr/local/lib/tailscale/ \
--state=/usr/local/lib/tailscale/tailscaled.state \
--socket=/var/run/tailscale/tailscaled.sock $FLAGS
# sleep 5
if ! grep -q 'net.ipv4.ip_forward' /etc/sysctl.conf ; then
echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
fi
if ! grep -q 'net.ipv6.conf.all.forwarding' /etc/sysctl.conf ; then
echo 'net.ipv6.conf.all.forwarding = 1' >> /etc/sysctl.conf
fi
sysctl -p /etc/sysctl.conf
|