Loading learning content...
When you send an email from New York to Tokyo, click a link to a website hosted in Frankfurt, or stream a video from a server in Singapore, your data doesn't magically teleport. Instead, it embarks on a journey—hopping across dozens of intermediate networks, traversing undersea cables, satellite links, and fiber optic highways, navigating through congestion and failures, all to arrive at its destination typically within milliseconds.
This remarkable journey is orchestrated by routing—the process by which network devices determine the optimal path for data to travel from source to destination. Routing is to the Internet what air traffic control is to aviation, what GPS navigation is to driving—but operating at a scale and speed that dwarfs both combined.
Every second, the global Internet processes billions of routing decisions. Each packet you send triggers a cascade of independent choices by routers along the way, each making split-second determinations about where to send your data next. Understanding routing is understanding the fundamental mechanism that makes global connectivity possible.
By the end of this page, you will understand exactly what routing is, why it's necessary, how it differs from forwarding, and the fundamental principles that govern how routers make path decisions. You'll grasp the conceptual foundation that underlies all routing protocols and algorithms.
Routing is the process of selecting a path for traffic in a network or between networks. More precisely, it is the mechanism by which routers determine the next destination for each packet, ultimately guiding data from its origin to its final destination across potentially many intermediate networks.
The Formal Definition
Routing is the process by which a router examines the destination address of an incoming packet, consults its routing information base, and determines the optimal outgoing interface and next-hop address for forwarding that packet toward its destination.
This definition contains several critical elements:
Think of routing like the postal service. When you mail a letter from Los Angeles to a small town in Germany, it doesn't go directly there. Your local post office routes it to a regional hub, which routes it to a national hub, which routes it to an international hub, which routes it to Germany's national hub, then regional, then local, then to the recipient's mailbox. Each 'hub' makes an independent routing decision based on the destination address, just like routers do.
Why Routing Exists
Routing exists because of a fundamental reality of large-scale networks: no single device can maintain a direct connection to every other device.
Consider the scale:
Maintaining direct point-to-point connections between all possible endpoints would be impossible. Instead, we build networks hierarchically, with specialized devices (routers) connecting different network segments and making intelligent decisions about how to forward traffic between them.
| Scenario | Endpoints | Required Connections (Full Mesh) | Reality |
|---|---|---|---|
| Small Office | 50 computers | 1,225 direct links | One router/switch |
| Enterprise | 10,000 devices | ~50 million direct links | Hierarchical routing |
| ISP Network | 1 million customers | ~500 billion direct links | Tiered routing infrastructure |
| Global Internet | Billions of devices | Incomprehensibly large | Distributed routing system |
One of the most important conceptual distinctions in networking is between routing and forwarding. While often used interchangeably in casual conversation, they represent fundamentally different operations occurring at different timescales and involving different mechanisms.
Routing (Control Plane)
Routing is the process of building and maintaining routing tables. It involves:
Routing operates on a timescale of seconds to minutes. When a link fails, routing protocols detect this and reconverge—a process that might take anywhere from sub-second (with fast failover) to several minutes (in complex scenarios).
Forwarding (Data Plane)
Forwarding is the act of moving packets from input to output. It involves:
Forwarding operates on a timescale of nanoseconds to microseconds. A modern router might forward hundreds of millions of packets per second.
The Relationship
Think of it this way:
Routing is like planning a road trip—studying maps, choosing which highways to take, deciding on detours for construction. You do this once before (and occasionally during) your journey.
Forwarding is like driving through an intersection—checking the road sign, turning the wheel, proceeding. You do this constantly, at every decision point.
┌─────────────────────────────────────────────────────────────────┐
│ ROUTER ARCHITECTURE │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ CONTROL PLANE (Routing) │ │
│ │ │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────────────┐ │ │
│ │ │ Routing │ │ Routing │ │ Routing │ │ │
│ │ │ Protocols│──│Algorithm │──│ Table │ │ │
│ │ │(OSPF,BGP)│ │(Dijkstra)│ │ (RIB) │ │ │
│ │ └──────────┘ └──────────┘ └────────┬─────────┘ │ │
│ │ │ │ │
│ └────────────────────────────────────────┼───────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ DATA PLANE (Forwarding) │ │
│ │ │ │
│ │ ┌──────────┐ ┌──────────────────┐ ┌──────────┐ │ │
│ │ │ Input │ │ Forwarding │ │ Output │ │ │
│ │ │Interface │──│ Table (FIB) │──│Interface │ │ │
│ │ │ │ │ (Hardware ASIC) │ │ │ │ │
│ │ └──────────┘ └──────────────────┘ └──────────┘ │ │
│ │ │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
This architectural separation is fundamental to modern router design and enables both high-performance forwarding and sophisticated routing logic.
The Routing Information Base (RIB) is the comprehensive routing table maintained by the control plane, potentially containing multiple paths to each destination. The Forwarding Information Base (FIB) is an optimized, hardware-accelerated version containing only the best paths, used for actual packet forwarding. The control plane populates the FIB from the RIB.
When a router receives a packet, it must make a routing decision. This process, while conceptually simple, involves several sophisticated steps that network engineers must deeply understand.
Step-by-Step Routing Decision
Longest Prefix Matching
The most critical step is the forwarding table lookup. Routers use longest prefix matching (LPM) to find the most specific route for a destination.
Consider a router with these forwarding table entries:
| Prefix | Next-Hop | Interface |
|---|---|---|
| 0.0.0.0/0 | 10.0.0.1 | eth0 |
| 10.0.0.0/8 | 10.1.1.1 | eth1 |
| 10.20.0.0/16 | 10.2.2.2 | eth2 |
| 10.20.30.0/24 | 10.3.3.3 | eth3 |
| 10.20.30.128/25 | 10.4.4.4 | eth4 |
Now, for a packet destined for 10.20.30.200:
The router selects 10.20.30.128/25 because it has the longest matching prefix (25 bits). The packet is forwarded to 10.4.4.4 via eth4.
Longest prefix matching ensures traffic is routed as specifically as possible. A /24 entry for a particular customer's network should take precedence over a /8 summary for the entire ISP block. This enables hierarchical addressing while allowing exceptions for specific destinations.
What If No Match Is Found?
If no routing table entry matches the destination address:
The default route acts as the "route of last resort"—if the router doesn't know a specific path to the destination, it forwards the packet to a router that might know better. This is how most end-user traffic reaches the Internet: local routers have specific routes for local networks and a default route pointing toward their ISP.
A fundamental distinction in routing is between direct delivery and indirect delivery. Understanding this distinction clarifies how packets ultimately reach their destinations.
Direct Delivery
Direct delivery occurs when the destination host is on the same network segment as the sender. No router is needed—the packet is delivered directly at the link layer.
How a host determines direct delivery:
Example:
Indirect Delivery
Indirect delivery occurs when the destination is on a different network. The sending host must transmit the packet to a router (typically its default gateway), which then makes routing decisions to move the packet closer to the destination.
How indirect delivery works:
Example:
Here's a crucial insight: during indirect delivery, the Layer 3 (IP) source and destination addresses remain unchanged throughout the entire journey. Only the Layer 2 (MAC) addresses change at each hop. The MAC address always reflects the immediate next-hop, while the IP address reflects the ultimate endpoints.
The global Internet is too vast for a single routing system. Instead, it's organized into Autonomous Systems (AS)—independent routing domains, each under single administrative control.
What is an Autonomous System?
An Autonomous System is a connected group of IP networks under the control of one or more operators that has a single, clearly defined external routing policy. In practical terms:
Each AS is identified by a unique Autonomous System Number (ASN). Originally 16-bit (allowing 65,536 ASNs), now 32-bit (allowing over 4 billion).
| ASN | Organization | Role | Approximate Size |
|---|---|---|---|
| AS3356 | Lumen (Level3) | Tier 1 ISP | ~1.5 million prefixes carried |
| AS15169 | Content provider | Major global presence | |
| AS32934 | Facebook/Meta | Content provider | Global CDN |
| AS16509 | Amazon AWS | Cloud provider | Millions of customers |
| AS8075 | Microsoft | Cloud/Content | Azure + O365 + Xbox |
| AS7018 | AT&T | Tier 1 ISP | Major US carrier |
| AS4134 | China Telecom | State carrier | Largest by users |
Interior vs. Exterior Routing
The AS structure creates a natural hierarchy for routing:
Interior Gateway Protocols (IGPs)
Routing within an AS. The administrator has full control, can optimize for their specific needs, and trusts all routers in the domain.
Exterior Gateway Protocols (EGPs)
Routing between ASes. Involves negotiation between different organizations, policy considerations, and commercial relationships.
IGPs can assume a trusted environment and focus purely on finding optimal paths. BGP must handle policy, security, and the reality that neighboring networks might have conflicting interests. An ISP might prefer an expensive direct path over a cheaper path through a competitor. These policy considerations don't exist within a single organization.
The Internet's Hierarchical Structure
┌───────────────────────────────────────────────────────────────────────┐
│ TIER 1 ISPs (Global Backbone) │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ Lumen │════│ NTT │════│ Cogent │════│ GTT │ │
│ │ AS3356 │ │ AS2914 │ │ AS174 │ │ AS3257 │ │
│ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ │
│ │ │ │ │ │
│ └──────────────┼──────────────┼──────────────┘ │
│ │ │ │
│ ════════════════════╪══════════════╪════════════════════ │
│ │ │ │
│ TIER 2 ISPs (Regional) │ │
│ ┌─────────┐ ┌────┴────┐ ┌────┴────┐ │
│ │Regional │ │Regional │ │Regional │ │
│ │ ISP A │ │ ISP B │ │ ISP C │ │
│ └────┬────┘ └────┬────┘ └────┬────┘ │
│ │ │ │ │
│ ═════╪══════════════╪══════════════╪═════════════ │
│ │ │ │ │
│ TIER 3 ISPs (Local) / Enterprise / Content │
│ ┌────┴────┐ ┌────┴────┐ ┌────┴────┐ ┌─────────┐ │
│ │ Local │ │Enterprise│ │University│ │ Content │ │
│ │ ISP │ │ Network │ │ Network │ │Provider │ │
│ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │
│ │
└───────────────────────────────────────────────────────────────────────┘
Routing within each box: IGP (OSPF, IS-IS)
Routing between boxes: EGP (BGP)
Routers don't inherently know how to reach every destination. They must learn about networks, and this learning happens through several mechanisms.
How Routes Enter a Routing Table
There are three primary ways a router learns about routes:
| Source | Configuration | Adaptability | Overhead | Use Case |
|---|---|---|---|---|
| Connected | Automatic | N/A (always valid) | None | Local interfaces |
| Static | Manual | None (requires manual update) | Minimal | Small networks, specific overrides |
| Dynamic (IGP) | Protocol config | Automatic reconvergence | Moderate | Enterprise, ISP internal |
| Dynamic (EGP) | Complex policy | Automatic + policy-based | Higher | Internet interconnection |
Administrative Distance
When a router learns about the same destination from multiple sources, it must decide which to trust. This is determined by Administrative Distance (AD)—a measure of the trustworthiness of a routing information source.
Lower AD = More trusted. If the same prefix is learned via both OSPF and BGP, the OSPF route is preferred because OSPF has a lower AD.
| Route Source | Administrative Distance |
|---|---|
| Connected | 0 |
| Static | 1 |
| EIGRP Summary | 5 |
| External BGP (eBGP) | 20 |
| EIGRP Internal | 90 |
| OSPF | 110 |
| IS-IS | 115 |
| RIP | 120 |
| External EIGRP | 170 |
| Internal BGP (iBGP) | 200 |
| Unknown | 255 (unusable) |
This hierarchy reflects practical trust levels—you trust what you configured directly (connected, static) most, then interior protocols (managed within your organization), then exterior protocols (involving other organizations).
Administrative Distance is used to compare routes from different routing sources. Metrics are used to compare routes from the same routing source. AD determines 'which protocol's route wins.' Metrics determine 'which specific path from that protocol wins.'
What makes a routing system 'good'? Network architects evaluate routing designs against several key properties.
Desirable Routing Properties
Trade-offs in Routing Design
These properties often conflict:
Optimality vs. Stability
The absolutely optimal path might change frequently as network conditions fluctuate. Constantly chasing optimality creates instability. Most routing protocols use dampening mechanisms to avoid hyperreactivity.
Simplicity vs. Optimality
Simple routing (like static routes) is easy to understand but suboptimal. Sophisticated routing (like link-state protocols with traffic engineering) achieves better paths but adds complexity.
Robustness vs. Efficiency
Robust routing requires redundancy—multiple paths, frequent hello messages, state synchronization. This consumes bandwidth and processing resources that could otherwise carry data.
Speed vs. Accuracy
Routers can make fast decisions with incomplete information, or slower decisions with more verification. Fast reconvergence after failures is valuable, but hasty routing can install suboptimal or incorrect routes.
Good network engineering is about consciously choosing trade-offs appropriate for your environment. A stock exchange network might prioritize stability and low latency over bandwidth optimization. A content delivery network might prioritize bandwidth and cost over strict optimality. There's no universal 'best' routing—only 'best for this situation.'
We've established the foundational understanding of what routing is and why it matters. Let's consolidate these concepts:
What's Next
With the conceptual foundation in place, we'll next examine the routing table in detail—the data structure that stores routing decisions and enables routers to make split-second forwarding choices. Understanding routing table structure is essential for troubleshooting, optimization, and protocol comparison.
You now understand what routing is, how it works conceptually, and why it's structured the way it is. This foundation prepares you to dive deeper into routing tables, examining their structure, contents, and the algorithms that populate them.