0

Lets take an example:

PC 1 (1.1.1.1)
    |
    |-----  **Router 1** (IP 3.3.3.3) ------------- **Router 2** --- Google Server(8.8.8.8 for eg)
    |
PC 2 (2.2.2.2)

In this scenario, Lets say that both PCs are authenticated to Google and the assigned cookies are Cookie1 and Cookie2 respectively.

So now, both these two PCs open "gmail.com" simultaneously. Now, when the Google server receives the request, the packet Source IP for both packets is 3.3.3.3 (thats what I know).

So when the reply packets are received from the Google server by the Router 1, their destination IP would be same (i.e 3.3.3.3). So how does the router know if the packet is to be sent to PC1 or PC2?

It could send the mails of PC1 to PC2 but it doesn't. How?

1

A TCP connection includes both a source and destination port. The source port IS NOT related to the destination port, and can be (and in the case of NAT is) used to track multiple devices behind NAT, as each will likely have a different source port (and even if it doesn't, the router can rewrite it so as to keep track)

| improve this answer | |
  • And this is only if the router does NAT, which most devices labelled 'routers' provided to residential customers do at least for v4, but routers in general do not. For some enterprises or organizations, or clouds, gmail will see connections from the real client addresses. – dave_thompson_085 Sep 24 '19 at 6:20
  • @dave_Thompson_805 "Source IP for both packets is 3.3.3.3 (thats what I know)" - Certainly not all routers are configured to do NAT. – davidgo Sep 24 '19 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.