Chapters0/30 ▾
Chapter 2 · Lesson 3 of 5
How routers choose a path: prefix, distance, metric and summaries
1 min read
Route selection happens in a fixed order. First, longest prefix match: of all routes that contain the destination, the most specific one wins, no matter how it was learned. A packet for 10.20.30.45 matches 0.0.0.0/0, 10.0.0.0/8, 10.20.0.0/16 and 10.20.30.0/24, and the /24 is used.
Second, administrative distance breaks a tie when the same prefix comes from different sources; lower is trusted more. Third, the metric, such as hop count or cost, ranks paths inside one routing protocol. The default route is used only when nothing more specific matches.
Summarization combines contiguous networks into one shorter prefix. Example: 10.1.4.0/24 through 10.1.7.0/24 are four networks, 4 x 256 = 1,024 addresses, so shorten the prefix by 2 bits: 10.1.4.0/22 covers exactly 10.1.4.0 to 10.1.7.255. A /23 would miss two of them and a /21 would claim networks the router does not own.
Know the protocol families: OSPF is link-state, RIP is distance-vector using hop count, EIGRP is advanced distance-vector, and BGP is the path-vector exterior protocol that connects autonomous systems.
Check yourself
1. A router's IPv4 routing table contains these entries: 0.0.0.0/0 via 203.0.113.1; 10.0.0.0/8 via 10.1.1.1; 10.20.0.0/16 via 10.1.2.1; 10.20.30.0/24 via 10.1.3.1. A packet arrives destined for 10.20.30.45. Which next hop does the router use?
2. Which statement correctly distinguishes administrative distance from a routing metric?
Facts checked 2026-11-16 · Sources: CompTIA Network+ certification overview, RFC 1918: Address Allocation for Private Internets, RFC 4291: IP Version 6 Addressing Architecture
CompTIA Network+ cheat sheet: every key fact on one page →