-4

Please consider the following scenario,

Let's suppose there are two roommates having the same game installed. For the sake of this question let's assume that the game is DoTA2.

Both the roommates are connected to the same router and thus have the same public IP essentially. (router's IP)

Now, let's assume that someone else on the outside i.e. public internet outside of the router wants to connect to the roommate1, then the router will have a simple port forwarding within the NAT rule that may go like follows,

If the request comes from outside on port ABC(game owned port) forward it to roommate1.

Now, if we assume that the roommate2 is also online in the game and another public computer wants to connect to them, then how would the port forwarding work?

How will the router know which private computer(roommate) the connection request be forwarded to?

Please do not give answers like, DoTA has multiple ports allotted or any game-specific answer, use of DoTA is just an example.

You can even consider a scenario where there are two private computers running a simple HTTP server on port number 80, how would an outside computer know which one to connect?

I have googled DMZ, and port forwarding but do not clearly understand the solution.

Nachiket Joshi
  • 101
  • 2
  • 13

2 Answers2

0

It's kinda rude to tell us on what kind of answers we can give, specially when you have asked an off topic question yourself.

Getting to the answer to your question, port forwarding is done based on the combination of private IP and port; roomate1 and roommate2 have different private IP addresses but using the same port, on your router(assuming it's a generic one) only one forwarding rule can be used at any point.

A possible solution is to use a proxy server like HAProxy after your router on the private network side and use TCP association based policy to forward packets to roomates.

iAmTryingOK
  • 216
  • 1
  • 10
  • There is nothing rude if I am telling you what answers I don't want. Anyways, So basically what you mean is that there is no way in which we can manage this through only one NAT rule but we have to have a different HAProxy or Ingress or a load balancer to manage this? I think I can imagine how this can be solved through the HAProxy. I guess by using CA name and another layer of mapping in the HAProxy we can use both the internal private IPs with same port exposed. – Nachiket Joshi Jul 12 '19 at 21:56
0

In short, NO is not possible. You can only NAT from 1 public address to an internal IP on X port.

In long, companies does this, but they have 2 or 3 public address then you can map to a different internal IP.

Public IP 1 > Internal IP:port
Public IP 2 > Internal IP:port

You can map from an external IP to multiple internal IP addresses but since you are using the same service(game) they probably use the same port or ports.

Vidal
  • 2,605
  • 2
  • 16
  • 32