5.6 KiB
_____ _ _ ____ _ ____ _ _
|_ _|_ _(_) / ___| ___ __ _| | ___ / ___|| |_ __ _ ___| | __
| |/ _` | | \___ \ / __/ _` | |/ _ \ \___ \| __/ _` |/ __| |/ /
| | (_| | | |___) | (_| (_| | | __/ ___) | || (_| | (__| <
|_|\__,_|_|_|____/ \___\__,_|_|\___| |____/ \__\__,_|\___|_|\_\
Prerequisites
Before starting, ensure you have:
- An Unraid server
- A VPS
- Tailscale installed on both Unraid and VPS
- Root/sudo access on both machines
- Basic command line knowledge
Part 1: Initial Setup
On Both Machines
-
First, install Tailscale if you haven't already:
- On Unraid: Install from Community Applications
- On VPS: Follow installation guide at Tailscale's website
-
Log into Tailscale on both machines:
tailscale up
-
Note down the Tailscale IPs:
tailscale ip -4
Save both IPs - you'll need them later.
Part 2: Unraid Configuration
Step 1: Create the Configuration Script
-
SSH into your Unraid server or use the terminal from the web interface.
-
Create a new directory for our scripts:
mkdir -p /boot/custom/scripts cd /boot/custom/scripts
-
Create the configuration script:
nano unraid-config.sh
-
Copy the Unraid script from above into this file.
Step 2: Configure the Script
-
Modify these variables in the script:
VPS_IP="your.vps.ip.address" Use the public IP address of your VPS (not the Tailscale IP) GAME_SUBNET="172.16.0.0/24" # Adjust if your subnet is different [Use the subnet where your game server containers are running in Unraid (typically your Docker network subnet, which you can find in Unraid's Docker settings)]
-
Make the script executable:
chmod +x unraid-config.sh
Step 3: Run the Configuration
-
Execute the script:
./unraid-config.sh
-
Watch for any error messages in green or red text.
Step 4: Make Configuration Persistent
-
Create a startup script:
nano /boot/config/go
-
Add this line:
/boot/custom/scripts/unraid-config.sh
-
Make it executable:
chmod +x /boot/config/go
Part 3: VPS Configuration
Step 1: Initial VPS Setup
-
SSH into your VPS:
ssh username@your.vps.ip
-
Create a directory for the script:
mkdir ~/scripts cd ~/scripts
Step 2: Create the Configuration Script
-
Create the script file:
nano vps-config.sh
-
Copy the VPS script from above into this file.
Step 3: Configure the Script
- Modify these variables:
For these variables:UNRAID_TAILSCALE_IP="your.unraid.tailscale.ip" WAN_INTERFACE="eth0" # Change if your interface is different
UNRAID_TAILSCALE_IP
= Use your Unraid's Tailscale IP (get it by running tailscale ip -4
on Unraid)
WAN_INTERFACE
= This is your VPS's main network interface, usually eth0
(verify with ip a
on VPS)
Example:
UNRAID_TAILSCALE_IP="100.x.y.z" # Your Unraid's Tailscale IP
WAN_INTERFACE="eth0" # Usually eth0 on most VPS providers
To quickly get your Unraid's Tailscale IP, SSH into Unraid and run:
tailscale ip -4
- Make the script executable:
chmod +x vps-config.sh
Step 4: Run the Configuration
-
Execute the script:
sudo ./vps-config.sh
-
Check for any error messages.
Part 4: Verification and Testing
Step 1: Check Connectivity
-
From your Unraid server, ping the VPS through Tailscale:
ping your.vps.tailscale.ip
-
From the VPS, ping your Unraid server:
ping your.unraid.tailscale.ip
Step 2: Test Game Server Ports
-
Check if the ports are open:
# On VPS sudo netstat -tulpn | grep LISTEN
-
Test UDP ports (8766, 8767, 16261, 19132):
# From another machine nc -uvz your.vps.ip 8766
-
Test TCP port ranges (16262, 27015-27050, 25500-25600):
nc -vz your.vps.ip 27015
Common Issues and Troubleshooting
Issue 1: Ports Not Forwarding
- Check iptables rules:
sudo iptables -L -n -v sudo iptables -t nat -L -n -v
- Verify IP forwarding is enabled:
cat /proc/sys/net/ipv4/ip_forward
Issue 2: Tailscale Connectivity
- Check Tailscale status:
tailscale status
- Verify routes:
ip route show
Issue 3: Game Server Can't Connect
- Check server logs
- Verify firewall rules
- Ensure correct IP forwarding
- Check Tailscale ACLs
Maintenance
Regular Checks
-
Monitor system logs:
journalctl -f
-
Check iptables rules periodically:
sudo iptables-save > rules-backup.txt
-
Keep Tailscale updated on both machines.
Security Considerations
- Keep SSH ports secured and use key-based authentication
- Regularly update both Unraid and VPS systems
- Monitor traffic patterns for unusual activity
- Keep backups of your configuration files
- Use strong passwords for all services
Conclusion
Your game server routing setup should now be complete and working. This configuration provides:
- Secure routing through Tailscale
- Proper traffic separation
- Optimized game server connectivity
- Persistent configuration across reboots
Remember to test thoroughly before deploying game servers, and always keep backups of your configurations.