Reputation: 926
Very short qustion. Lets say user1 and user2 are connected to the router.
User1 opens mozilla firefox on, lets say, port 12000. User2 opens mozilla firefox on port 12001.
Lets say both users load up page www.google.com
When router will send packets to the google, what kind of an adress google will see from user1 and user2? Will it be something like 123.123.123.123:7777 for both users OR will it be something like 123.123.123.123:12000 for user1 and 123.123.123.123:12001 for user2?
Upvotes: 0
Views: 441
Reputation: 151700
User1 opens mozilla firefox on, lets say, port 12000.
This isn't how it works.
Any client connecting to any server will get an ephemeral port assigned by its OS. So the connection goes from 192.168.0.5:12000 (12000 being the ephemeral port, i.e. random) to 123.123.123.123:7777.
The second client, connecting from a different IP, will use the combination 192.168.0.6:12001 (or really, any other port, it can even also be 12000) to 123.123.123.123:7777.
The router saves these combinations of IP's and ports to perform NAT. While performing NAT, the router will use the external address and probably even a different ephemeral (source) port to connect to the destination.
Upvotes: 1