[Tutorial] Tailscale on GL-SF1200, GL-SFT1200 (Opal)

Automatic installation

Lanrat’s Tailscale Repository

echo "src/gz openwrt-tailscale https://lanrat.github.io/openwrt-tailscale-repo/packages/19.07" >> "/etc/opkg/customfeeds.conf"
opkg update
opkg install tailscale

It’s not compressed as of writing this (30MB binary), but it’s much easier to install, and now supports our architecture

Manual compilation and installation

Prerequisites

  1. A GL.iNet SiFlower router, like the Opal (GL-SFT1200)
  2. A Linux system (or WSL2 on Windows) to build Tailscale

Building Tailscale

  1. Clone the Tailscale repository:
git clone https://github.com/tailscale/tailscale.git
  1. Install Golang: Download and install - The Go Programming Language
  • Verify that Go is installed correctly:
go version
  1. Install the latest (important!) version of UPX: Release v4.0.2 · upx/upx · GitHub
  2. Install binutils-mipsel-linux-gnu
sudo apt install binutils-mipsel-linux-gnu
mipsel-linux-gnu-strip --version
  1. Build Tailscale:
# Change to the Tailscale directory:
cd tailscale

# Optionally switch to a specific version:
# git checkout tags/v1.44.0 -b v1.44.0

# Build the combined binary - mipsel, hardfloat (?), linked statically, stripped, verbose:
# Note: mipsel = mipsle for Golang
GOOS=linux GOARCH=mipsle GOMIPS=hardfloat CGO_ENABLED=0 go build -v -o tailscale.combined -tags ts_include_cli -trimpath -ldflags="-s -w" ./cmd/tailscaled
  1. Compress the binary:
mipsel-linux-gnu-strip tailscale.combined
upx --lzma --best -o tailscale.upx ./tailscale.combined

Installing Tailscale

  1. Copy the tailscale.upx binary to the router:
scp tailscale.upx root@192.168.8.1:/root # or whatever your router's IP is
  1. SSH into the router:
ssh root@192.168.8.1 # or whatever your router's IP is
  1. Make the binary executable:
chmod +x tailscale.upx
  1. Verify that the binary works (keep in mind that it’s UPX-compressed, so it will take a few seconds to decompress):
./tailscale.upx -version
  1. Create links:
ln -s tailscale.upx tailscale
ln -s tailscale.upx tailscaled
  1. Create init script:
cat << EOF > /etc/init.d/tailscale
#!/bin/sh /etc/rc.common

# Copyright 2020 Google LLC.
# SPDX-License-Identifier: Apache-2.0

USE_PROCD=1
START=99
STOP=1

start_service() {
  procd_open_instance
  procd_set_param command /root/tailscaled

  # Set the port to listen on for incoming VPN packets.
  # Remote nodes will automatically be informed about the new port number,
  # but you might want to configure this in order to set external firewall
  # settings.
  procd_append_param command --port 41641

  # OpenWRT /var is a symlink to /tmp, so write persistent state elsewhere.
  procd_append_param command --state /etc/config/tailscaled.state
  
  # Persist files for TLS cert & Taildrop files
  procd_append_param command --statedir /etc/tailscale/

  procd_set_param respawn
  procd_set_param stdout 1
  procd_set_param stderr 1

  procd_close_instance
}

stop_service() {
  /root/tailscaled --cleanup
}
EOF
  1. Make the init script executable:
chmod +x /etc/init.d/tailscale
  1. Enable the init script:
/etc/init.d/tailscale enable
  1. Verify that the service is enabled:
ls /etc/rc.d/S*tailscale*
  1. Start the service:
/etc/init.d/tailscale start
  1. Verify that the service is running:
ps | grep tailscaled
  1. Hope for the best and try to up tailscale:
/root/tailscale up --accept-dns=false

If you get a segmentation fault, you might want to try skipping the UPX compression step altogether, but mind that the binary will be 30MB instead of 5.4MB. Mind the binary name being tailscale.combined instead of tailscale.upx in the steps.

Configuration

Refer to the OpenWRT wiki

@yuxin.zou Hopefully this is useful for official support for those devices, like a nice GUI :crossed_fingers:

4 Likes

Very nice. Does the GL device as an exit node work w/ this version of the daemon?

I would assume so, however I wasn’t able to get it working. I got static routes though. It advertises it, but connecting to it doesn’t give me internet. Probably my firewall or interface settings:

My tailscale configuration is:

tailscale up --accept-dns=false --advertise-routes=10.13.37.0/24 --advertise-exit-node

Could also be ACLs on Tailscale, but I don’t think so

Oh; good to know. That seems to be the number one question/issue w/ Tailscale I’ve seen in the threads.

Lanrat also had issues with exit nodes on openwrt in general, may just be a matter of configuration

1 Like

Am having an issue it just not routing any traffic through my exit node. I have it installed and its online and everything and nothing seems wrong but no traffic is being routed through. Was told on reddit it was likely a firewall issue but I am kinda lost and don’t know where to go from here.

Ooooo can you compile a version for arm-cortex-a7 and openwrt 21.02??

did you or anyone elase find solution for exit-node on gl.inet routers?

Try giving this a go: