Tailscale in Alpine Linux
I have been running Tailscale in an Ubuntu VM, and it has been stable and working as expected for months. Lately however I have been replacing homelab services to Alpine Linux based Docker containers to save up on some precious resources in my resource poor homelab. This made me wonder, if I can change the VM where Tailscale is running to Alpine? Turns out I can, and in the process save about 500 MB of memory (Proxmox has been reporting the memory usage to be between approximately 550 - 750 MB for the Ubuntu VM) that I can use for other services. Win-win!
These steps are right after a clean Alpine Linux install. Installation steps can be found here.
Preparation
Update packages and install nano for the convenience.
1
2
doas apk update
doas apk add nano
Enable community repos
1
doas setup-apkrepos -c -1
Tailscale setup
Install Tailscale
1
doas apk add tailscale
Enable Tailscale service after boot
1
doas rc-update add tailscale default
Start Tailscale service
1
doas rc-service tailscale start
Check that Tailscale service is running
1
doas rc-service tailscale status
Enable IP forwarding
Enable IP forwarding to be able to use the VM as an exit node and access other VMs and services in the same network.
Edit /etc/sysctl.conf
file
1
doas nano /etc/sysctl.conf
Add these lines to the file
1
2
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1
Load these new settings
1
doas sysctl -p /etc/sysctl.conf
Verify that the new settings were loaded
1
sysctl net.ipv4.ip_forward net.ipv6.conf.all.forwarding
Run Tailscale
It is time to fire up Tailscale…
1
doas tailscale up --advertise-routes=192.168.1.0/24 --advertise-exit-node
Login and approve the exit-node and routes in Tailscale admin panel.
Reboot. If everything is configured correctly, Tailscale service should be running and can be used as an exit-node as well as subnet router for advertised routes.
To check that Tailscale service is running after the boot, run
1
rc-service tailscale status
Also Tailscale status can be checked with
1
doas tailscale status
Voilà!
