What's changed: Initial version
2.2Dynamic routing protocols
Covers the distance-vector approach that evaluates routes by hop count (RIP), the link-state approach that floods link information and computes a shortest-path tree (OSPF, areas, LSAs, cost), the path-vector approach that governs inter-AS routing (BGP, AS, eBGP/iBGP, path attributes), and the distinction between IGP (used within an organization) and EGP (used between organizations), along with the speed of convergence.
Dynamic routing protocols differ greatly in convergence speed and scalability depending on the algorithm they use to gather route information and determine the best path. A network designer must judge whether RIP, OSPF, or BGP is appropriate based on the target network's scale (a handful of sites versus a company-wide network with hundreds of routers) and whether it stays within one organization or spans between organizations (other companies, ISPs).
2.2.1Distance-vector routing (RIP)
- Distance-vector routing builds a route table by asking neighboring routers only for "the distance (hop count) and direction to a destination." Each router has no knowledge of the overall network topology and builds its routes by trusting what neighbors report—closer to "deciding routes by hearsay."
- RIP's representative implementation caps its hop-count metric at 15 (16 is treated as unreachable), making it unsuitable for large networks. It updates via periodic broadcast of its entire route table, so it converges slowly—a classic protocol suited to small networks.
2.2.2Link-state routing (OSPF)
- Link-state routing has each router flood its own link state (adjacency, bandwidth, etc.) as an LSA (Link-State Advertisement) to every router, so that every router holds an identical map of the entire network (a topology database) and each independently computes the optimal path using Dijkstra's algorithm (a shortest-path tree).
- OSPF cost is computed by default as
cost = reference bandwidth ÷ interface bandwidth(the default reference bandwidth is 100 Mbps): the higher the bandwidth, the lower the cost, making it the preferred route. Multiple equal-cost paths can also be load-balanced (ECMP). - In a large network, having every router hold a single LSA database imposes excessive load, so OSPF is hierarchically divided into areas. Other areas connect through the central area 0 (the backbone area), and localizing LSA flooding within each area speeds convergence and limits each router's computational load.
Most-tested: "RIP = hop count, max 15, slow convergence" and "OSPF = bandwidth-based cost, every router shares one topology via LSAs, hierarchically divided into areas". Be ready to verify OSPF's cost formula reference bandwidth ÷ interface bandwidth with concrete numbers (e.g., reference 100 Mbps over a 10 Mbps link gives a cost of 10).
2.2.3Path-vector routing (BGP) and IGP vs. EGP
- BGP is a path-vector protocol that exchanges route information between autonomous systems (AS). Because each advertised route carries "the sequence of ASes traversed" (the AS path), loop detection is straightforward (a router discards a route whose path already contains its own AS number), making BGP the sole practical protocol for routing across the entire internet.
- eBGP is a BGP session established between different ASes (between AS-border routers). iBGP is a BGP session established between routers within the same AS (used to propagate externally learned route information across the AS). Both use the same BGP protocol, but their role differs depending on whether the peer is inside or outside the AS.
- BGP path selection is not a simple metric but a complex, staged comparison of path attributes (AS-path length, local preference, MED, etc.). Rather than simply picking "the closest route," it can enforce policy-driven route control that reflects commercial contracts and preference relationships—the essential difference from an IGP.
- IGP (Interior Gateway Protocol) is the umbrella term for protocols such as RIP and OSPF used within an organization (within a single AS). EGP (Exterior Gateway Protocol) is the umbrella term for protocols such as BGP used between organizations (between ASes). The boundary of "how far a route is propagated" coincides with the AS boundary.
An ISP designer is planning connectivity between the internal network (AS 65001), a client company's network, and the internet at large. Within the internal network of dozens of routers, the requirement is to converge within seconds to tens of seconds after a link failure, so OSPF is adopted as the IGP, since flooding and shared topology allow fast recomputation; given the number of sites and the diversity of bandwidths, the large network is split into multiple areas. For exchanging routes with other ISPs and the client company over the internet, however, route control between organizations with their own AS numbers is required, so BGP (an EGP) is used: an eBGP session is configured at the boundary with another ISP's AS, and iBGP sessions propagate that externally learned route information among the routers within the designer's own AS. Now consider a case where BGP's route selection does not simply pick the shortest path: if the same destination is reachable via two upstream ISPs (ISP-X and ISP-Y), and ISP-X's AS path is shorter, the route via ISP-Y might still be preferred if its local preference has been set higher. This is possible because BGP can factor commercial policy—such as "the link is cheaper" or "we contractually prefer this provider"—into route selection, in contrast to an IGP (like OSPF), which chooses routes purely on technical cost and bandwidth. The judgment axis is therefore: use an IGP (RIP/OSPF) when everything stays within the organization and fast convergence is needed; use an EGP (BGP) when policy-based route control across ASes is required.
| Protocol | Class | Route-evaluation basis | Typical scope |
|---|---|---|---|
| RIP | Distance-vector (IGP) | Hop count (max 15) | Small intra-organization networks |
| OSPF | Link-state (IGP) | Bandwidth-based cost | Medium-to-large intra-organization networks |
| BGP | Path-vector (EGP) | Path attributes (AS-path length, local preference, etc.) | Inter-AS / the internet at large |
Trap: "BGP always chooses the route with the shortest AS path" is wrong—several path attributes, such as local preference, are compared before AS-path length, and a non-shortest route is commonly chosen due to commercial policy (see the ISP example above). Also wrong: "OSPF cost is determined by hop count"—OSPF cost is bandwidth-based by default (reference bandwidth ÷ interface bandwidth); hop-count evaluation is RIP's approach. Confusing these two is a frequent mistake.
2.2.4Section summary
- RIP is distance-vector based on hop count (max 15); OSPF is link-state based on bandwidth cost (hierarchized via areas)
- BGP is path-vector routing between ASes; path attributes (such as local preference) allow policy-driven route selection
- Choose IGP (RIP/OSPF) for fast convergence within an organization, and EGP (BGP) for policy control between organizations
Sign in to track progress — Log in.
Quick check
(just a quick review)Q1. A mid-size internal network with dozens of routers requires routes to reconverge within seconds to tens of seconds after a link failure. Which protocol class is most appropriate, and why?
Q2. An ISP wants to take externally learned route information and propagate it to every router within its own AS. Which type of BGP session is most appropriate for this purpose?
Q3. A site receives routes to the same destination from two upstream ISPs: ISP-X (shorter AS path) and ISP-Y (longer AS path). If the BGP configuration assigns a higher local preference to the route via ISP-Y than to the route via ISP-X, which route is actually selected, and why?

