Tailscale Subnet Routing
Tailscale Subnet Routing
Date: 2024-09-27
Type: How-To
Overview
Guide for setting up Tailscale subnet routing to access your entire home network remotely without installing Tailscale on every device.
Architecture
Internet
|
v
Tailscale Network (100.x.x.x)
|
v
Subnet Router (advertises 192.168.1.0/24)
|
v
Home LAN (192.168.1.0/24)
|
+-- Devices without Tailscale
Prerequisites
- Tailscale account
- Linux machine on your LAN (can be Raspberry Pi, VM, etc.)
- Admin access to Tailscale admin console
- Basic networking knowledge
Setup Steps
1. Install Tailscale on Subnet Router
# Ubuntu/Debian
curl -fsSL https://tailscale.com/install.sh | sh
# Start Tailscale
sudo tailscale up
2. Enable IP Forwarding
# Temporary (until reboot)
echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf
echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf
sudo sysctl -p /etc/sysctl.d/99-tailscale.conf
3. Advertise Subnet Routes
# Replace with your actual subnet
sudo tailscale up --advertise-routes=192.168.1.0/24 --accept-routes
4. Approve Routes in Admin Console
- Go to Tailscale Admin Console
- Find your subnet router machine
- Click the “…” menu
- Select “Edit route settings”
- Enable the advertised routes
5. Disable Key Expiry (Optional but Recommended)
# In admin console:
# Machine settings > Disable key expiry
Verification
From Another Tailscale Device
# Ping a device on your home network
ping 192.168.1.1
# Check routes
ip route | grep 192.168.1
# Test SSH to a home device
ssh user@192.168.1.10
Advanced Configuration
Multiple Subnets
# Advertise multiple subnets
sudo tailscale up --advertise-routes=192.168.1.0/24,10.0.0.0/24
Exit Node (Full Internet Traffic)
# Make this device an exit node
sudo tailscale up --advertise-routes=192.168.1.0/24 --advertise-exit-node
Firewall Rules
# If using UFW
sudo ufw allow in on tailscale0
sudo ufw allow 41641/udp # Tailscale port
# If using iptables
sudo iptables -A FORWARD -i tailscale0 -j ACCEPT
sudo iptables -A FORWARD -o tailscale0 -j ACCEPT
Troubleshooting
Can’t Access Subnet Devices
- Check IP forwarding:
sysctl net.ipv4.ip_forward # Should return: net.ipv4.ip_forward = 1 - Verify routes are approved:
- Check Tailscale admin console
- Ensure routes show as “Enabled”
- Check firewall:
sudo iptables -L -n -v # Look for FORWARD chain rules - Verify subnet router is online:
tailscale status
Slow Performance
- Check subnet router hardware (CPU/RAM)
- Verify network bandwidth
- Consider using a more powerful device as subnet router
Connection Drops
# Check Tailscale logs
sudo journalctl -u tailscale -f
# Restart Tailscale
sudo systemctl restart tailscale
Security Considerations
- Only advertise subnets you need access to
- Use Tailscale ACLs to restrict access
- Keep subnet router updated
- Monitor access logs regularly
ACL Example
{
"acls": [
{
"action": "accept",
"src": ["user@example.com"],
"dst": ["192.168.1.0/24:*"]
}
]
}
Performance Notes
- Typical latency: +10-30ms vs direct connection
- Throughput: Limited by subnet router hardware and internet connection
- Works great for SSH, RDP, web interfaces
- May not be ideal for large file transfers
Useful Commands
# Check Tailscale status
tailscale status
# View current routes
tailscale status --json | jq '.Peer[] | select(.PrimaryRoutes != null)'
# Ping Tailscale device
tailscale ping <hostname>
# Check which routes are being used
ip route get 192.168.1.1