Loading content...
Imagine you're a postal worker in a massive city. Every day, millions of letters arrive, each with a different destination address. You don't memorize the path to every house—instead, you consult a reference that maps address ranges to delivery routes and next-stop sorting facilities.
A router faces a similar challenge, and its solution is the routing table—a comprehensive database that maps network destinations to the paths that can reach them. The routing table is the brain of the router, the repository where all routing knowledge is stored and organized for decision-making.
By the end of this page, you will understand the complete structure of routing tables, how entries are added and removed, the route selection process when multiple paths exist, and the critical distinction between the Routing Information Base (RIB) and Forwarding Information Base (FIB).
A routing table (also called a Routing Information Base or RIB) is a data structure stored in a router that contains the routes to particular network destinations. It serves as the authoritative source of routing knowledge for the router.
Formal Definition:
A routing table is a database that maps destination network prefixes to routing information including the next-hop address, outgoing interface, metric, and attributes sufficient to determine the best path to each destination.
The routing table is populated by three sources:
| Field | Description | Example |
|---|---|---|
| Destination Prefix | Network address and mask identifying the destination | 192.168.1.0/24 |
| Next-Hop Address | IP address of the next router on the path | 10.0.0.2 |
| Outgoing Interface | Local interface through which to send packets | GigabitEthernet0/1 |
| Metric | Cost associated with this route (lower is better) | 10 (OSPF cost) |
| Route Source | How the route was learned | OSPF, Static, Connected |
| Administrative Distance | Trustworthiness of the route source | 110 (OSPF) |
| Age/Timestamp | When the route was last updated | 00:05:32 ago |
| Route Attributes | Additional protocol-specific information | BGP AS-Path, OSPF LSA type |
The routing table (RIB) is a comprehensive policy and control database. The forwarding table (FIB) is an optimized subset used for actual packet forwarding. Routers derive the FIB from the RIB but maintain them separately.
A complete routing table entry contains all the information necessary to make routing decisions. Let's examine each component in detail:
Destination Prefix: The network address and subnet mask (or prefix length) that this entry covers. This is the primary lookup key. Examples:
10.0.0.0/8 — All addresses from 10.0.0.0 to 10.255.255.255192.168.1.0/24 — Addresses from 192.168.1.0 to 192.168.1.2550.0.0.0/0 — The default route, matches any addressNext-Hop Address: The IP address of the next router that should receive packets destined for this prefix. For directly connected networks, this may be marked as 'connected' or 'directly attached' rather than specifying an IP.
Outgoing Interface: The local interface (physical or logical) through which packets should be sent. Even with a next-hop IP, the router needs to know which interface connects to that next-hop.
1234567891011121314
Router# show ip routeCodes: C - connected, S - static, R - RIP, O - OSPF, B - BGP i - IS-IS, * - candidate default Gateway of last resort is 10.0.0.1 to network 0.0.0.0 10.0.0.0/8 is variably subnetted, 3 subnets, 2 masksC 10.0.0.0/24 is directly connected, GigabitEthernet0/0O 10.1.0.0/16 [110/20] via 10.0.0.2, 00:05:32, GigabitEthernet0/0 O 10.2.5.0/24 [110/30] via 10.0.0.3, 00:03:15, GigabitEthernet0/1 172.16.0.0/16 is variably subnetted, 2 subnetsB 172.16.0.0/12 [20/0] via 192.168.1.1, 00:10:45S 172.16.100.0/24 [1/0] via 10.0.0.5S* 0.0.0.0/0 [1/0] via 10.0.0.1Understanding the Output:
When a router learns multiple routes to the same destination from different sources, it must select which route to install in the routing table and ultimately use for forwarding. This selection follows a strict hierarchy:
Step 1: Longest Prefix Match First, consider only routes that match the destination. More specific prefixes (longer masks) take priority over less specific ones.
Step 2: Administrative Distance (AD) Among routes from different sources for the same prefix, prefer the source with the lowest Administrative Distance. This measures 'trust' in the routing source.
Step 3: Metric Comparison Among routes from the same source for the same prefix, prefer the route with the lowest metric. Metrics are protocol-specific (hop count for RIP, cost for OSPF).
Step 4: Load Balancing (ECMP) If multiple routes have equal AD and equal metric, the router may install all of them for Equal-Cost Multi-Path (ECMP) load balancing.
| Route Source | Administrative Distance | Rationale |
|---|---|---|
| Directly Connected | 0 | Direct connection—cannot be more trustworthy |
| Static Route | 1 | Administrator explicitly configured; assumed correct |
| EIGRP Summary | 5 | Internal EIGRP summarization |
| eBGP | 20 | External BGP from other autonomous systems |
| EIGRP (internal) | 90 | Enhanced Interior Gateway Routing Protocol |
| IGRP | 100 | Interior Gateway Routing Protocol (legacy) |
| OSPF | 110 | Open Shortest Path First |
| IS-IS | 115 | Intermediate System to Intermediate System |
| RIP | 120 | Routing Information Protocol |
| EGP | 140 | Exterior Gateway Protocol (obsolete) |
| ODR | 160 | On-Demand Routing |
| iBGP | 200 | Internal BGP (within same AS) |
| Unknown | 255 | Route will not be used (administratively down) |
Administrative Distance is used when the SAME prefix is learned from DIFFERENT sources. If you have a /24 from OSPF and a /16 from RIP for overlapping address space, the /24 wins regardless of AD because it's more specific (longest prefix match).
Routes in the routing table have a lifecycle—they're installed, maintained, and eventually removed. Understanding this lifecycle is crucial for troubleshooting routing issues.
Route Installation:
Connected routes are installed immediately when an interface is configured with an IP address and comes up operationally.
Static routes are installed when configured, provided the next-hop is reachable and the outgoing interface is up.
Dynamic routes are installed when received from routing protocols, passing validity checks (no loops, valid metrics, not filtered by policy).
Route Maintenance:
Dynamic routes require ongoing maintenance:
Static routes can be configured to track an IP SLA probe or interface state. If the tracked object fails, the static route is removed. 'Floating static routes' use high AD values so they only install if dynamic routes fail—providing backup paths.
Modern routers maintain two distinct tables for routing information. Understanding this separation is fundamental to grasping how routers actually work:
Routing Information Base (RIB): The RIB is the control plane's master routing database. It contains:
Forwarding Information Base (FIB): The FIB is the data plane's lookup table. It contains:
When the RIB changes (route added/removed), the FIB must be updated. This FIB 'push' or 'download' takes time—during convergence, RIB and FIB may temporarily be inconsistent. Minimizing this window is a key router design goal.
The Internet's routing table has grown dramatically over decades. In 1989, there were approximately 5,000 routes. Today, the global BGP table exceeds 950,000 IPv4 prefixes and 200,000 IPv6 prefixes. This growth presents significant challenges:
Memory Requirements: Each routing table entry consumes memory. With nearly a million entries and overhead for data structures, the RIB alone can require several gigabytes. The FIB, stored in expensive TCAM or SRAM, is even more constrained.
CPU Requirements: Every route update requires processing—recalculating best paths, updating data structures, synchronizing FIBs. During convergence events, routers may process thousands of updates per second.
Convergence Time: More routes mean longer SPF calculations (for link-state protocols) and more updates to propagate (for distance-vector). Large routing tables slow network convergence after failures.
| Year | Approx. IPv4 Prefixes | Notable Events |
|---|---|---|
| 1989 | ~5,000 | Early Internet, classful addressing |
| 1995 | ~35,000 | CIDR introduced (RFC 1517-1520) |
| 2000 | ~80,000 | Dot-com boom, rapid growth |
| 2010 | ~340,000 | Mobile Internet expansion |
| 2015 | ~580,000 | Cloud computing, IoT beginnings |
| 2020 | ~850,000 | Continued deaggregation, IPv4 exhaustion |
| 2024 | ~950,000+ | Multi-homing, traffic engineering |
Scalability Techniques:
Route Aggregation: Summarize multiple specific prefixes into a single aggregate (supernet). Reduces table size at the cost of path optimality.
Route Filtering: Don't accept routes you don't need. Edge networks can use default routes instead of the full BGP table.
Hierarchical Routing: Divide networks into areas (OSPF) or tiers. Routers only need full knowledge of their area.
Hardware Advances: More TCAM capacity, faster processors, compressed data structures.
Software Optimizations: Incremental SPF, batched FIB updates, optimized lookup algorithms.
On August 12, 2014, the global BGP table exceeded 512,000 prefixes—overflowing the TCAM in many older routers that had 512K entry limits. This caused widespread Internet outages. It's a stark reminder that routing table growth has real operational consequences.
Network engineers regularly examine routing tables to diagnose connectivity issues, verify routing policy, and optimize network performance. Key commands and techniques:
Cisco IOS/IOS-XE:
! View entire routing tableshow ip route ! View routes for specific prefixshow ip route 192.168.1.0 255.255.255.0show ip route 192.168.1.0/24 ! View routes learned from specific protocolshow ip route ospfshow ip route bgp ! View more detailed routing table (includes all paths, not just best)show ip route detail ! Check if specific destination is reachableshow ip route 10.1.2.5 ! View RIB (all routes including non-best)show ip rib ! View FIB (forwarding table)show ip cefLinux/Unix:
# View routing tableip route show# or legacy commandroute -n # View specific routeip route get 10.1.2.5 # View routing table with detailsip route show table all # Add static routesudo ip route add 192.168.1.0/24 via 10.0.0.1 dev eth0 # Delete routesudo ip route del 192.168.1.0/24We've comprehensively explored the routing table—the central data structure of router control plane operation. Let's consolidate the key concepts:
You now understand the routing table as the comprehensive routing knowledge repository. Next, we'll examine the forwarding table—the optimized, hardware-focused structure derived from the routing table for actual packet forwarding.