headless server linux can't connect from outside

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
benaiu
Burner Inserter
Burner Inserter
Posts: 12
Joined: Wed Nov 02, 2016 11:47 pm
Contact:

headless server linux can't connect from outside

Post by benaiu »

hi guys .
I'm trying to make my server available to the world. I'm using manjaro linux
so I downloaded the factorio headless image,
changed user and group of the file to one that is not root (user factorio: group factorio),
put the server in /opt/factorio
copied my savegame from the normal game to the server folder,
I've changed the mods to full vanilla (no space age)
the server loads without problems from the console,
when i try to search it in the normal lobby it doesn't appear
the only way I have to enter the server is putting the ip 0.0.0.0 in "connect to address", so connecting to localhost
this is the output of the server that says that is hosting on the localhost. check 1.027 & 1.028

Code: Select all

   0.004 2025-05-17 13:55:17; Factorio 2.0.47 (build 82606, linux64, headless, space-age)
   0.014 Operating system: Linux (ManjaroLinux 25.0.2)
   0.015 Program arguments: "bin/x64/factorio" "--start-server" "saves/servernomods.zip"
   0.016 Config path: /opt/factorio/config/config.ini
   0.017 Read data path: /opt/factorio/data
   0.018 Write data path: /opt/factorio [241715/446583MB]
   0.019 Binaries path: /opt/factorio/bin
   0.027 System info: [CPU: Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz, 12 cores, RAM: 19831 MB]
   0.028 Environment: DISPLAY=:0 WAYLAND_DISPLAY=<unset> DESKTOP_SESSION=xfce XDG_SESSION_DESKTOP=xfce XDG_CURRENT_DESKTOP=XFCE SDL_VIDEODRIVER=<unset> __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset> __GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
   0.029 Running in headless mode
   0.031 Audio is disabled
   0.040 Info ModManager.cpp:444: FeatureFlag expansion-shaders = false
   0.041 Info ModManager.cpp:444: FeatureFlag freezing = false
   0.042 Info ModManager.cpp:444: FeatureFlag quality = false
   0.043 Info ModManager.cpp:444: FeatureFlag rail-bridges = false
   0.044 Info ModManager.cpp:444: FeatureFlag segmented-units = false
   0.045 Info ModManager.cpp:444: FeatureFlag space-travel = false
   0.047 Info ModManager.cpp:444: FeatureFlag spoiling = false
   0.050 Loading mod core 0.0.0 (data.lua)
   0.061 Loading mod base 2.0.47 (data.lua)
   0.172 Loading mod base 2.0.47 (data-updates.lua)
   0.211 Checksum for core: 3673191213
   0.212 Checksum of base: 700993118
   0.346 Prototype list checksum: 3262847480
   0.373 Info PlayerData.cpp:64: Local player-data.json available, timestamp 1747500267
   0.374 Info PlayerData.cpp:71: Cloud player-data.json unavailable
   0.376 Factorio initialised
   0.378 Info ServerSynchronizer.cpp:22: nextHeartbeatSequenceNumber(0) initialized Synchronizer nextTickClosureTick(0).
   0.379 Info ServerMultiplayerManager.cpp:808: updateTick(18446744073709551615) changing state from(Ready) to(PreparedToHostGame)
   0.380 Info ServerMultiplayerManager.cpp:808: updateTick(18446744073709551615) changing state from(PreparedToHostGame) to(CreatingGame)
   0.382 Loading map /opt/factorio/saves/servernomods.zip: 10609796 bytes.
   0.590 Loading level.dat: 29561897 bytes.
   0.595 Info Scenario.cpp:153: Map version 2.0.47-0
   1.009 Blueprint storage "blueprint-storage-2.dat" was not found, trying to load previous version storage "blueprint-storage.dat"
   1.013 Loading script.dat: 1267 bytes.
   1.016 Checksum for script __level__/control.lua: 187768216
   1.027 Info UDPSocket.cpp:32: Opening socket at (IP ADDR:({0.0.0.0:34197}))
   1.028 Hosting game at IP ADDR:({0.0.0.0:34197})
   1.030 Info HttpSharedState.cpp:55: Downloading https://auth.factorio.com/generate-server-padlock-2?api_version=6
   1.946 Info AuthServerConnector.cpp:110: Obtained serverPadlock for serverHash (FVvXfq7tYskzprYEW4XfaA6iDEsZH1Gx) from the auth server.
   1.950 Info ServerMultiplayerManager.cpp:808: updateTick(14137524) changing state from(CreatingGame) to(InGame)
^C   7.125 Received SIGINT, shutting down
   7.129 Quitting: signal.
   7.130 Info MainLoop.cpp:437: Saving map as /opt/factorio/saves/servernomods.zip
   7.255 Info MainLoop.cpp:448: Saving progress: 0.013716%
   7.343 Info MainLoop.cpp:448: Saving progress: 100.000000%
   7.686 Info ServerMultiplayerManager.cpp:119: Disconnecting multiplayer connection.
   7.687 Info ServerMultiplayerManager.cpp:808: updateTick(14137524) changing state from(InGame) to(DisconnectingScheduled)
   7.721 Info ServerMultiplayerManager.cpp:808: updateTick(14137524) changing state from(DisconnectingScheduled) to(Disconnecting)
   7.756 Info ServerMultiplayerManager.cpp:808: updateTick(14137524) changing state from(Disconnecting) to(Disconnected)
   7.758 Info ServerMultiplayerManager.cpp:146: Quitting multiplayer connection.
   7.759 Info ServerMultiplayerManager.cpp:808: updateTick(14137524) changing state from(Disconnected) to(Closed)
   7.760 Info ServerMultiplayerManager.cpp:166: Deleting active scenario (global = true).
   8.441 Info UDPSocket.cpp:232: Closing socket
   8.443 Info UDPSocket.cpp:262: Socket closed
   8.516 Goodbye
I've tried activating and deactivating UFW (uncomplicated firewall) and did'nt change anything

below is a capture of the port forwarding rule in the router/modem:
port forward.png
port forward.png (14.07 KiB) Viewed 629 times
next is a capture of the firewall (gufw) rules:
firewall-rules.png
firewall-rules.png (40.05 KiB) Viewed 629 times
the game doesn't appear in LAN too.




I'm gonna try looking at the files in the server folder next (didn't find any useful thing in there, just a lot of options)
any idea is welcome, thanks for reading.
Hablo español
and a little english
Tertius
Smart Inserter
Smart Inserter
Posts: 1285
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: headless server linux can't connect from outside

Post by Tertius »

benaiu wrote: Sat May 17, 2025 5:19 pm the only way I have to enter the server is putting the ip 0.0.0.0 in "connect to address", so connecting to localhost
this is the output of the server that says that is hosting on the localhost. check 1.027 & 1.028
The ip address of localhost is 127.0.0.1. The meaning of the address 0.0.0.0 in the log is that the game will listen on every address, not just some specific address. It's a wildcard, not an ip address you can connect. So try to connect to 127.0.0.1 if you try to connect to a locally hosted game. Or use the internal LAN address of your machine, which is probably 192.168.0.20 according to your forwarding setup. But this could change, depending on what your dhcp server will give you.
User avatar
pioruns
Fast Inserter
Fast Inserter
Posts: 155
Joined: Tue Nov 05, 2024 3:38 pm
Contact:

Re: headless server linux can't connect from outside

Post by pioruns »

Firstly, try to connect from another machine in your LAN. From client machine, type your LAN IP to connect, not 0.0.0.0 or 127.0.0.1. That way, you will know if factorio server is listening properly, and if Manjaro firewall etc. is not messing with it.
Once verified, you can attempt to open a port in your ISP router, to allow connections from outside.
benaiu
Burner Inserter
Burner Inserter
Posts: 12
Joined: Wed Nov 02, 2016 11:47 pm
Contact:

Re: headless server linux can't connect from outside

Post by benaiu »

The ip address of localhost is 127.0.0.1. The meaning of the address 0.0.0.0 in the log is that the game will listen on every address, not just some specific address. It's a wildcard, not an ip address you can connect. So try to connect to 127.0.0.1 if you try to connect to a locally hosted game. Or use the internal LAN address of your machine, which is probably 192.168.0.20 according to your forwarding setup
ok, so yeah, it can connect using my LAN ip (192.168.0.20), but it doesn't appear in "browse LAN games" inside the game.
But this could change, depending on what your dhcp server will give you.
I used "IP reservation" from my modem/router on my server/playing machine so it shouldn't have to change
Hablo español
and a little english
benaiu
Burner Inserter
Burner Inserter
Posts: 12
Joined: Wed Nov 02, 2016 11:47 pm
Contact:

Re: headless server linux can't connect from outside

Post by benaiu »

pioruns wrote: Sat May 17, 2025 8:05 pm Firstly, try to connect from another machine in your LAN. From client machine, type your LAN IP to connect, not 0.0.0.0 or 127.0.0.1. That way, you will know if factorio server is listening properly, and if Manjaro firewall etc. is not messing with it.
Once verified, you can attempt to open a port in your ISP router, to allow connections from outside.
I can't do that, I only have one machine.
I tried connecting with the game client to 192.168.0.20, and it worked, it connects. but still, my server doesn't appear in "browse LAN games"
Hablo español
and a little english
User avatar
pioruns
Fast Inserter
Fast Inserter
Posts: 155
Joined: Tue Nov 05, 2024 3:38 pm
Contact:

Re: headless server linux can't connect from outside

Post by pioruns »

benaiu wrote: Sat May 17, 2025 8:19 pm
pioruns wrote: Sat May 17, 2025 8:05 pm Firstly, try to connect from another machine in your LAN. From client machine, type your LAN IP to connect, not 0.0.0.0 or 127.0.0.1. That way, you will know if factorio server is listening properly, and if Manjaro firewall etc. is not messing with it.
Once verified, you can attempt to open a port in your ISP router, to allow connections from outside.
I can't do that, I only have one machine.
I tried connecting with the game client to 192.168.0.20, and it worked, it connects. but still, my server doesn't appear in "browse LAN games"
If you are unable to check from another LAN machine, then maybe try nmap 192.168.0.20:34197 from your phone or something? You need to verify connectivity between other computers and your server. Can't do that without external clients. It is external clients your server will be ultimately serving, so you need to check every step of the way.
benaiu
Burner Inserter
Burner Inserter
Posts: 12
Joined: Wed Nov 02, 2016 11:47 pm
Contact:

Re: headless server linux can't connect from outside

Post by benaiu »

pioruns wrote: Sat May 17, 2025 9:14 pm
benaiu wrote: Sat May 17, 2025 8:19 pm
pioruns wrote: Sat May 17, 2025 8:05 pm Firstly, try to connect from another machine in your LAN. From client machine, type your LAN IP to connect, not 0.0.0.0 or 127.0.0.1. That way, you will know if factorio server is listening properly, and if Manjaro firewall etc. is not messing with it.
Once verified, you can attempt to open a port in your ISP router, to allow connections from outside.
I can't do that, I only have one machine.
I tried connecting with the game client to 192.168.0.20, and it worked, it connects. but still, my server doesn't appear in "browse LAN games"
If you are unable to check from another LAN machine, then maybe try nmap 192.168.0.20:34197 from your phone or something? You need to verify connectivity between other computers and your server. Can't do that without external clients. It is external clients your server will be ultimately serving, so you need to check every step of the way.
well , tried in my phone

Code: Select all

nmap 192.168.0.20:34197
didn't work, so I tried

Code: Select all

nmap -p 34197 192.168.0.20
this one worked better:

Code: Select all

Host seems down. if it's really up, but blocking our ping probes try -Pn
so i tried:

Code: Select all

nmap -p 34197 192.168.0.20 -Pn
It says:

Code: Select all

host is up
34197/tcp filtered
but the problem is that is trying to ask for tcp not udp like this game
when I try to run the command for udp, it says that I need root credentials
this is the command for udp:

Code: Select all

nmap -sU -p 34197 192.168.0.20
Hablo español
and a little english
benaiu
Burner Inserter
Burner Inserter
Posts: 12
Joined: Wed Nov 02, 2016 11:47 pm
Contact:

Re: headless server linux can't connect from outside

Post by benaiu »

also: tried connecting using external ip address in game, it works, I don't know if it uses a shortcut to reach the server, --- is it secure to share my external IP in this forum?
Hablo español
and a little english
eugenekay
Filter Inserter
Filter Inserter
Posts: 507
Joined: Tue May 15, 2018 2:14 am
Contact:

Re: headless server linux can't connect from outside

Post by eugenekay »

benaiu wrote: Sat May 17, 2025 10:21 pm also: tried connecting using external ip address in game, it works, I don't know if it uses a shortcut to reach the server, --- is it secure to share my external IP in this forum?
The Security happens at your Firewall - ie, whether or not you are running an Open Service on a Public IP Address. If the door is open, then anybody can try to login to your Server..... Publishing the IP Address and Port of the server (either through the Multiplayer Listing Server, or directly in this Forum) is just Advertising that the door is open. It would be a good idea to Sandbox the Factorio process, either in a Virtual Machine, or by using a physically separate computer on an isolated Internal LAN.... if you're paranoid like me, anyway. You're unlikely to get hacked via Factorio - the Lua API is pretty well isolated from the Network code.

TL;DR "Safe Enough" :lol:
User avatar
pioruns
Fast Inserter
Fast Inserter
Posts: 155
Joined: Tue Nov 05, 2024 3:38 pm
Contact:

Re: headless server linux can't connect from outside

Post by pioruns »

benaiu wrote: Sat May 17, 2025 10:21 pm also: tried connecting using external ip address in game, it works, I don't know if it uses a shortcut to reach the server, --- is it secure to share my external IP in this forum?
Maybe share it with a couple of people, friends you are willing to play with? You can share it with me via PM, it will be just me, not the entire forum, and I am not a hacker :D But I will be happy to nmap your IP and try to connect my Factorio client to your server, and I will tell you my findings.
eugenekay wrote: Sun May 18, 2025 12:47 am The Security happens at your Firewall - ie, whether or not you are running an Open Service on a Public IP Address. If the door is open, then anybody can try to login to your Server..... Publishing the IP Address and Port of the server (either through the Multiplayer Listing Server, or directly in this Forum) is just Advertising that the door is open. It would be a good idea to Sandbox the Factorio process, either in a Virtual Machine, or by using a physically separate computer on an isolated Internal LAN.... if you're paranoid like me, anyway. You're unlikely to get hacked via Factorio - the Lua API is pretty well isolated from the Network code.

TL;DR "Safe Enough" :lol:
A VM could degrade performance on a gaming server. The next best thing for the security-paranoid (like you and me 😄) could be running the Factorio server under a separate user account dedicated solely to that task (in Linux, of course). Files are isolated between users, and processes under that account can't access your main user account—so there's nothing to steal.
benaiu
Burner Inserter
Burner Inserter
Posts: 12
Joined: Wed Nov 02, 2016 11:47 pm
Contact:

Re: headless server linux can't connect from outside

Post by benaiu »

pioruns wrote: Sun May 18, 2025 5:44 am
benaiu wrote: Sat May 17, 2025 10:21 pm also: tried connecting using external ip address in game, it works, I don't know if it uses a shortcut to reach the server, --- is it secure to share my external IP in this forum?
Maybe share it with a couple of people, friends you are willing to play with? You can share it with me via PM, it will be just me, not the entire forum, and I am not a hacker :D But I will be happy to nmap your IP and try to connect my Factorio client to your server, and I will tell you my findings.
eugenekay wrote: Sun May 18, 2025 12:47 am The Security happens at your Firewall - ie, whether or not you are running an Open Service on a Public IP Address. If the door is open, then anybody can try to login to your Server..... Publishing the IP Address and Port of the server (either through the Multiplayer Listing Server, or directly in this Forum) is just Advertising that the door is open. It would be a good idea to Sandbox the Factorio process, either in a Virtual Machine, or by using a physically separate computer on an isolated Internal LAN.... if you're paranoid like me, anyway. You're unlikely to get hacked via Factorio - the Lua API is pretty well isolated from the Network code.

TL;DR "Safe Enough" :lol:
A VM could degrade performance on a gaming server. The next best thing for the security-paranoid (like you and me 😄) could be running the Factorio server under a separate user account dedicated solely to that task (in Linux, of course). Files are isolated between users, and processes under that account can't access your main user account—so there's nothing to steal.
That's what I'm doing, I'm running the server on a different user, I've tried the other way (running in the main user) without success.(I mean it works but nothing changes, so it's better to use a different user just in case)
Today I've tried changing rules(port forwarding) in my modem, and connecting to my external IP, it works only if I use port 34197 in both fields (internal & external)
Hablo español
and a little english
Post Reply

Return to “Technical Help”