Tailscale Tunneling
Tailscale is the recommended tunneling method for most users due to its simplicity and reliability. It creates a private encrypted network between servers using WireGuard under the hood, without complex configuration.When to Use Tailscale
Use Tailscale if:- You want fast and simple setup
- You are using private backend VPS or LXC containers
- You need NAT traversal
- You do not want to manage keys manually
Allow TUN Device (LXC Only)
If Tailscale is used inside an LXC container, you must allow the TUN device. Edit the LXC config: Path:/etc/pve/lxc/<LXC_ID>.conf
Add the line at last:
Restart the container after saving.
Enable IP Forwarding (Proxy VPS)
On the public proxy VPS: Edit sysctl config:nano /etc/sysctl.conf
Ensure this line exists & uncommented: net.ipv4.ip_forward = 1
Apply to check IP Forwarding is Active: sysctl -p
IPTables Forwarding Rules
Forward traffic from the public VPS to the private Tailscale IP. Create a File calledip.sh using: nano ip.sh
and Add This:
Replace
<TAILSCALE_IP> with the backend server’s 100.x.x.x address.bash ip.sh
To make the forwarding active.
DNS Fix for LXC
Inside the LXC container:touch /etc/.pve-ignore.resolv.conf
Set DNS: echo -e "nameserver 8.8.8.8\nnameserver 1.1.1.1" > /etc/resolv.conf
Automated Tailscale Setup Script
Save astailscale-tunnel.sh:
Security Notes
- Restrict forwarded ports where possible
- Do not expose unused services
- Monitor tunnel traffic regularly
Use this Script at your own Risk.