After reading various resources and examining the example below, the step-by-step process for a packet to travel the route below is still not 100% clear to me. I'm hoping to get clarification.
Image and description from the Wiki article for Default Gateway:
Accessing internal resources If PC2 (172.16.1.100) needs to access PC3 (192.168.1.100), since PC2 has no route to 192.168.1.100 it will send packets for PC3 to its default gateway (router2). Router2 also has no route to PC3, and it will forward the packets to its default gateway (router1). Router1 has a route for this network (192.168.1.0/24) so router1 will forward the packets to router3, which will deliver the packets to PC3; reply packets will follow the same route to PC2.
EDIT: removed misuse of NAT.
My understanding of how a TCP/UDP packet would be processed in the example above:
- Host 2's default gateway is set to 172.16.1.1 (by default somehow?), and it sends a frame to Router 2's eth1 MAC address (obtained through ARP?). The enclosed packet has source 172.16.1.100:portA and destination 192.168.1.100:portX.
- Router 2's default gateway is 10.1.1.1, and it sends the packet in a new frame from eth0 to Router 1's eth1 MAC address.
- The HUB (layer 2 switch?) simply forwards the packet to Router 1's eth1 (not sure how this device initially maps MAC addresses to physical ports).
- Router 1's routing table has an entry for the subnet containing the destination IP and sends a frame from eth1 to Router 3's eth0 MAC address.
- Router 3's routing table has an entry for the subnet containing the destination IP and sends a frame from eth1 to Host 3's MAC address.
- Host 3's OS delivers the packet to the appropriate process listening on portX.
If a reply is sent back, the process unfolds in reverse. In lesser detail:
- Host 3 addresses reply packet to Host 2, 172.16.1.100:portA, sending it first to Router 3.
- Router 3 sends to default gateway Router 1.
- Router 1 sends to Router 2, the gateway listed for the subnet that 172.16.1.100 exists on.
- Router 2 sends to Host 2.
- Host 2's OS delivers the packet to the original process that opened portA.
What parts am I missing or misunderstanding? Am I mixing ideas or concepts incorrectly? What assumptions have I made about this setup that may not apply to all networks?