[0.14.x] [cube] Command-line options for IP and port bindings
-
- Burner Inserter
- Posts: 9
- Joined: Tue Jul 05, 2016 6:14 am
- Contact:
[0.14.x] [cube] Command-line options for IP and port bindings
As a server host, these are invaluable options to have. Currently, Factorio will bind to all available addresses on a port specified in config.ini. Command-line options would make this more secure for the hosters (unable to be modified), as well as allow servers to be bound to unique addresses so that other servers may utilize the default ports.
Also, related to the issue of IP binding. Clients who do not have DMZ enabled on their router for their computer are unable to connect to a Factorio server that binds to multiple addresses. I expected this issue to be resolved with the roll out of the new networking system, but it seems it still is around from the 0.13 branch. Currently, if a client tries to direct connect to the server using an address that is not the primary address, the connection will fail, unless DMZ is enabled.
Also, related to the issue of IP binding. Clients who do not have DMZ enabled on their router for their computer are unable to connect to a Factorio server that binds to multiple addresses. I expected this issue to be resolved with the roll out of the new networking system, but it seems it still is around from the 0.13 branch. Currently, if a client tries to direct connect to the server using an address that is not the primary address, the connection will fail, unless DMZ is enabled.
Re: [0.14.x] Command-line options for IP and port bindings
What do you mean by all available addresses? It just opens the port on the local computer. I just don't get network stuff.
Re: [0.14.x] Command-line options for IP and port bindings
tldr; Factorio does not support multiple IP addresses.
Factorio must run on the primary IP address of the server. Factorio listens on ALL IP addresses, which can cause bad things to happen on those other IP addresses.
Possible fix: Do not listen on non-primary IP addresses.
Better fix: Allow choosing IP address in config.ini.
Factorio must run on the primary IP address of the server. Factorio listens on ALL IP addresses, which can cause bad things to happen on those other IP addresses.
Possible fix: Do not listen on non-primary IP addresses.
Better fix: Allow choosing IP address in config.ini.
-
- Burner Inserter
- Posts: 9
- Joined: Tue Jul 05, 2016 6:14 am
- Contact:
Re: [0.14.x] Command-line options for IP and port bindings
Best fix: Allow IP address and port to be set via command-line. Config files are a security risk when it comes to server hosting.DaveMcW wrote:tldr; Factorio does not support multiple IP addresses.
Factorio must run on the primary IP address of the server. Factorio listens on ALL IP addresses, which can cause bad things to happen on those other IP addresses.
Possible fix: Do not listen on non-primary IP addresses.
Better fix: Allow choosing IP address in config.ini.
For example, my server I run Factorio on has 6 IP addresses associated with it. When I run Factorio, Factorio will listen on *all* those IP addresses. Ideally, Factorio should only listen on one specific IP address.kovarex wrote:What do you mean by all available addresses? It just opens the port on the local computer. I just don't get network stuff.
Below is what netstat shows on Linux with two Factorio servers running, and a TeamSpeak server:
Code: Select all
udp 0 0 0.0.0.0:34197 8592/factorio
udp 0 0 0.0.0.0:34198 11671/factorio
udp 0 0 192.99.180.20:9987 18642/ts3server_lin
Re: [0.14.x] [cube] Command-line options for IP and port bindings
This becomes revalent when one is trying to host factorio in a more controlled environment.
While it's not required for the game to work, most other online games either allow only binding to a single IP (commonly set through config or ini file) or do so by default.
I really enjoy that factorio binds to multiple IPs so that my local friends can use my local IP (avoids router and my PFSense box) and my remote friends can use my VPN IP.
If you decide that binding to multiple addresses is a bug then please have some way of asking the game to bind to multiple IPs.
While it's not required for the game to work, most other online games either allow only binding to a single IP (commonly set through config or ini file) or do so by default.
I really enjoy that factorio binds to multiple IPs so that my local friends can use my local IP (avoids router and my PFSense box) and my remote friends can use my VPN IP.
If you decide that binding to multiple addresses is a bug then please have some way of asking the game to bind to multiple IPs.
-
- Burner Inserter
- Posts: 9
- Joined: Tue Jul 05, 2016 6:14 am
- Contact:
Re: [0.14.x] [cube] Command-line options for IP and port bindings
It's a general rule of thumb that when 0.0.0.0 is specified, that it would bind on all addresses. However, with an application such as a game server, it is not standard practice to bind on all addresses. I cannot actually think of an instance where that is a standard procedure, outside of a badly configured Apache instance.bk5115545 wrote:This becomes revalent when one is trying to host factorio in a more controlled environment.
While it's not required for the game to work, most other online games either allow only binding to a single IP (commonly set through config or ini file) or do so by default.
I really enjoy that factorio binds to multiple IPs so that my local friends can use my local IP (avoids router and my PFSense box) and my remote friends can use my VPN IP.
If you decide that binding to multiple addresses is a bug then please have some way of asking the game to bind to multiple IPs.
Re: [0.14.x] [cube] Command-line options for IP and port bindings
So I've made a simple version of this -- when hosting a dedicated server you can use the option --bind to bind to the address. If this option is not given, then 0.0.0.0 and ::0 are used both. Also I've limited the scope of other sockets used in game.
-
- Burner Inserter
- Posts: 9
- Joined: Tue Jul 05, 2016 6:14 am
- Contact:
Re: [0.14.x] [cube] Command-line options for IP and port bindings
Awesome news, thank you!cube wrote:So I've made a simple version of this -- when hosting a dedicated server you can use the option --bind to bind to the address. If this option is not given, then 0.0.0.0 and ::0 are used both. Also I've limited the scope of other sockets used in game.
Could you also look into adding a parameter for specifying the port? Trying to guarantee the config file is not modified is a difficult, and not as convenient.
Perhaps if no port parameter is specified, default to 34197, removing the config line all together?
Re: [0.14.x] [cube] Command-line options for IP and port bindings
Factorio already has a parameter for specifying the port:Revenge282 wrote:Could you also look into adding a parameter for specifying the port? Trying to guarantee the config file is not modified is a difficult, and not as convenient.
Code: Select all
Server options:
--port N network port to use
-
- Burner Inserter
- Posts: 9
- Joined: Tue Jul 05, 2016 6:14 am
- Contact:
Re: [0.14.x] [cube] Command-line options for IP and port bindings
Completely unaware of that. Thank you.daniel34 wrote:Factorio already has a parameter for specifying the port:Revenge282 wrote:Could you also look into adding a parameter for specifying the port? Trying to guarantee the config file is not modified is a difficult, and not as convenient.Code: Select all
Server options: --port N network port to use
Re: [0.14.x] [cube] Command-line options for IP and port bindings
Here's a few that I've had the pleasure of hosting.Revenge282 wrote: However, with an application such as a game server, it is not standard practice to bind on all addresses. I cannot actually think of an instance where that is a standard procedure, outside of a badly configured Apache instance.
All Paradox games that support local co-op (EU4, Magicka I/II, and Stellaris just to name a few big ones).
Battlefield 2 local co-op binds to public addresses as well
Warframe II Battle.Net Edition and Warcraft III RoC/tFT.
Aside from Warcraft II/III, all of these games have the option to only host on specific addresses.
Thanks cube for the quick change. Now I can easily have multiple persistent servers for different game versions or mod configurations.