Connecting a Local Server to Mesh VPN: Tailscale Exit Node Setup on Alpine Linux
Complete guide to installing Tailscale on Alpine Linux, advertising an exit node, and routing your home or office traffic through a remote VPS securely.
Tailscale builds a WireGuard-based mesh VPN on top of your existing network — no port forwarding, no manual key exchange. One of its most powerful features is the exit node: route all internet traffic from your devices through a remote server, useful for secure browsing on public Wi-Fi or accessing geo-restricted resources.
This guide sets up Tailscale on Alpine Linux 3.22 (common for lightweight VPS and homelab nodes) and configures the machine as an exit node. Example VPS hostname: vpn-exit.example.com at IP 203.0.113.20.
Prerequisites
A Tailscale account (free tier supports up to 100 devices)
Your laptop connects to Tailscale. When the exit node is enabled, traffic destined for the public internet is NAT’d through the Alpine server’s public IP.
Note the Tailscale IP (100.64.0.5 in this example) — you’ll use it for testing.
Step 3: Configure as Exit Node
Advertise this machine as an exit node:
advertise-exit-node.sh
tailscaleup--advertise-exit-node
Approve the exit node in admin console
Go to Tailscale Admin Console, find vpn-exit-alpine, click the ⋯ menu → Edit route settings → enable Use as exit node.
Without admin approval, clients cannot route traffic through this node.
Step 4: Configure NAT (iptables)
Tailscale handles WireGuard tunnels, but the kernel still needs NAT rules so exit traffic is masqueraded on the public interface.
Detect your public network interface:
Terminal window
iproute|grepdefault
# Example: default via 172.31.1.1 dev eth0
Create an OpenRC init script for persistent NAT rules. Replace eth0 with your actual interface:
Alpine doesn’t ship ufw, but you can use iptables directly. Allow SSH and Tailscale; block everything else inbound:
alpine-firewall.sh
apkaddiptables
cat>/etc/local.d/firewall.start<<'EOF'
#!/bin/sh
# Allow established connections
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
# Allow loopback
iptables -A INPUT -i lo -j ACCEPT
# Allow SSH
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
# Allow Tailscale (WireGuard UDP)
iptables -A INPUT -i tailscale0 -j ACCEPT
iptables -A INPUT -p udp --dport 41641 -j ACCEPT
# Drop everything else inbound
iptables -A INPUT -j DROP
EOF
chmod+x/etc/local.d/firewall.start
/etc/local.d/firewall.start
Tailscale and port 41641
Tailscale uses UDP port 41641 for direct peer connections. In most cases it works through NAT without manual port forwarding, but allowing it inbound helps with direct paths.
Do not expose unnecessary ports — Tailscale needs no inbound port forwarding
Conclusion
You now have:
An Alpine Linux node in your Tailscale mesh at vpn-exit-alpine (100.64.0.5)
A working exit node routing internet traffic through 203.0.113.20
Optional subnet routing to reach your home LAN remotely
Persistent NAT and firewall rules surviving reboots
Combine with Vaultwarden
Run both services on the same 1GB VPS: Vaultwarden on vault.example.com for passwords, Tailscale exit node for secure browsing. They use different ports and coexist comfortably under ~200 MB RAM combined.