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 ( needs to access PC3 (, since PC2 has no route to 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 ( so router1 will forward the packets to router3, which will deliver the packets to PC3; reply packets will follow the same route to PC2.

multiple routers

EDIT: removed misuse of NAT.

My understanding of how a TCP/UDP packet would be processed in the example above:

  1. Host 2's default gateway is set to (by default somehow?), and it sends a frame to Router 2's eth1 MAC address (obtained through ARP?). The enclosed packet has source and destination
  2. Router 2's default gateway is, and it sends the packet in a new frame from eth0 to Router 1's eth1 MAC address.
  3. 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).
  4. 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.
  5. 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.
  6. 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:

  1. Host 3 addresses reply packet to Host 2,, sending it first to Router 3.
  2. Router 3 sends to default gateway Router 1.
  3. Router 1 sends to Router 2, the gateway listed for the subnet that exists on.
  4. Router 2 sends to Host 2.
  5. 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?

  • 1
    Where is there any NAT in that diagram? Routing is not dependent on NAT, which should be used only when necessary (private to public, or overlapping, networks).
    – Ron Maupin
    Nov 28, 2018 at 22:57
  • @RonMaupin I think I see the immediate error you're pointing out. The source IP address should never be modified at all in this example, should it? NAT should only apply to packets traveling between the external and anything within the internal subnets, correct?
    – derrick
    Nov 28, 2018 at 23:04
  • NAT would happen on packets originating on the privately addressed networks going out to the public network (if Router 1 has NAT enabled for that. Traffic originating on the public network would not make it into the private network, unless there are NAT table entries (response to outbound packets, or statically configured port forwarding).
    – Ron Maupin
    Nov 28, 2018 at 23:08
  • @RonMaupin I see now. I applied that incorrectly to the entirety of the private network in this scenarios. If I removed all instances of the source IP being modified and port mapping above, would the rest still be correct?
    – derrick
    Nov 28, 2018 at 23:19
  • Well, just edit the question to explain your new understanding so we can make sure we are on the same page.
    – Ron Maupin
    Nov 28, 2018 at 23:20

1 Answer 1


For your question about the hub, consider a hub a powered cable. It simply repeats any signal from one interface to all the other interfaces, and it does not know anything about frames or MAC addresses.

Depending on how Router 1 is configured, it may just send a redirect back to Router 2 to tell it to send the packet to Router 3.

You also seem to have really left out the transport protocol. You did mention TCP and UDP at first, but those sit between the application and IP. TCP and UDP are separate protocols, and IP will see the protocol number in its header, and it will deliver the payload of the IP packet to the correct transport protocol. While TCP and UDP both have addresses (called ports) that are the same number range, they are not the same ports (TCP port 5678 is not UDP port 5678).

The application will open a port with whichever transport protocol is used, and IP will encapsulate that datagram in an IP packet. The data-link protocol (ethernet?) will encapsulate the IP packet inside a data-link frame that gets encoded and signaled on the wire to the host gateway.

The host gateway router will strip off the frame, look up the destination address in its routing table, and create a new frame for the next interface to encapsulate the IP packet. This happens for every router hop, with the final router sending it out the destination network address.

The host will receive the final frame, and look at the Ether Type (or equivalent for whichever protocol it uses). The data-link protocol will send the frame payload (IP packet) to the process indicated in the frame Ether Type (IP). IP will then look at the packet header to see the protocol number, and it will send the packet payload to the correct transport protocol (TCP, UDP, etc.). The transport protocol will then send the datagram payload to the application registered to it (TCP and UDP use ports for this, other transport protocols may do something else).

Replies follow the same path in reverse.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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