Cannot use external ip address when starting server

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
avaness
Manual Inserter
Manual Inserter
Posts: 1
Joined: Tue May 23, 2017 7:47 pm
Contact:

Cannot use external ip address when starting server

Post by avaness »

To start, it is important to understand why I would want to do this. I am hosting a home server, I have been for many months now, and this is the first kind of server that has given me any significant trouble. Since I am hosting at home, I need to use a ddns as my ip adress when I am hosting servers. If I don't, after about a day or so my ip changes and anything thats using my public ip instead of the ddns ip gets disconnected. According to this website, I can do this by adding on --bind "iphere" in the server batch startup file. However when I do this I get the error message "Binding IPv4 socket failed: The requested address is not valid in its context." and startup fails. I tried my public ip too and it still fails. Anything besides 0.0.0.0 (or nothing at all) causes startup to fail and that same error to appear in the console.
More info

Bikkies
Manual Inserter
Manual Inserter
Posts: 1
Joined: Mon Jul 03, 2017 11:08 pm
Contact:

Re: Cannot use external ip address when starting server

Post by Bikkies »

I have the same issue and am getting the exact same error.

I have a domain name that points to my IP. Doesn't matter if I use domain name or IP in the --bind setting, I get that error. I can connect to my server over LAN, but over the internet with either my IP or domain name I can't. If I don't put a --bind in my server shows up in the public list, but when trying to connect from there it gives an error about trying to connect to 0.0.0.0:34197.

I have a bunch of other game servers running in VMs with their correct ports all forwarded to the right place and they all work fine, but Factorio seems to be the only one that doesn't want to play nice.

Edit: After reading a bunch more things, it seems that it might not be needed to bind to a specific IP or domain name. And my issue might actually be coming from the fact that the message I get back for "Own address is" actually has a different port than 34197 for some reason. I've done everything I can to make sure UDP 34197 is open and being forwarded correctly everywhere but the own address always returns a different port. I'm not sure where it's getting changed down the line, whether it's in my Ubuntu VM, on the windows PC that the VM is on, or in my router. Or maybe own address is supposed to return a different port number? I'm not 100% sure right now.

EDIT 2: FIXED
It was 100% because I was running my VM with a NAT network and port forwarding through that. Seems as though sitting behind a NAT network likes to randomise the UDP ports, even if you forward a specific one through. Fixed by switching to a bridged adapter, made the VM part of my local network, gave it a static IP, did the port forwarding on my router to that IP, problem solved. No --bind needed, the server is accessible on the list and through a direct connection to my domain name.

AlienX
Fast Inserter
Fast Inserter
Posts: 103
Joined: Wed May 17, 2017 7:13 pm
Contact:

Re: Cannot use external ip address when starting server

Post by AlienX »

Just as a technical note here:
This is nothing to do with Factorio, it's just how Sockets work.

Long story short: You are not able to bind a port to an IP Address which does not exist on the local machine, nor can you bind to a DNS name.

You must bind the server to your local IP Address, or to ALL using 0.0.0.0 then port forward (either via DNAT or Generic Proxy) on your router.

User avatar
unfunf22
Inserter
Inserter
Posts: 31
Joined: Fri May 20, 2016 9:00 pm
Contact:

Re: Cannot use external ip address when starting server

Post by unfunf22 »

AlienX wrote:Just as a technical note here:
This is nothing to do with Factorio, it's just how Sockets work.

Long story short: You are not able to bind a port to an IP Address which does not exist on the local machine, nor can you bind to a DNS name.

You must bind the server to your local IP Address, or to ALL using 0.0.0.0 then port forward (either via DNAT or Generic Proxy) on your router.
can you give me an example how i write this? because i need the --bind command.
I do not see him and can not play with others.

Post Reply

Return to “Technical Help”