This chapter covers the basics of IP forwarding – what a router does when it gets a packet. How does the router make its fowarding decision?
The router receives an inbound frame and checks FCS. If FCS fails, the packets is chucked in the bit bucket.
If the frame is good, the ethernet Type field is checked, and the packet liberated from its frame. The layer 2 info (data link header and trailer) is trashed.
So now we have a packet. If the packet is an IP packet, the router performs a routing table lookup, seeking the most specific route (prefix) it can find matching the destination of the packet.
So now we found where the packet needs to go. The routing table entry includes the interface and next-hop this packet should use for egress. The router uses this information to throw new layer 2 back on the packet.
The router updates the time-to-live field (decrementing by one, prevents routing loops, remember?), and consequently recomputes the IP header checksum.
Finally, the router creates the new frame, specifically, the new Data Link layer information with the destination address, trailer and FCS.