Page 1 of 1

Pingpong servers give conflicting addresses

Posted: Sun Oct 27, 2024 8:10 pm
by peterfortuin
I'm running a headless server in my Kubernetes cluster. For clients on my local network that works without any problem.
But nobody from the internet can connect. I looked into the logging and found the following lines :

Code: Select all

   5.682 Info ServerRouter.cpp:664: Asking pingpong servers (pingpong1.factorio.com:34197, pingpong2.factorio.com:34197, pingpong3.factorio.com:34197, pingpong4.factorio.com:34197) for own address
   5.686 Info UDPSocket.cpp:44: Opening socket for broadcast
   5.693 Error InterruptibleStdioStream.cpp:60: Got EOF on stdin; closing
   5.694 Info RemoteCommandProcessor.cpp:129: Starting RCON interface at IP ADDR:({0.0.0.0:27015})
   5.695 Info CommandLineMultiplayer.cpp:288: Maximum segment size = 100; minimum segment size = 25; maximum-segment-size peer count = 10; minimum-segment-size peer count = 20
   5.784 Warning ServerRouter.cpp:541: Received own address message reply with conflicting address (got IP ADDR:({<my-ip>:19296}), expected IP ADDR:({<my-ip>:58037}))
   5.784 Warning ServerMultiplayerManager.cpp:651: Determining own address has failed. Best guess: IP ADDR:({<my-ip>:58037})
   5.801 Warning ServerRouter.cpp:541: Received own address message reply with conflicting address (got IP ADDR:({<my-ip>:19297}), expected IP ADDR:({<my-ip>:58037}))
   5.934 Warning ServerRouter.cpp:541: Received own address message reply with conflicting address (got IP ADDR:({<my-ip>:24105}), expected IP ADDR:({<my-ip>:58037}))
I replaced my ip address in the logging for <my-ip>. I can confirm that all ip addresses that I have removed are the same one and point to my router that connects my local network to the internet.

What I guess is that pingpong servers are used to figure out on what ip address and what port the Factorio server is running. But somehow all 4 pingpong servers reply with a different port and non of them are correct (the server is running on port 30001). I don't know why this is happening. Maybe it has something to do with my Kubernetes cluster or maybe something with my router.

Does anybody have an idea how to resolve this? Can I do something to get the reply from the pingpong servers correct to the port the server is actually running on? Or is there some way to disable this mechanism and just specify the port myself? Any help would be appreciated.

Re: Pingpong servers give conflicting addresses

Posted: Mon Oct 28, 2024 9:38 am
by vinzenz
This is mostly likely an issue with the NAT configured by your internet service provider, Factorio is only able to work around simpler NAT configs. More info: https://tailscale.com/blog/how-nat-traversal-works

I recommend you set up something like tailscale or ask your provider for a static ip.

Re: Pingpong servers give conflicting addresses

Posted: Mon Oct 28, 2024 2:11 pm
by peterfortuin
vinzenz wrote: Mon Oct 28, 2024 9:38 am This is mostly likely an issue with the NAT configured by your internet service provider, Factorio is only able to work around simpler NAT configs. More info: https://tailscale.com/blog/how-nat-traversal-works

I recommend you set up something like tailscale or ask your provider for a static ip.
My ISP doesn't configure my NAT. I have done that myself. The router I use is not provided by my ISP. And my ip provided by my ISP has never changed. So that's also very static.

Re: Pingpong servers give conflicting addresses

Posted: Mon Oct 28, 2024 2:23 pm
by vinzenz
It is possible that they deploy carrier grade NAT to manage their limited IPv4 addresses. https://en.wikipedia.org/wiki/Carrier-grade_NAT

You can also try this test page: http://ip.bieringer.net/cgn-test.html

Re: Pingpong servers give conflicting addresses

Posted: Mon Oct 28, 2024 9:14 pm
by peterfortuin
vinzenz wrote: Mon Oct 28, 2024 2:23 pm It is possible that they deploy carrier grade NAT to manage their limited IPv4 addresses. https://en.wikipedia.org/wiki/Carrier-grade_NAT

You can also try this test page: http://ip.bieringer.net/cgn-test.html
My ISP is not using Carrier Grade NAT. The test that you link confirms that.

I'm actually looking for a solution how I can send the correct port number to the Factorio server list.

Re: Pingpong servers give conflicting addresses

Posted: Mon Oct 28, 2024 11:38 pm
by waterBear
Peter, I am having much the same problem but with Azure hosting. I also can configure the NAT and have pretty good control over other networking settings.

If you figure this out, please post about it!

Re: Pingpong servers give conflicting addresses

Posted: Tue Oct 29, 2024 12:29 pm
by peterfortuin
waterBear wrote: Mon Oct 28, 2024 11:38 pm Peter, I am having much the same problem but with Azure hosting. I also can configure the NAT and have pretty good control over other networking settings.

If you figure this out, please post about it!
Unfortunately I haven't. I will post here if I have working solution.
I'm hoping the Factorio devs will add an option where you can force the port number that will be send to server list.

Re: Pingpong servers give conflicting addresses

Posted: Tue Oct 29, 2024 1:11 pm
by waterBear
peterfortuin wrote: Tue Oct 29, 2024 12:29 pm
waterBear wrote: Mon Oct 28, 2024 11:38 pm Peter, I am having much the same problem but with Azure hosting. I also can configure the NAT and have pretty good control over other networking settings.

If you figure this out, please post about it!
Unfortunately I haven't. I will post here if I have working solution.
I'm hoping the Factorio devs will add an option where you can force the port number that will be send to server list.
So the ping pong servers test by sending over random ports, is that right?
1.984 Warning ServerRouter.cpp:541: Received own address message reply with conflicting address (got IP ADDR:({<hidden>:26256}), expected IP ADDR:({<hidden>:16849}))
It looks like port 16849 was used in this example. Hmm.

Re: Pingpong servers give conflicting addresses

Posted: Tue Oct 29, 2024 7:17 pm
by peterfortuin
waterBear wrote: Tue Oct 29, 2024 1:11 pm
So the ping pong servers test by sending over random ports, is that right?
1.984 Warning ServerRouter.cpp:541: Received own address message reply with conflicting address (got IP ADDR:({<hidden>:26256}), expected IP ADDR:({<hidden>:16849}))
It looks like port 16849 was used in this example. Hmm.
The log line with the conflicting address is printed 3 times, but 4 ping servers are tested. So I assume that the expected ip address is the result of the 1st ping server.

Re: Pingpong servers give conflicting addresses

Posted: Wed Oct 30, 2024 1:17 am
by Rseding91
I think you're misunderstanding what's happening. The entire point of the ping-pong servers is to see what the actual internet experiences when your computer sends a packet to them. Factorio is sending each of the ping-pong servers the exact same message from the exact same IP and port on the machine. Those packets then - through no part of Factorio's logic - get sent over the network, out onto the internet, and eventually reach the ping pong servers. When they arrive at the ping pong server, the server can see *what it has been told by the internet transferring the packet to it* the IP address and port it should use to reply.

The port is different because some NAT system between you and the ping-pong servers has re-encoded your network traffic and forwarded it on to the ping-pong servers with a different port. This is what NAT does: Network Address Translation - it translated your IP and port to a different one so it can share the same public-facing IP address with multiple people behind the NAT-ed device.

The ping-pong server then replies to the IP and Port it was told to reply with, at which point it eventually hits the place that did the NAT-ing which reverses the process and forwards it back to you.

The problem with this is - that back and forth of you send, server sends back, means anyone attempting to connect directly to you can't. The thing in the middle doing the NAT-ing will block the incoming packets because you did not first initiate the outgoing packets.

Re: Pingpong servers give conflicting addresses

Posted: Wed Oct 30, 2024 7:32 am
by peterfortuin
Rseding91 wrote: Wed Oct 30, 2024 1:17 am I think you're misunderstanding what's happening. The entire point of the ping-pong servers is to see what the actual internet experiences when your computer sends a packet to them. Factorio is sending each of the ping-pong servers the exact same message from the exact same IP and port on the machine. Those packets then - through no part of Factorio's logic - get sent over the network, out onto the internet, and eventually reach the ping pong servers. When they arrive at the ping pong server, the server can see *what it has been told by the internet transferring the packet to it* the IP address and port it should use to reply.

The port is different because some NAT system between you and the ping-pong servers has re-encoded your network traffic and forwarded it on to the ping-pong servers with a different port. This is what NAT does: Network Address Translation - it translated your IP and port to a different one so it can share the same public-facing IP address with multiple people behind the NAT-ed device.

The ping-pong server then replies to the IP and Port it was told to reply with, at which point it eventually hits the place that did the NAT-ing which reverses the process and forwards it back to you.

The problem with this is - that back and forth of you send, server sends back, means anyone attempting to connect directly to you can't. The thing in the middle doing the NAT-ing will block the incoming packets because you did not first initiate the outgoing packets.
Actually, I didn't misunderstand a thing. I completely agree with you explanation. You just created a better summary.

You are only missing one part in the story. On my NAT router I actually have a port forward to the server where the Factorio server is running on. The number of the port that is being forwarded is the same as the actual port the Factorio server is running on. I would expect / like that the ping pong servers actually returning that port number, but as you can see in my logging (first post in this topic) that doesn't happen.

What I want is a way to tell the ping pong servers where my server is actually listening (ip address and port) so that there ping would go to the correct place.

Re: Pingpong servers give conflicting addresses

Posted: Thu Oct 31, 2024 3:20 pm
by vinzenz
There's no option to override the pingpong servers. Are you able to connect to this ip:port from outside your network? You can try to set up a public DNS SRV record https://wiki.factorio.com/Multiplayer#DNS_SRV_Records to make it easier to reach your server.

Re: Pingpong servers give conflicting addresses

Posted: Thu Oct 31, 2024 8:43 pm
by peterfortuin
vinzenz wrote: Thu Oct 31, 2024 3:20 pm There's no option to override the pingpong servers. Are you able to connect to this ip:port from outside your network? You can try to set up a public DNS SRV record https://wiki.factorio.com/Multiplayer#DNS_SRV_Records to make it easier to reach your server.
I didn't know about the DNS SRV record. I set it up and it works. Nice thing to have. Thank you for that information.

But it doesn't help getting my server into the factorio public server list with the correct port number.

Re: Pingpong servers give conflicting addresses

Posted: Tue Nov 05, 2024 8:50 am
by peterfortuin
Any one else has an idea how to resolve my issue?

Re: Pingpong servers give conflicting addresses

Posted: Tue Nov 05, 2024 3:39 pm
by vinzenz
peterfortuin wrote: Tue Nov 05, 2024 8:50 am Any one else has an idea how to resolve my issue?
Maybe you can configure a "reverse port mapping" for your Factorio server to force it on port 30001. First check if kubernetes is messing with the src port of your server and then map local_ip:30001 to public_ip:30001 for outbound requests in your router. That all pingpong servers see different ports is a sure sign that something in your network path messes with them, maybe there's some security setting on your router that you can disable.

Re: Pingpong servers give conflicting addresses

Posted: Sun Nov 24, 2024 6:21 pm
by waterBear
Rseding91 wrote: Wed Oct 30, 2024 1:17 am I think you're misunderstanding what's happening. The entire point of the ping-pong servers is to see what the actual internet experiences when your computer sends a packet to them. Factorio is sending each of the ping-pong servers the exact same message from the exact same IP and port on the machine. Those packets then - through no part of Factorio's logic - get sent over the network, out onto the internet, and eventually reach the ping pong servers. When they arrive at the ping pong server, the server can see *what it has been told by the internet transferring the packet to it* the IP address and port it should use to reply.

The port is different because some NAT system between you and the ping-pong servers has re-encoded your network traffic and forwarded it on to the ping-pong servers with a different port. This is what NAT does: Network Address Translation - it translated your IP and port to a different one so it can share the same public-facing IP address with multiple people behind the NAT-ed device.

The ping-pong server then replies to the IP and Port it was told to reply with, at which point it eventually hits the place that did the NAT-ing which reverses the process and forwards it back to you.

The problem with this is - that back and forth of you send, server sends back, means anyone attempting to connect directly to you can't. The thing in the middle doing the NAT-ing will block the incoming packets because you did not first initiate the outgoing packets.
Hey, thanks for your reply! I did finally come to that same conclusion. I solved my own problem on Azure by just turning off my NAT :) Because I am stupid sometimes. It happens.

Sever has been up and running for about a month now, we've been having a blast.