No description
Find a file
2024-12-08 17:15:39 +05:30
image.png Upload files to "image.png" 2024-12-07 15:35:33 +05:30
README.md Update README.md 2024-12-07 23:44:07 +05:30
unraid-config.sh Update unraid-config.sh 2024-12-08 17:15:39 +05:30
vps-config.sh Add vps-config.sh 2024-12-07 15:33:02 +05:30

image.png

 _____     _ _ ____            _        ____  _             _    
|_   _|_ _(_) / ___|  ___ __ _| | ___  / ___|| |_ __ _  ___| | __
  | |/ _` | | \___ \ / __/ _` | |/ _ \ \___ \| __/ _` |/ __| |/ /
  | | (_| | | |___) | (_| (_| | |  __/  ___) | || (_| | (__|   < 
  |_|\__,_|_|_|____/ \___\__,_|_|\___| |____/ \__\__,_|\___|_|\_\

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

  1. First, install Tailscale if you haven't already:

    • On Unraid: Install from Community Applications
    • On VPS: Follow installation guide at Tailscale's website
  2. Log into Tailscale on both machines:

    tailscale up
    
  3. 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

  1. SSH into your Unraid server or use the terminal from the web interface.

  2. Create a new directory for our scripts:

    mkdir -p /boot/custom/scripts
    cd /boot/custom/scripts
    
  3. Create the configuration script:

    nano unraid-config.sh
    
  4. Copy the Unraid script from above into this file.

Step 2: Configure the Script

  1. 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)]
    
  2. Make the script executable:

    chmod +x unraid-config.sh
    

Step 3: Run the Configuration

  1. Execute the script:

    ./unraid-config.sh
    
  2. Watch for any error messages in green or red text.

Step 4: Make Configuration Persistent

  1. Create a startup script:

    nano /boot/config/go
    
  2. Add this line:

    /boot/custom/scripts/unraid-config.sh
    
  3. Make it executable:

    chmod +x /boot/config/go
    

Part 3: VPS Configuration

Step 1: Initial VPS Setup

  1. SSH into your VPS:

    ssh username@your.vps.ip
    
  2. Create a directory for the script:

    mkdir ~/scripts
    cd ~/scripts
    

Step 2: Create the Configuration Script

  1. Create the script file:

    nano vps-config.sh
    
  2. Copy the VPS script from above into this file.

Step 3: Configure the Script

  1. Modify these variables:
    UNRAID_TAILSCALE_IP="your.unraid.tailscale.ip"
    WAN_INTERFACE="eth0"  # Change if your interface is different
    
    For these variables:

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
  1. Make the script executable:
    chmod +x vps-config.sh
    

Step 4: Run the Configuration

  1. Execute the script:

    sudo ./vps-config.sh
    
  2. Check for any error messages.

Part 4: Verification and Testing

Step 1: Check Connectivity

  1. From your Unraid server, ping the VPS through Tailscale:

    ping your.vps.tailscale.ip
    
  2. From the VPS, ping your Unraid server:

    ping your.unraid.tailscale.ip
    

Step 2: Test Game Server Ports

  1. Check if the ports are open:

    # On VPS
    sudo netstat -tulpn | grep LISTEN
    
  2. Test UDP ports (8766, 8767, 16261, 19132):

    # From another machine
    nc -uvz your.vps.ip 8766
    
  3. 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

  1. Monitor system logs:

    journalctl -f
    
  2. Check iptables rules periodically:

    sudo iptables-save > rules-backup.txt
    
  3. Keep Tailscale updated on both machines.

Security Considerations

  1. Keep SSH ports secured and use key-based authentication
  2. Regularly update both Unraid and VPS systems
  3. Monitor traffic patterns for unusual activity
  4. Keep backups of your configuration files
  5. 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.