network-programmingportforwardingdmz

How do port forwarding work in big video games with a lot of traffic?


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.


Solution

  • 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.