[0.16.51] Cannot connect to server via public IP

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.
Post Reply
__maja__
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Dec 26, 2018 4:03 pm
Contact:

[0.16.51] Cannot connect to server via public IP

Post by __maja__ »

I have successfully installed a (headless) factorio server in my home network. I can connect to it via "Play on LAN" (the server is found) and I can also use "Connect to server" by entering the private IP and port.
This works fine.

Now to the part that does not work: Connecting via a public IP address.
The server correctly announces it, and when clicking "Browse public games" my sever is found. When I connect to it, I'm prompted for the server password which I enter.
If I enter the wrong password, the dialog opens again.
If I enter the correct password, the "Downloading map" dialog shows up, and the first few kB of data are downloaded (at least the dialog shows "22,1kB"). Then it stops. At the same time, the "Server is not responding" dialog is displayed, slowly filling the progress bar. Then the whole process aborts with "Communication to server failed".
The same happens when connecting via "Connect to server" and entering my public IP address.

This tells me a few things:
- I can connect to, and play on, my server when staying behind my router. The server can't be the problem.
- The server correctly announces itself and can be found on the public-server-list.
- The game-password checks work correctly, so the communication seems to be working
- I can connect to the server and (I think) the first parts of the map are downloaded.
- I configured port-forwarding, which seems to work based on the above findings
- I'm not sure if the router performs "source port randomization"

Sidenote: I don't think it's relevant, but me and my server are actually behind two routers, forming a DMZ. I forwarded the port on both routers, and I can also connect to the server from within the DMZ. The router facing to the internet seems to be the problem.

Now I don't know how to proceed: What could cause this behaviour and what could I have done wrong? Might source-port randomization be the issue (how can I find out?)? How can I get better logs and error messages?
If I can't get this working - would factorio work when setting up VPN?


I attached the relevant log file. The line that looks most interesting is the following:

Code: Select all

Info UnparsedNetworkMessage.cpp:91: Invalid packet (type ConnectionRequestReply) received from IP ADDR:({<MY-PUBLIC-IP-ADDR>:34197}): invalid state (WaitingForAccept) for packet type
Attachments
factorio.log
(3.19 KiB) Downloaded 48 times

__maja__
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Dec 26, 2018 4:03 pm
Contact:

Re: [0.16.51] Cannot connect to server via public IP

Post by __maja__ »

Ok, I found out what the problem was. There wasn't one.

It seems that the factorio server has NAT loopback-problems:
When trying to connect to the public IP, while at the same time being behind that public IP, it doesn't work and behaves as described.
But when trying to connect from somewhere else (when a friend connects), everything works flawlessly.

So the solution is: When having the server in the same private network, you must connect via the private IP (not the public IP and not from the public server list). Everyone else can just connect via the public IP and it should work.

It would be nice though if factorio could log some more helpful messages and/or detect and fix the problem itself.

Zavian
Smart Inserter
Smart Inserter
Posts: 1641
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: [0.16.51] Cannot connect to server via public IP

Post by Zavian »

TBH that sound more like a router issue. (Many routers won't forward packets addressed to the router's external IP, which arrive on it's internal interfaces).

Post Reply

Return to “Technical Help”