Loading learning content...
In the previous page, we learned that IP forwards packets by consulting a routing table—examining the destination address and determining the next hop. But this raises a critical question: how does the routing table get populated?
For small, static networks, an administrator might manually configure routes. But the global Internet comprises over 70,000 autonomous systems with millions of routers. Manual configuration at this scale is impossible—routes change constantly as links fail, new networks appear, and traffic patterns shift. The answer lies in routing protocols: specialized protocols that automatically discover network topology and compute optimal paths.
By the end of this page, you will understand: (1) the fundamental purpose of routing protocols, (2) the three major categories—Distance Vector, Link State, and Path Vector, (3) key examples of each category (RIP, OSPF, BGP), (4) the distinction between interior and exterior gateway protocols, and (5) how these protocols enable the Internet's dynamic, self-healing behavior.
Routing protocols are algorithms that enable routers to share information about network topology and compute paths to destinations. They operate in the control plane—the part of networking that determines how packets should be forwarded—as opposed to the data plane where actual forwarding occurs.
To understand routing protocols, we must first distinguish them from routed protocols:
Routing protocols don't carry user traffic—they carry routing information: which networks exist, how to reach them, and what the costs are. This information is exchanged between routers, which then independently compute their routing tables.
| Characteristic | Routing Protocols | Routed Protocols |
|---|---|---|
| Purpose | Discover topology, compute paths | Carry user data |
| Examples | RIP, OSPF, EIGRP, BGP, IS-IS | IP, IPv6 |
| Traffic Type | Control plane (router-to-router) | Data plane (host-to-host) |
| Scope | Between routers only | End-to-end across network |
| When Active | Continuously running | When data needs transmission |
| Output | Routing table entries | Forwarded packets |
Why Dynamic Routing?
Manual (static) routing works for simple, stable networks—but fails in complex environments:
Routing protocols solve these challenges by:
Routing is a distributed computing problem. There's no central authority that knows all links and computes all routes. Each router has only local information and must cooperate with others to build a global picture. This constraint fundamentally shapes routing protocol design.
The Internet is organized into Autonomous Systems (AS)—networks under a single administrative authority. Your ISP is an AS. Google is an AS. A university might be an AS. Each AS has its own internal structure and policies.
This organization creates a fundamental distinction in routing:
Why This Distinction Matters:
Within an AS, all routers are under common administration. They can trust each other, share detailed topology information, and optimize purely for performance. The goal is finding the fastest path.
Between ASes, the relationship is different. ASes may be competitors or have business agreements that affect routing. An AS might refuse to carry traffic for certain other ASes, or prefer expensive paths for business reasons. The goal isn't just speed—it's enforcing routing policy.
Example Scenario:
Consider an AS that is a customer of two ISPs. For incoming traffic, it might prefer ISP-A (cheaper). For outgoing traffic to certain destinations, it might prefer ISP-B (faster). These policies can't be expressed with simple metrics—they require explicit policy control.
This is why BGP, the inter-AS protocol, is fundamentally different: it's a path-vector protocol with rich policy capabilities, whereas IGPs are typically link-state or distance-vector focused on efficiency.
Think of Internet routing as hierarchical: within each AS, an IGP optimizes local routing; between ASes, BGP implements global routing with policy controls. This separation of concerns allows each level to be optimized for its specific requirements.
Distance Vector routing is one of the oldest approaches to dynamic routing, based on the Bellman-Ford algorithm. The core idea is simple: each router maintains a vector (list) of distances to all known destinations, and periodically shares this vector with its neighbors.
How Distance Vector Works:
12345678910111213141516171819
Distance Vector Algorithm (Bellman-Ford): Initial state: - For each directly connected network N: distance[N] = link_cost(self, N) next_hop[N] = direct - For all other networks: distance[N] = INFINITY next_hop[N] = undefined On receiving distance vector from neighbor R: For each destination D in R's vector: new_cost = link_cost(self, R) + R.distance[D] if new_cost < distance[D]: distance[D] = new_cost next_hop[D] = R Periodically (every 30 seconds for RIP): Send entire distance vector to all neighborsRIP: Routing Information Protocol
RIP is the classic distance vector protocol, still used in small networks:
Distance Vector Limitations:
While elegant, distance vector protocols have significant issues:
Mitigations:
Several techniques reduce these problems:
Despite these improvements, distance vector protocols are largely replaced by link-state protocols for medium to large networks. However, RIP remains in use for small networks due to its simplicity.
Cisco's EIGRP (Enhanced Interior Gateway Routing Protocol) is sometimes called an 'advanced distance vector' or 'hybrid' protocol. It uses distance vector principles but with sophisticated features like DUAL algorithm (for loop-free convergence), incremental updates, and composite metrics. It combines distance vector simplicity with near link-state performance.
Link State routing takes a fundamentally different approach from distance vector. Instead of sharing distances to destinations, routers share information about their directly connected links. Every router then independently builds a complete map of the network and computes shortest paths using Dijkstra's algorithm.
How Link State Works:
| Aspect | Distance Vector | Link State |
|---|---|---|
| Information Shared | Distance to all destinations | State of local links only |
| Shared With | Direct neighbors only | All routers (flooding) |
| Network View | Partial (via neighbors) | Complete (full topology) |
| Algorithm | Bellman-Ford (distributed) | Dijkstra (local computation) |
| Convergence Speed | Slow (multiple iterations) | Fast (single computation) |
| Memory Usage | Lower | Higher (stores full topology) |
| CPU Usage | Lower (simple math) | Higher (SPF calculation) |
| Loop Prevention | Techniques needed | Inherently loop-free |
| Scalability | Good for small networks | Better for large networks |
OSPF: Open Shortest Path First
OSPF is the dominant link state IGP, standardized by IETF (RFC 2328 for OSPFv2):
Why Link State is Superior for Large Networks:
IS-IS (Intermediate System to Intermediate System) is another link state protocol, favored by large ISPs. It operates directly on Layer 2 (not IP), making it protocol-agnostic. IS-IS was actually developed before OSPF (from OSI standards) but adapted for IP. Both are essentially equivalent in capability; choice is often historical or operational preference.
Path Vector routing is used exclusively for inter-domain (inter-AS) routing. The sole path vector protocol in use today is BGP (Border Gateway Protocol)—the protocol that literally holds the Internet together.
BGP's Unique Requirements:
Unlike IGPs, BGP must:
How Path Vector Works:
Path vector is similar to distance vector, but instead of advertising just distances, routers advertise the complete path (sequence of ASes) to each destination:
1234567891011121314151617
BGP Update Message Example: NLRI (Network Layer Reachability Information): Prefix: 203.0.113.0/24 Path Attributes: AS_PATH: 64500 64496 64511 NEXT_HOP: 198.51.100.1 ORIGIN: IGP MED: 100 LOCAL_PREF: 200 Interpretation: - To reach 203.0.113.0/24, go through AS 64500, then 64496, then 64511 - Enter via 198.51.100.1 - This route originated from an IGP (not manually configured) - MED and LOCAL_PREF influence path selectionLoop Detection:
The AS_PATH attribute provides elegant loop detection: if a router sees its own AS number in the path, the route is rejected. This is simpler and more reliable than distance vector's hop-counting approaches.
Policy Implementation:
BGP's true power lies in its policy capabilities. AS_PATH, LOCAL_PREF, MED, and communities allow sophisticated routing decisions:
BGP is the most critical protocol on the Internet. Major BGP misconfigurations have caused Internet-wide outages (like Facebook's 2021 outage where they withdrew their own routes via BGP). Securing BGP (with RPKI, ROV) is an ongoing industry effort. Every Internet engineer should understand BGP fundamentals.
In practice, network architects must choose appropriate routing protocols based on network requirements. No single protocol is best for all scenarios.
Decision Factors:
| Factor | RIP | OSPF | IS-IS | EIGRP | BGP |
|---|---|---|---|---|---|
| Network Size | Small (<15 hops) | Large (with areas) | Very Large | Medium-Large | Internet-scale |
| Convergence | Slow (minutes) | Fast (seconds) | Fast (seconds) | Very Fast | Slow (by design) |
| Complexity | Simple | Moderate | Moderate-High | Moderate | High |
| Vendor Support | Universal | Universal | Limited | Cisco-centric | Universal |
| CPU/Memory | Low | Moderate-High | Moderate-High | Moderate | High |
| Policy Support | None | Limited | Limited | Limited | Extensive |
| Best For | Home/Lab | Enterprise | Large ISP | Cisco Enterprise | Inter-domain |
Common Deployment Patterns:
Small Office: Static routes or RIPv2—minimal complexity, easy troubleshooting
Enterprise Campus: OSPF—scalable, fast convergence, widespread support, hierarchical design with areas
Data Center: eBGP between pods/fabrics or OSPF within—scale and policy requirements vary
Service Provider Core: IS-IS or OSPF for internal routing + iBGP for route distribution + eBGP for peering
Multi-Site Enterprise: eBGP with private ASNs or OSPF + BGP redistribution
Route Redistribution:
Large networks often use multiple routing protocols. For example, a campus might run OSPF internally but connect to the Internet via BGP. Route redistribution allows routes learned from one protocol to be shared with another—but this must be done carefully to avoid routing loops and suboptimal paths.
Filtering is essential: Never blindly redistribute all routes. Use prefix lists and route maps to control what is shared.
The best routing design is the simplest one that meets requirements. Don't use OSPF with 10 areas when a flat design works. Don't introduce BGP for internal routing unless policy requires it. Complexity creates operational overhead and failure opportunities.
Routing protocols are the intelligence that makes dynamic, adaptive networking possible. Without them, the Internet would require impossible amounts of manual configuration and couldn't recover from failures.
Routing protocols handle path computation, but the Network Layer needs additional control mechanisms. The next page explores control protocols—including ICMP, ARP, and others—that provide error reporting, diagnostics, and operational support for IP networking.