network-programmingserver-administration

How does data get through a router if there is no portforwarding set on the router


more over how does the router distinguish each packet between the multiple connected users. Why does the router just not ignore all request.


Solution

  • Most home routes use one-to-many NAT. That means that the router associates a local IP address and a port to a port in the router and forwards tha packets through there.

    This image explains it:

    A router performing one-to-many NAT

    When the server responds to the client, it will send packets to 145.12.131.7, 6282 and the router will forward them to 192.168.100.3, 3855.