Why two jobs?

A router must both learn a good direction and quickly send packets. Routing selects routes and keeps reachability information updated. Forwarding looks up each packet’s destination in local forwarding information and sends it toward the next hop. Routing is planning; forwarding is the individual delivery. A router normally does not need the entire end-to-end path to forward a packet.

The routing information base (RIB) holds routing information and route choices; the forwarding information base (FIB) contains information prepared for fast forwarding. Actual implementations differ, and neighbor resolution can be represented separately. A FIB entry may include the outgoing interface and next-hop link-layer information. See IPv4 Routing Tables and Longest Prefix Matching.

Example: a router has a specific route to 30.3.3.0/24 through 20.2.2.3, plus a default route through 20.2.2.254. A packet to 30.3.3.42 matches both but takes /24 because it is more specific. Its IP destination stays 30.3.3.42; on Ethernet the frame goes to the next hop’s MAC address. The next router makes its own decision. The destination, next-hop IP and next-hop MAC are three different roles.

Costs and choosing routes

A metric expresses preference, often as a cost: lower total cost wins within the relevant algorithm. Depending on the protocol, it may represent hops, configured link costs, or other factors. Fewer hops need not mean lower delay. More elaborate metrics require more measurement and processing; rapidly changing load-based costs can make routes oscillate as traffic shifts. Costs belonging to different protocols may not be directly comparable.

Route selection among candidates for the same prefix is distinct from longest-prefix matching between different prefixes. A more-specific installed route wins the packet lookup even when a less-specific route has a smaller metric.

Failure and convergence

Routers cannot all learn a change instantaneously. After a link fails, some may still use old information while others have updated. Convergence is the process of reaching a consistent, stable routing state; the intervening period is a transient.

  • A black hole drops traffic when the router has no usable path, or sends traffic into a path that cannot deliver it.
  • A routing loop sends a packet around a cycle because the routers’ next-hop decisions disagree. IP TTL (IPv6 Hop Limit) eventually limits the packet’s life, but it consumes resources until then.

Example: B thinks C can reach network D, while C thinks B can reach D. A packet for D bounces B → C → B until TTL expires. Compare IPv4 Route Aggregation and Routing Loops: aggregation can also create a loop, even without a dynamic protocol failure.

Multiple paths

Equal-cost multipath (ECMP) installs multiple equally preferred next hops when supported. A common implementation hashes packet header fields to keep packets of one flow on the same path, reducing reordering; hashing is not guaranteed to balance every flow or handle every failure identically. Per-packet distribution can reorder packets, affecting transport performance. Unequal paths require deliberate policy and support; a faster path is not automatically allocated the ideal proportion of traffic.

Other forwarding methods

Destination-based forwarding uses the destination address and local table; IP commonly uses this model. Label swapping forwards using a locally meaningful label and may replace it at each hop. MPLS can steer groups of packets along established label-switched paths; labels do not necessarily imply a separate setup for every application connection or guaranteed bandwidth. Source routing puts path instructions in the packet, moving more path-selection responsibility toward the source. Real variants can specify only part of a path and face operational and security constraints.

These techniques describe how a packet is directed; routing algorithms or other control mechanisms supply the necessary forwarding information.

Lecture 04 - Forwarding and Routing Algorithms · IPv4 Static Routing Paths and ARP