[0.11.13] Connecting to MP game from same IP doesn't work

Bugs that are actually features.
thul
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue Jan 20, 2015 11:28 am
Contact:

Re: [0.11.13] Connecting to MP game from same IP doesn't wor

Post by thul »

This is part of the log that is about connecting to the server where my friend is already connected.

My friend has the exact same error(s) when im already connected. If you need both full log files (or update to date ones) let me know.
factorio-current.log

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

Re: [0.11.13] Connecting to MP game from same IP doesn't wor

Post by DaveMcW »

thul wrote:My friend has the exact same error(s) when im already connected.
If your ports are exactly the same, that's the problem!

rorror
Fast Inserter
Fast Inserter
Posts: 241
Joined: Fri Nov 21, 2014 9:02 pm
Contact:

Re: [0.11.13] Connecting to MP game from same IP doesn't wor

Post by rorror »

Connecting trough nat, from your inside to your extern ip adres, will never work.
you can't NAT from inside, to oudsite, and back to inside trough an open port on your WAN IP, to connect to a device in your internal network.

if your in the same LAN, you should always connect on the internal ip adres of the server. (the ip, tat you gave up, to open the port in your firewall)

in buisness practice we resolve the issue, by manuplicating dns entry's to resolve for example, factorio.youromain.com from the internal network to 10.0.0.1 and when you acces that domain from external (from internet) you get back the public ip adress (wan) of your router, and be able to connect to the server on both ways.

but what you want only possible by connection on the internal ip.

Cloner
Fast Inserter
Fast Inserter
Posts: 100
Joined: Tue Dec 09, 2014 12:59 pm
Contact:

Re: [0.11.13] Connecting to MP game from same IP doesn't wor

Post by Cloner »

rorror wrote:Connecting trough nat, from your inside to your extern ip adres, will never work.
Of course it will, just need to setup port forwarding on router.

rorror
Fast Inserter
Fast Inserter
Posts: 241
Joined: Fri Nov 21, 2014 9:02 pm
Contact:

Re: [0.11.13] Connecting to MP game from same IP doesn't wor

Post by rorror »

Cloner wrote:
rorror wrote:Connecting trough nat, from your inside to your extern ip adres, will never work.
Of course it will, just need to setup port forwarding on router.
It won't work from inside your LAN. It will only work from the rest of the Internet. Here's why:

You try to reach your public IP address from a LAN machine.

1 The machine sees that the address is outside the LAN and sends the packet to the router.

2 The router NATs the destination to the LAN machine, but the source address is unmodified (still the LAN machine that originated the request).

3 Your server receives the request and sends a response to the source of the connection (still the LAN machine).

4 The LAN machine receives a response from the server, but it was expecting a response from the router (since it connected to the public IP address, it must get a response from the public IP address, not the server's LAN address). Since the reply has the wrong source address, it is not accepted. Oops.

Port forwarding (rewriting the destination address) only works from the outside to the inside, not from the inside to the inside. For that, you need hairpin NAT which rewrites the destination address in addition to the source. And something like this, is not possible on normal cheap consumer routers/firewalls that you buy in stores for normal prices.




The total issue, is that, it is not a game bug, but a network infrastructure flaw of nat {when you use in on one network, and connect to your own public ip adress)

thul
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue Jan 20, 2015 11:28 am
Contact:

Re: [0.11.13] Connecting to MP game from same IP doesn't wor

Post by thul »

The server is located externally, hosted on a dedicated server. It is not on our local LAN at work.

Most likely would be that we both get assigned the same port? Which is odd, cause i would imagine the server would keep track of which ports are available.

It almost seems like the server thinks the second player connecting is actually the first player.

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

Re: [0.11.13] Connecting to MP game from same IP doesn't wor

Post by DaveMcW »

The server doesn't assign ports, YOU assign ports.

Look in config.ini and change one of them.

User avatar
cube
Former Staff
Former Staff
Posts: 1111
Joined: Tue Mar 05, 2013 8:14 pm
Contact:

Re: [0.11.13] Connecting to MP game from same IP doesn't wor

Post by cube »

Just to be sure: your situation looks like this:?

Code: Select all

               / --- A
Server ---- NAT
               \ --- B
A connects to Server and it works, B connects to server and gets dropped?

If yes, then A and B need to communicate with each other not using their private addresses, but using the external address:port that gets assigned by the router. This is called NAT loopback and theoretically it should work. At least all routers that I've tried so far can do this.

But the log file says that A and B cannot comunicate (in the VerifyingConnection state we try to communicate with all peers in game to check for exactly this kind of problems), so I would guess that your router is different :-)

I don't know how much you want to play with it and how much control you have over the router. It could be something configurable, it could be a feature that gets added in next firmware update, ...
It should be possible to verify what the router does running wireshark both on A and Server and trying to send an udp packet using netcat from A to server and then from A to A using the external address, if you are into these sort of things :-)

thul
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue Jan 20, 2015 11:28 am
Contact:

Re: [0.11.13] Connecting to MP game from same IP doesn't wor

Post by thul »

The situation describes is exactly how it is yes. Unfortunately we have 0 control over the router and we have no idea what kind of router it is either.

We might be able to do a packet dump on the server, but we'd need something else than wireshark. Server has no X11 installed on it :) We will try to figure something out.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: [0.11.13] Connecting to MP game from same IP doesn't wor

Post by ssilk »

Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Cloner
Fast Inserter
Fast Inserter
Posts: 100
Joined: Tue Dec 09, 2014 12:59 pm
Contact:

Re: [0.11.13] Connecting to MP game from same IP doesn't wor

Post by Cloner »

thul wrote:The situation describes is exactly how it is yes. Unfortunately we have 0 control over the router and we have no idea what kind of router it is either.
NAT loopback is disabled by default on most routers, and without it the Lan machines cannon connect to each other by public IP.

By the way, I think you can fool the system by rerouting IPs via hosts file on windows PCs.

For example lets assume that:

Server IP 1.1.1.1
Clients A external IP 2.2.2.2:34197
Clients B external IP 2.2.2.2:34198
Clients A LAN IP 192.168.0.1
Clients B LAN IP 192.168.0.2

Try to add the following to hosts file of client A
2.2.2.2 192.168.0.2
and the following on hosts of client B
2.2.2.2 192.168.0.1

This way when Client A tries to connect to 2.2.2.2:34198 - it will in reality connect to 192.168.0.2 even without NAT loopback.

User avatar
cube
Former Staff
Former Staff
Posts: 1111
Joined: Tue Mar 05, 2013 8:14 pm
Contact:

Re: [0.11.13] Connecting to MP game from same IP doesn't wor

Post by cube »

... i think in the end this is not a bug, but rather a limitation of the current networking. I'll move this thread to Not a bug to help kovarex in reaching his dream of zero opened bugs, but i'll be keeping this in mind for later changes of networking code. Meanwhile you can try some kind of VPN, Hamachi maybe? (does it even work on linux?)

Post Reply

Return to “Not a bug”