Routing
The process of selecting paths and forwarding IP packets between networks until they reach the destination.
Routing is how an IP packet gets from a source network to a destination network across the intermediate links that connect them. Every router along the way examines the packet's destination IP address, looks it up in a routing table, and forwards the packet out the interface that leads to the next hop. The packet hops from router to router this way until it reaches a device on the destination subnet, where the local link layer delivers it to the host.
A routing table is a list of destination prefixes paired with a next-hop address and outgoing interface. When more than one entry matches, the router picks the longest matching prefix — the most specific route wins. Routes can be installed statically by an operator (ip route on most platforms) or learned dynamically from a routing protocol. Static routing is simple and predictable but does not react to failures; dynamic routing protocols exchange reachability information so that paths adjust automatically when a link or peer goes down.
Inside a single network, interior gateway protocols like OSPF and IS-IS distribute routes between an organisation's own routers. Between networks, the Internet runs on BGP, the exterior gateway protocol that lets each autonomous system announce which prefixes it can reach and learn the same from its neighbours. BGP path selection takes into account local policy, AS-path length, and the commercial relationships expressed through transit and peering agreements rather than just raw distance.
A quick way to see routing in practice is a traceroute: each line shows a router that forwarded the packet on its way to the destination, revealing the path chosen at that moment. The path can change over time as protocols converge around failures or policy changes, which is normal Internet behaviour rather than a fault.
Key Points
- Forwards packets hop by hop based on the destination IP
- Each router consults a routing table and picks the longest matching prefix
- Static routes are manual; dynamic protocols react to topology changes
- OSPF and IS-IS run inside a network; BGP runs between networks
- BGP path selection reflects policy, AS-path and commercial relationships
- Traceroute exposes the current path one hop at a time