The Runtime Theory

Packet Routing Journey: ARP, Longest-Prefix Match, TTL, and Every Hop

Trace one IP packet from the application socket through ARP, the default gateway, longest-prefix-match routing, TTL decrements, and delivery at the destination NIC.

The Runtime Theory Team09 stages

trace / request.md

SOCKET HANDSBYTES TO IPIP HEADER BUILTARP FORTHE GATEWAYETHERNET FRAMEON THE WIREROUTERLOOKS UP FIBTTL DECREMENTED,FORWARDEDMTU HANDLINGFINAL DELIVERYICMP FEEDBACK

readyTCP segments the application's bytes, adds sequence numbers and ports, and hands the stream to the IP layer. IP does not care what is inside — it treats the segment as a payload.

An IP packet is a message in a bottle with an address on it. The sender never knows the full path — it only needs the first hop. From there, each router independently decides the next interface by longest-prefix matching the destination against its forwarding table. That per-hop decision is the entire architecture: no router knows the route, only a route.

Below IP sits the link layer. Packets cannot cross a wire alone — every hop encapsulates the packet in a frame addressed with MACs, and ARP is what translates IP to MAC one hop at a time. The TTL is the machine's anti-loop counter: every router decrements it, and a packet that cycles too long dies instead of circling forever. The journey's ordering matters because each layer trusts the one below: the frame dies at the next hop, the packet survives to the next router, and only the destination ever sees the payload.