This guide connects a Factorio dedicated server to X4B DDoS Protection. The game runs on your backend; players use the X4B filtered IP. The example uses a Linux x86-64 headless server and GRE, with public listing disabled until its network path has been checked.
Step 1: Prepare the headless server
Obtain a suitable stable headless package from the official Factorio downloads. Follow the project's multiplayer setup instructions. Use a maintained host and an unprivileged service account. Match the server and clients' versions, enabled content and mods, including any console-specific limitations.
Prepare the intended save. Copy the package's data/server-settings.example.json into your own settings file and merge these choices into that copy:
{
"name": "X4B Factorio",
"visibility": { "public": false, "lan": false },
"require_user_verification": true,
"game_password": "REPLACE_WITH_A_UNIQUE_PASSWORD"
}
Replace the example password. Preserve the remaining settings appropriate to your game. See the developer's settings example for visibility and authentication options. Keep any account token private; listing visibility and access control are separate settings.
From the installation directory, start the existing save and copied settings using the documented command-line options. For example:
./bin/x64/factorio --start-server saves/x4b.zip --server-settings config/server-settings.json --port 34197
Replace both paths with your actual save and settings file. Other architectures can use a different executable path. Test the backend with a trusted external player, restricting temporary direct access to that tester. On Linux, sudo ss -lunp helps identify the UDP listener.
Step 2: Select the service and create GRE
Use an active service or select one on the DDoS protection page. Choose a filtering location with a suitable route to the backend and players, plus a clean-bandwidth allowance for normal gameplay and map transfers.
Review Port types and the tunnel requirements. GRE preserves client source addresses and supports controlled outgoing routing; the host and provider must support it.
- Open Services, find your service and choose Action > Tunnels.
- Click Add Tunnel, select GRE, and enter the backend's public IP in Backend address.
- Save, reload and verify the tunnel. Retain its displayed key and MTU for backend installation.
Step 3: Forward the game port and install the tunnel
Open the service's Action > Ports page. Under Single Port, choose Add port manually if the empty state is shown; otherwise choose Add Port. Add:
| Port start | Protocol | Backend port | Purpose |
|---|---|---|---|
| 34197 | UDP | 34197 | Gameplay and map transfer |
Choose Encapsulated (NAT) under Backend method, select the saved tunnel and click Save. Reload to verify the entry. Use ordinary UDP; Factorio is not an A2S query service. See Layer 7 protection modes.
Return to Tunnels, choose Action > Setup Tunnel, then Linux / BSD > Download Tunnel Script. A saved port must reference the tunnel before setup is usable. Review and install the script using the tunnel instructions, preserving its return-routing rules.
Use Factorio's --bind option with the assigned backend tunnel address and port when restricting the listener to that interface. This is a local address, not the filtered IP. Start the tunnel before Factorio at boot. On Anycast services, follow the Unified Tunnel requirements for outgoing connections.
Step 4: Secure and verify direct joining
Keep host and provider firewalls enabled. Allow IP protocol 47 between the backend and X4B tunnel endpoints, and allow the game's UDP traffic on the tunnel interface. GRE is not TCP/UDP port 47. Inner packets can retain player addresses, so an allowlist containing only X4B communication addresses will not match them. Preserve private management access and keep recovery-console access while changing rules.
Wait for Dashboard deployment to finish. In Factorio's Connect to address flow, use the filtered IP and game port, for example 203.0.113.20:34197. Replace this documentation address with your service's filtered IP.
Test map transfer, play and reconnects from an outside network. Confirm the X4B path with backend logs or packet captures, then remove temporary game access through the backend's public interface. Repeat after reboot. Monitor CPU, memory, simulation performance, map-transfer bandwidth and packet loss with a representative save.
Step 5: Check public listing separately
Keep public visibility disabled until you have checked outgoing source routing and source-port preservation. The project's matching-server explanation describes why the observed endpoint matters. Verify that discovery sees the filtered address, not the backend origin. Follow the tunnel guide for outgoing traffic; keep required authentication and discovery connectivity available.
After enabling public visibility with the required account settings, test joining through the public browser and any Steam-invite flow you intend to offer. Compare their packet paths with direct joining. If the listed endpoint bypasses X4B, keep listing disabled while correcting routing with support, rather than opening direct backend access.
If using Reverse Proxy
For a separately tested RP setup, configure the same UDP port with Backend method > Reverse Proxy, a reachable Backend address and matching backend port. Skip tunnel installation. Allow the game port from the current Backend Communication IP Addresses under Services > Action > IP Addresses; see firewall exceptions.
RP rewrites client source addresses and does not route server-originated discovery through X4B. Test direct joins and listing independently. Account-based moderation remains distinct from backend IP-based policies, which will see the proxy's address. Keep any optional RCON service private and choose its port and bind address explicitly.
Backups, updates and troubleshooting
Use limited administrator grants and an account allowlist when appropriate. Protect account tokens, passwords and settings files. For maintenance, save explicitly and wait for completion before a graceful stop. The console reference distinguishes in-game /server-save from the server console's /save and /quit commands.
Back up saves, mods and mod settings, server configuration and moderation lists off-host while stopped or using an application-consistent method. Test an isolated restore. Schedule updates with players, preserve the previous working package and data, and check version/content compatibility before restarting. Retest every advertised connection path.
| Symptom | Checks |
|---|---|
| Direct join works but browser join bypasses X4B | Detected public endpoint, outgoing source routing and NAT port preservation |
| Map transfer stalls | UDP path, packet loss, MTU and normal bandwidth usage |
| A client cannot join | Exact game/mod versions, enabled content and authentication/access settings |
| Server fails after reboot | Save/settings paths, service account and tunnel startup order |
For support, include the service, game version, filtered IP, port, backend method, joining method and test time with timezone. Remove credentials and private game data from logs.
