EnemyBagJones
EnemyBagJones

Reputation: 982

Multiple Open TCP/IP Connections from Behind NAT to Same IP and Port

I'm trying to determine how/if it is possible for multiple machines behind NAT to establish unique TCP/IP connections to the same remote IP address if all machines are using the same port. In this case, my understanding is that the 5-tuple used to identify each TCP connection would in effect look the same on the single remote machine - since it's made up of:

  1. protocol
  2. remote IP
  3. remote port
  4. local IP
  5. local port

So in this case, how does the single remote machine differentiate between the connection coming from NAT'd computer A vs. NAT'd computer B if they are both using port 80? I'm assuming this is possible since computers behind NAT are able to simultaneously perform the same action on the same ports without issue... I'm just not seeing how the remote machine properly handles this.

Thanks!

Upvotes: 0

Views: 2509

Answers (2)

Mark Smith
Mark Smith

Reputation: 1115

You should also keep in mind that NAT routers can adjust the IP/Port pairs to avoid conflicts. It's how things are done such as port forwarding. The router will recognize the streams as unique even if they manage to come from the same source port because the source Local IP will be different.

Upvotes: 0

cnicutar
cnicutar

Reputation: 182619

If the machines use different source ports - problem solved. The remote TCP uses that to identify them. If multiple machines use the same source port, the NAT takes care of it and changes it.

Upvotes: 2

Related Questions