Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public browser listing shows the server but we arent able to connect. #15

Open
SQLJames opened this issue Jan 14, 2022 · 7 comments
Open
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@SQLJames
Copy link
Owner

The server now shows in public browser, however, when attempting to connect through the public browser you will get an error, the server is available on the web and allows inbound connections when connecting to the ip directly. This is due to the fact the outbound ports are randomized and because the server needs to reach out to update the browser with connection details and keepalive state on port 34197.

This is better explained by this writeup on serverfault;

If anyone has any ideas on how we can look to resolve this I would be happy to implement them.

@SQLJames SQLJames added bug Something isn't working help wanted Extra attention is needed labels Jan 14, 2022
@SQLJames
Copy link
Owner Author

setting hostNetwork: true in the deployment spec results in the following error

MultiplayerManager failed: Host address is already in use.

@SQLJames
Copy link
Owner Author

removing node port from the chart allowed me to configure this option
however, it did not help.

2022-01-14T16:14:30.782795616Z    0.622 Checksum for script /factorio/temp/currently-playing/control.lua: 3795083680
2022-01-14T16:14:30.784041709Z    0.623 Info UDPSocket.cpp:27: Opening socket at (IP ADDR:({0.0.0.0:31497}))
2022-01-14T16:14:30.784141872Z    0.623 Hosting game at IP ADDR:({0.0.0.0:31497})
2022-01-14T16:14:30.784182243Z    0.623 Info HttpSharedState.cpp:54: Downloading https://auth.factorio.com/generate-server-padlock-2?api_version=4
2022-01-14T16:14:30.899629379Z    0.739 Info AuthServerConnector.cpp:68: Obtained serverPadlock for serverHash (ybtMBEoZTiIUP7IVSQPD9s7vpvJo9Acc) from the auth server.
2022-01-14T16:14:30.899676442Z    0.739 Info ServerMultiplayerManager.cpp:797: updateTick(0) changing state from(CreatingGame) to(InGame)
2022-01-14T16:14:30.908255028Z    0.747 Info ServerRouter.cpp:657: Asking pingpong servers (pingpong1.factorio.com:34197, pingpong2.factorio.com:34197, pingpong3.factorio.com:34197, pingpong4.factorio.com:34197) for own address
2022-01-14T16:14:30.908300690Z    0.747 Info UDPSocket.cpp:39: Opening socket for broadcast
2022-01-14T16:14:30.908651936Z    0.748 Error InterruptibleStdioStream.cpp:61: Got EOF on stdin; closing
2022-01-14T16:14:30.909267208Z    0.748 Info RemoteCommandProcessor.cpp:130: Starting RCON interface at IP ADDR:({0.0.0.0:27015})
2022-01-14T16:14:30.909298201Z    0.748 Info CommandLineMultiplayer.cpp:284: Maximum segment size = 100; minimum segment size = 25; maximum-segment-size peer count = 10; minimum-segment-size peer count = 20
2022-01-14T16:14:30.960963209Z    0.800 Info ServerRouter.cpp:540: Own address is IP ADDR:({<my public ip>:31497}) (confirmed by pingpong1)
2022-01-14T16:14:31.043521955Z    0.883 Info ServerRouter.cpp:540: Own address is IP ADDR:({<my public ip>:31497}) (confirmed by pingpong2)
2022-01-14T16:14:31.094359367Z    0.933 Info MatchingServer.cpp:114: Matching server game `11630107` has been created.
2022-01-14T16:14:31.110123802Z    0.949 Info ServerRouter.cpp:540: Own address is IP ADDR:({<my public ip>:31497}) (confirmed by pingpong4)
2022-01-14T16:14:31.110161008Z    0.949 Info ServerMultiplayerManager.cpp:729: Matching server connection resumed

@SQLJames
Copy link
Owner Author

ping is still not showing and we are not able to connect to the server.

@SQLJames
Copy link
Owner Author

firewall logs, everything looks to be routing fine and the ip is routable externally and can communicate back as per the logs.

Jan 15 15:00:26 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=19529 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:00:56 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.173.216 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=50133 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:01:11 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=23794 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:01:26 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=172.104.241.28 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=58069 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:01:41 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=29023 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:01:56 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=172.104.241.28 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=62868 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:02:11 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.173.216 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=61636 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:02:26 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=172.104.241.28 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=62938 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:02:56 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.173.216 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=4367 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:03:11 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=172.104.241.28 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=1084 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:03:26 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=43301 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:03:41 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=172.104.241.28 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=4509 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:03:56 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=50464 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:04:11 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.173.216 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=13676 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:04:26 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=172.104.241.28 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=7838 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:04:56 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.173.216 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=15297 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:05:11 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=1844 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:05:26 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.173.216 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=16897 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:05:56 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=172.104.241.28 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=21476 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:06:11 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=10219 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:06:41 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.173.216 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=32901 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:06:56 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=172.104.241.28 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=28080 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:07:11 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=17925 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:07:56 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.173.216 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=46983 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:08:41 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=39308 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:09:26 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=43346 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:09:56 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=46940 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:10:26 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=51547 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:10:56 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.173.216 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=63862 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:11:32 EdgeRouter-4 kernel: [WAN_IN-20-A]IN=eth0 OUT=eth1 MAC=<address> SRC=172.104.241.28 DST=172.16.9.37 LEN=53 TOS=0x00 PREC=0x00 TTL=47 ID=16153 DF PROTO=UDP SPT=34197 DPT=31497 LEN=33
Jan 15 15:11:57 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.173.216 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=2951 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:12:12 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=1619 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:12:42 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.173.216 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=13019 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:12:57 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=8371 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:13:12 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.173.216 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=15299 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:14:12 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.173.216 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=18917 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:14:42 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=22852 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:15:12 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=28313 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:15:27 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.173.216 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=35674 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:16:59 EdgeRouter-4 kernel: [WAN_IN-20-A]IN=eth0 OUT=eth1 MAC=<address> SRC=172.104.241.28 DST=172.16.9.37 LEN=53 TOS=0x00 PREC=0x00 TTL=47 ID=3520 DF PROTO=UDP SPT=34197 DPT=31497 LEN=33
Jan 15 15:17:01 EdgeRouter-4 kernel: [WAN_IN-20-A]IN=eth0 OUT=eth1 MAC=<address> SRC=45.79.173.216 DST=172.16.9.37 LEN=53 TOS=0x00 PREC=0x00 TTL=43 ID=16570 DF PROTO=UDP SPT=34197 DPT=31497 LEN=33
Jan 15 15:17:12 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=50828 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:17:42 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=56208 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:18:27 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=59396 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:19:42 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.37 DST=45.79.202.131 LEN=29 TOS=0x00 PREC=0x00 TTL=254 ID=62961 DF PROTO=UDP SPT=31497 DPT=34197 LEN=9
Jan 15 15:19:58 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.34 DST=45.79.173.216 LEN=31 TOS=0x00 PREC=0x00 TTL=254 ID=52898 DF PROTO=UDP SPT=31497 DPT=34197 LEN=11
Jan 15 15:19:58 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.34 DST=139.162.87.206 LEN=31 TOS=0x00 PREC=0x00 TTL=254 ID=34134 DF PROTO=UDP SPT=31497 DPT=34197 LEN=11
Jan 15 15:19:58 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.34 DST=172.104.241.28 LEN=31 TOS=0x00 PREC=0x00 TTL=254 ID=22049 DF PROTO=UDP SPT=31497 DPT=34197 LEN=11
Jan 15 15:19:58 EdgeRouter-4 kernel: [NAT-5002-MASQ] IN= OUT=eth0 SRC=172.16.9.34 DST=45.79.202.131 LEN=31 TOS=0x00 PREC=0x00 TTL=254 ID=36915 DF PROTO=UDP SPT=31497 DPT=34197 LEN=11
Jan 15 15:19:58 EdgeRouter-4 kernel: [WAN_IN-20-A]IN=eth0 OUT=eth1 MAC=<address> SRC=45.79.202.131 DST=172.16.9.34 LEN=54 TOS=0x00 PREC=0x00 TTL=48 ID=8176 DF PROTO=UDP SPT=34197 DPT=31497 LEN=34
Jan 15 15:19:58 EdgeRouter-4 kernel: [WAN_IN-20-A]IN=eth0 OUT=eth1 MAC=<address> SRC=45.79.173.216 DST=172.16.9.34 LEN=54 TOS=0x00 PREC=0x00 TTL=43 ID=37306 DF PROTO=UDP SPT=34197 DPT=31497 LEN=34
Jan 15 15:19:58 EdgeRouter-4 kernel: [WAN_IN-20-A]IN=eth0 OUT=eth1 MAC=<address> SRC=172.104.241.28 DST=172.16.9.34 LEN=54 TOS=0x00 PREC=0x00 TTL=47 ID=34670 DF PROTO=UDP SPT=34197 DPT=31497 LEN=34
Jan 15 15:19:58 EdgeRouter-4 kernel: [WAN_IN-20-A]IN=eth0 OUT=eth1 MAC=<address> SRC=139.162.87.206 DST=172.16.9.34 LEN=54 TOS=0x00 PREC=0x00 TTL=44 ID=37156 DF PROTO=UDP SPT=34197 DPT=31497 LEN=34

@SQLJames
Copy link
Owner Author

The issue was related to a Nat rule not applying in the correct order. I was able to trace this down with the help of the factorio discord. Looking at the client log located in the appdata directory mentioned here
We were able to see that the client log was trying to connect to the appropriate public ip, and the rules were applied according to the documentation on the edgerouter hairpin Nat. However, the ultimate fix was that I had to move the rules to a random order save and then move them back. I assume this could have also been fixed by a reboot of the firewall but wasn't ideal to do at this time.

@ZCube
Copy link
Contributor

ZCube commented Jan 4, 2023

How about use https://github.com/ZCube/factorio-port-fixer.

According to https://www.factorio.com/blog/post/fff-143 it is the pingpong server that determines the initial port. Therefore, you can use the port you want by simply replacing that server. ( Currently port 34197 is fixed and port forwarding is required. )

It would be nice if hostAliases settings for pods were added.

@MOZGIII
Copy link
Contributor

MOZGIII commented Mar 31, 2023

It looks like could use my https://github.com/MOZGIII/port-map-operator to solve the issues with NAT in this particular case, and use the LoadBalancer service type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants