0

When we send e.g. HTTP request to server A, how can it know where to send the response? While routing, a packet goes through multiple routers - and every router transfers it to the next router with own IP as source. So the source IP (of original request initiator) is lost.

I guess my above understading is wrong, but what's wrong there?

Maybe packets from network layer are nested? I mean that the original IP packet is a data field in packet that transfers packet to the next router?

How it works?

Szyszka947
  • 135
  • 1
  • 4

1 Answers1

3

A router does not transfer IP packets with its own IP address as source. It keeps the original source IP address, so it is not lost.

A corner case is routers with network address translation (NAT). They do indeed replace the original source IP address with their own. They have to register a bidirectional mapping (original source IP address, original source port) <-> (rewritten source IP address, rewritten source port) so they can rewrite response packets and subsequent packets.