What to practice
- Resolve packet forwarding decisions using Longest Prefix Match (LPM), Administrative Distance (AD), and OSPF link cost metrics.
- Trace DHCP DORA (Discover, Offer, Request, Acknowledge), DHCP Relay (ip helper-address), and PAT (NAT Overload) port translation tables.
- Audit standard and extended Access Control Lists (ACLs) for rule-shadowing bugs and implicit-deny drops.
Limited preview notice: AP Networking is not yet open to all schools. College Board lists 2026-27 as its third and final pilot year, with a multiple-choice pilot exam in May 2027 for pilot schools, availability for all schools in 2027-28, and the AP Networking Exam in May 2028. This free preview teaches networking foundations. It is not a complete course, it is not for sale, and College Board does not endorse it.
Framework
Route Selection Hierarchy: (1) Longest Prefix Match (/p with highest p) ALWAYS wins first; (2) Administrative Distance (Connected=0, Static=1, eBGP=20, OSPF=110, RIP=120) breaks ties between different sources for the exact same /p; (3) Routing Metric (OSPF Cost = Reference_BW / Interface_BW) breaks ties within the same protocol | DHCP DORA: Discover -> Offer -> Request -> Acknowledge | ACL Evaluation: Top-Down First-Match + Implicit Deny All
In this chapter, Layer 3 routers make independent packet-forwarding decisions by consulting their IP routing table. The fundamental rule of IP forwarding is Longest Prefix Match (LPM): among all routing table entries whose prefix matches the destination IP address, the router always selects the route with the longest subnet mask (largest /p, e.g., /27 beats /24 beats /16 beats 0.0.0.0/0), regardless of Administrative Distance or metric! Administrative Distance (AD: Connected = 0, Static = 1, OSPF = 110, RIP = 120) is used only when two different routing sources offer the exact same prefix and prefix length to decide which route is installed in the routing table. Within OSPF, link cost is Cost = Reference_BW / Link_BW. At the network edge, PAT (Port Address Translation / NAT Overload) maps hundreds of RFC 1918 private hosts to one public IP using unique Layer 4 source port numbers, DHCP automates IP assignment via DORA (Discover, Offer, Request, Acknowledge), and Access Control Lists (ACLs) filter packets top-down on a first-match basis ending with an unseen Implicit Deny All.
Worked Longest Prefix Match (LPM) vs. Administrative Distance, OSPF Cost & First-Match ACL Audit
A router receives a packet destined for 10.40.12.65. Its routing table contains four matching entries: (1) Static route 10.40.0.0/16 via Next-Hop A (AD = 1); (2) OSPF route 10.40.12.0/24 via Next-Hop B (AD = 110); (3) RIP route 10.40.12.64/27 via Next-Hop C (AD = 120); and (4) Default route 0.0.0.0/0 via Next-Hop D (AD = 1). Determine which Next-Hop the router chooses, calculate the OSPF cost of a 250 Mbps link when the reference bandwidth is 10,000 Mbps (10 Gbps), and evaluate an ACL where Rule 1 is permit ip any any and Rule 2 is deny tcp host 10.40.12.65 any eq 22.
Step 1 (Verify Which Prefixes Match 10.40.12.65): All four routes match (10.40.12.65 falls inside 10.40.12.64/27, which spans .64 to .95).
Step 2 (Apply Longest Prefix Match LPM): Compare prefix lengths /16, /24, /27, and /0. Because /27 is the longest, most specific prefix, the router forwards to Next-Hop C (LPM overrides AD = 120 vs. AD = 1!).
Step 3 (Calculate OSPF Link Cost): Cost = Reference_BW / Interface_BW = 10,000 Mbps / 250 Mbps = 40.
Step 4 (Audit First-Match ACL): Because ACLs evaluate top-down on a first-match basis, Rule 1 (permit ip any any) matches every packet immediately and shadows Rule 2; Rule 2 must be placed above Rule 1.
Longest Prefix Match (/p) always takes precedence when forwarding packets; Administrative Distance only decides which route enters the routing table when two protocols advertise the exact same prefix and mask.
Practice procedure
Check address inclusion in the most specific /p block first; for OSPF cost, divide Reference Bandwidth by Link Bandwidth in identical units (Mbps).
Common mistakes
Picking a /16 Static route (AD = 1) over a matching /27 OSPF or RIP route when forwarding a packet (confusing Administrative Distance with Longest Prefix Match).
Placing a broad permit ip any any rule at the top of a firewall ACL and assuming specific deny rules below it will still execute.
Key terms
Term: Longest Prefix Match (LPM)
Definition: The router forwarding rule that selects the matching routing table entry with the highest number of network prefix bits (/p).
Term: Administrative Distance (AD)
Definition: A trustworthiness rating (0 to 255; lower is preferred) used by a router to choose between routes to the exact same prefix from different routing protocols.
Term: PAT (NAT Overload)
Definition: Port Address Translation; maps multiple private inside IPv4 addresses to a single public outside IPv4 address using unique TCP/UDP source port numbers.
Term: DHCP DORA
Definition: The four-step Dynamic Host Configuration Protocol lease process: Discover, Offer, Request, Acknowledge.