Imagine a home network of several computers connected via router to an ISP.

Computer A wants to request a webpage from a remote website, The address is not in its ARP cache, so it consults its routing table and finds a match in the form of the default gateway (the router). It sends the packet to the router with the router's MAC. I know that when the router receives the outgoing request, it must do some enveloping and address re-writing, but I don't know the details.

When the response comes back to the router from the, how does the router know that the inbound packet should be forwarded to Computer A? In other words, what does the router put in the request to that will include in its response so that the router can determine that the response should go to A? Is it A's MAC address? Or is it A's subnet IP? My guess is the later (A's subnet IP). Is A's LAN address enveloped in the inbound packet? My guess (hope) is that A's MAC address is never seen by anyone on the other side of the router.

I know the router is receiving in-bound web responses all the time and doling them out to the correct local nodes. Is it doing this with enveloped MACs or enveloped LAN IP's, or with some other technique?


1 Answer 1


It works precisely the same way end systems do it. When your browser makes two connections to a web server, the destination IP address and destination port are the same. The system, whether router doing NAT or end node, assigns each connection a distinct local source port address. Replies are distinguished by the destination port address in the reply which corresponds to the source port address in the outbound packets.

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