Port Configuration for Factorio
Proper port configuration is essential for players to connect to your Factorio server. This guide covers the network requirements and how to open your server to the world.
Default Port
Factorio uses UDP 34197 by default. Unlike many other games, Factorio does not use TCP for game traffic.
Protocol
Ensure you select UDP when creating rules. Opening TCP 34197 will not allow players to join.
Scalability
If running multiple servers on one IP, increment the port for each instance (e.g., 34198, 34199).
Changing the Server Port
You can change the port in your server-settings.json file:
{
"port": 34197
}
Remember to update your firewall and router rules if you change this value.
Firewall Configuration
Linux (UFW)
For most Linux distributions like Ubuntu or Debian:
sudo ufw allow 34197/udp
sudo ufw reload
Linux (firewalld)
For CentOS or RHEL-based systems:
sudo firewall-cmd --permanent --add-port=34197/udp
sudo firewall-cmd --reload
Windows Firewall
- Search for "Windows Defender Firewall with Advanced Security".
- Select Inbound Rules -> New Rule.
- Select Port -> UDP -> Specific local ports: 34197.
- Select Allow the connection and ensure all profiles (Domain, Private, Public) are checked.
Router Port Forwarding
If hosting from home, you must forward the port from your router to your server's local IP:
- Access your router's admin panel (usually
192.168.1.1). - Find the Port Forwarding or NAT section.
- Map External Port
34197to Internal Port34197. - Set Protocol to UDP.
- Enter your server's internal/static IP address.
Troubleshooting
- Couldn't establish network communication: Usually means the UDP port is blocked by a firewall or not forwarded.
- Port already in use: Another process (or a previous instance of Factorio) is using 34197. Check for zombie processes.
- ISP Restrictions: Some ISPs block common game ports. If 34197 fails, try a high-numbered port like
54197.
Security Tip: Only open the specific UDP ports required for your game. Avoid using "DMZ" mode on your router as it exposes your entire machine to the internet.
Bridge the connection. View plans.