Skip to content

Routing Table Basics

Last updated:

Every forwarding decision a router makes is a lookup in one table. Three rules decide the winner for a destination:

  1. Longest prefix match — a /28 route beats a /24, which beats a /16. Always evaluated first.
  2. Administrative distance (AD) — when two sources offer the same prefix, the more trusted source wins.
  3. Metric — when the same protocol offers the same prefix twice, its own metric breaks the tie.

Common administrative distances

Route sourceAD (Cisco defaults)
Connected interface0
Static route1
eBGP20
OSPF110
IS-IS115
RIP120
iBGP200

AD values are vendor-specific defaults (these are Cisco's) — the concept is universal: lower means more trusted.

Why longest prefix match comes first

AD compares route sources for the same prefix. 10.1.1.0/24 via OSPF and 10.1.1.128/25 via RIP aren't competing — a packet to 10.1.1.130 simply matches the more specific /25. AD would only referee if both offered the identical prefix.