Server is joinable through browser, but not through IP address

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.
monkeylard1
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Jul 21, 2022 11:46 pm
Contact:

Server is joinable through browser, but not through IP address

Post by monkeylard1 »

I am running a headless Factorio server on a debian system hosted by AWS lightsail. As in, this is not running on my computer or my network, I am hosting it externally.

On the server browser, it shows the name and description that I have listed in my config file.

Other users, and myself, are able to join my server via the server browser, however, when entering the IP address (with and without a ":port", tried 34197 and 27015) we are unable to connect. It says "Could not establish network communication with server." Nothing in the server logs show about these attempted connections.
factorio_orIfwfG9Iv.png
factorio_orIfwfG9Iv.png (1.3 MiB) Viewed 1797 times
Also, if I disconnect from the server and go to the main menu, I see "connect to Monkeylard's server" but that doesn't work either. I have to open the server browser and click my favorited server to connect.
factorio_NXXATd6eLI.png
factorio_NXXATd6eLI.png (130 KiB) Viewed 1797 times
I'd like to get it working so I can connect via just an IP so people don't have to scroll through the menu.

Here is my server-settings.json file:

Code: Select all

  
  {
  "name": "Monkeylard's Server",
  "description": "A Vanilla Server",
  "tags": ["game", "tags"],

  "_comment_max_players": "Maximum number of players allowed, admins can join even a full server. 0 means unlimited.",
  "max_players": 20,

  "_comment_visibility": ["public: Game will be published on the official Factorio matching server",
                          "lan: Game will be broadcast on LAN"],
  "visibility":
  {
    "public": true,
    "lan": true
  },

  "_comment_credentials": "Your factorio.com login credentials. Required for games with visibility public",
  "username": "redacted",
  "password": "redacted",

  "_comment_token": "Authentication token. May be used instead of 'password' above.",
  "token": "",

  "game_password": "",

  "_comment_require_user_verification": "When set to true, the server will only allow clients that have a valid Factorio.com account",
  "require_user_verification": true,

  "_comment_max_upload_in_kilobytes_per_second" : "optional, default value is 0. 0 means unlimited.",
  "max_upload_in_kilobytes_per_second": 0,

  "_comment_max_upload_slots" : "optional, default value is 5. 0 means unlimited.",
  "max_upload_slots": 5,

  "_comment_minimum_latency_in_ticks": "optional one tick is 16ms in default speed, default value is 0. 0 means no minimum.",
  "minimum_latency_in_ticks": 0,

  "_comment_max_heartbeats_per_second": "Network tick rate. Maximum rate game updates packets are sent at before bundling them together. Minimum value is 6, maximum value i$
  "max_heartbeats_per_second": 60,

  "_comment_ignore_player_limit_for_returning_players": "Players that played on this map already can join even when the max player limit was reached.",
  "ignore_player_limit_for_returning_players": false,
  
  "_comment_allow_commands": "possible values are, true, false and admins-only",
  "allow_commands": "admins-only",

  "_comment_autosave_interval": "Autosave interval in minutes",
  "autosave_interval": 10,

  "_comment_autosave_slots": "server autosave slots, it is cycled through when the server autosaves.",
  "autosave_slots": 35,

  "_comment_afk_autokick_interval": "How many minutes until someone is kicked when doing nothing, 0 for never.",
  "afk_autokick_interval": 0,

  "_comment_auto_pause": "Whether should the server be paused when no players are present.",
  "auto_pause": true,

  "only_admins_can_pause_the_game": true,

  "_comment_autosave_only_on_server": "Whether autosaves should be saved only on server or also on all connected clients. Default is true.",
  "autosave_only_on_server": true,

  "_comment_non_blocking_saving": "Highly experimental feature, enable only at your own risk of losing your saves. On UNIX systems, server will fork itself to create an aut$
  "non_blocking_saving": false,
  
  "_comment_segment_sizes": "Long network messages are split into segments that are sent over multiple ticks. Their size depends on the number of peers currently connected.$
  "minimum_segment_size": 25,
  "minimum_segment_size_peer_count": 20,
  "maximum_segment_size": 100,
  "maximum_segment_size_peer_count": 10
}
I run the server with a systemctl service, here is the config for that

Code: Select all

[Unit]
Description=Factorio Headless Server

[Service]
Type=simple
User=factorio
ExecStart=/opt/factorio/bin/x64/factorio --start-server /opt/factorio/saves/my-save.zip --server-settings /opt/factorio/data/server-settings.json
Here is what I see if I run "systemctl status factorio"

Code: Select all

admin@ip-172-26-1-233:/opt/factorio/data$ sudo systemctl status factorio
● factorio.service - Factorio Headless Server
   Loaded: loaded (/etc/systemd/system/factorio.service; static; vendor preset: enabled)
   Active: active (running) since Thu 2022-07-21 07:40:32 UTC; 16h ago
 Main PID: 2102 (factorio)
    Tasks: 7 (limit: 2372)
   Memory: 271.2M
   CGroup: /system.slice/factorio.service
           └─2102 /opt/factorio/bin/x64/factorio --start-server /opt/factorio/saves/my-save.zip --server-settings /opt/factorio/data/server-settings.json

Jul 21 23:43:31 ip-172-26-1-233 factorio[2102]: 57778.567 Info GameActionHandler.cpp:5012: UpdateTick (360074) processed PlayerJoinGame peerID(5) playerIndex(0) mode(connect
Jul 21 23:43:31 ip-172-26-1-233 factorio[2102]: 57778.633 Info ServerMultiplayerManager.cpp:944: updateTick(360078) received stateChanged peerID(5) oldState(WaitingForComman
Jul 21 23:43:31 ip-172-26-1-233 factorio[2102]: 2022-07-21 23:43:31 [JOIN] monkeylard joined the game
Jul 21 23:48:56 ip-172-26-1-233 factorio[2102]: 58104.050 Info ServerMultiplayerManager.cpp:1058: Disconnect notification for peer (5)
Jul 21 23:48:56 ip-172-26-1-233 factorio[2102]: 58104.051 Info ServerMultiplayerManager.cpp:944: updateTick(379603) received stateChanged peerID(5) oldState(InGame) newState
Jul 21 23:48:56 ip-172-26-1-233 factorio[2102]: 2022-07-21 23:48:56 [LEAVE] monkeylard left the game
Jul 21 23:48:56 ip-172-26-1-233 factorio[2102]: 58104.051 Info ServerSynchronizer.cpp:623: nextHeartbeatSequenceNumber(3486122) removing peer(5).
Jul 21 23:48:57 ip-172-26-1-233 factorio[2102]: 58105.050 Info ServerMultiplayerManager.cpp:1205: Auto saving map as /opt/factorio/saves/my-save.zip
Jul 21 23:48:57 ip-172-26-1-233 factorio[2102]: 58105.066 Info AppManager.cpp:420: Saving game as /opt/factorio/saves/my-save.zip
Jul 21 23:48:58 ip-172-26-1-233 factorio[2102]: 58105.533 Info AppManagerStates.cpp:1902: Saving finished
lines 1-19/19 (END)
Please let me know if there is any other information you'd like me to provide

Thanks,
Monkeylard
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3714
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Server is joinable through browser, but not through IP address

Post by DaveMcW »

Sounds like you have a firewall blocking incoming IP traffic.

You want Factorio to handle the UDP protocol on port 34197. See the Lightsail firewall guide.

Joining through the browser works because your headless server connected to Factorio's servers first, so it counts as an outgoing connection.
Last edited by DaveMcW on Fri Jul 22, 2022 5:57 am, edited 2 times in total.
asheiduk
Long Handed Inserter
Long Handed Inserter
Posts: 73
Joined: Sat Dec 05, 2020 9:46 am
Contact:

Re: Server is joinable through browser, but not through IP address

Post by asheiduk »

Which IP you you use for connecting? The one the host sees for itself or the "public IP" shown in the AWS UI?
User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1507
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

Re: Server is joinable through browser, but not through IP address

Post by ptx0 »

DaveMcW wrote: Fri Jul 22, 2022 5:47 am Sounds like you have a firewall blocking incoming IP traffic.
...
Joining through the browser works because your headless server connected to Factorio's servers first, so it counts as an outgoing connection.
that isn't how NAT connstate tracking works: https://www.booleanworld.com/depth-guid ... ing_module

that is useful when you block connections FROM an IP, but you still need to be able to send packets TO an IP. you want return packets to be acknowledged, so, RELATED,ESTABLISHED states are tracked, in most stateful NAT configurations.
monkeylard1
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Jul 21, 2022 11:46 pm
Contact:

Re: Server is joinable through browser, but not through IP address

Post by monkeylard1 »

DaveMcW wrote: Fri Jul 22, 2022 5:47 am Sounds like you have a firewall blocking incoming IP traffic.

You want Factorio to handle the UDP protocol on port 34197. See the Lightsail firewall guide.

Joining through the browser works because your headless server connected to Factorio's servers first, so it counts as an outgoing connection.
I absolutely did not realize that lightsail has its own web interface that you have to open ports on, on top of the iptables configuration on the operating system.

This has resolved the issue, thank you to everyone!
Post Reply

Return to “Technical Help”