Skip to content

Instantly share code, notes, and snippets.

@kathoef
Created November 15, 2024 14:52
Show Gist options
  • Save kathoef/06e3163a4425ed40da204dfe8e7f99df to your computer and use it in GitHub Desktop.
Save kathoef/06e3163a4425ed40da204dfe8e7f99df to your computer and use it in GitHub Desktop.
Tailscale on low performance devices

File transfers over tailnet for low performance devices

Setting: A Raspberry Pi 1B+ (Rev 1.2) is operated as restic backup server over a tailnet connection. The device is configured as nearly read-only to reduce wear on the SD card, i.e. /tmp, /var/tmp and /var/tmp are mounted as tmpfs and swap is deactivated. File transfers of a few megabytes have always succeeded.

Problem: For file transfers with several gigabytes, the memory usage of the tailscaled process (on the server side) slowly increases; eventually the tailnet connection freezes and the file transfer terminates with IO errors on the restic client side. The server side Raspberry remains inaccessible even after the restic backup task has stopped.

A quick solution leverages Go environment variables on the server side,

$ cat /etc/os-release | grep PRETTY_NAME
PRETTY_NAME="Raspbian GNU/Linux 12 (bookworm)"
$ uname -a
Linux 3d6532b 6.6.51+rpt-rpi-v6 #1 Raspbian 1:6.6.51-1+rpt3 (2024-10-08) armv6l GNU/Linux
$ tailscale version
1.76.6
  tailscale commit: 1edcf9d466ceafedd2816db1a24d5ba4b0b18a5b
  other commit: d0a6cd8b27eb46f6dec31425499159f7949be7f9
  go version: go1.23.1
$ cat /etc/default/tailscaled 
...
GOMAXPROCS=1
GOMEMLIMIT=128MiB

which increases aggressiveness of the Go garbage collector and prevents the above issue. See especially also: https://docs.syncthing.net/users/tuning.html#tuning-for-low-resources

Useful network debugging commands,

$ sudo tcptrack -i tailscale0 -p

$ iperf3 -p 5000 -f m -s # retrieve (server: Raspberry Pi 1B+)
$ iperf3 -p 5000 -f m -c <tailnet "server" IP> -t 300 -P 1 # push (client: Raspberry Pi 3B+)

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment