Octet

What is the difference between administrative distance and metric?

Show the answer

Say this first

Metric ranks paths inside one routing protocol: it is advertised and grows hop by hop. Administrative distance ranks different sources of the same prefix: it is local to one router and never advertised. The router uses metric to choose the best OSPF path, then AD to choose between that OSPF route and, say, an EIGRP route to the exact same prefix.

Go deeper

Administrative distanceMetric
Comparesdifferent sources (protocols, statics)paths inside one protocol
Scopelocal to the routercarried in updates, accumulates
Applies whensame prefix and length from two sourcesalways, inside the protocol
Shown asfirst number in [110/20]second number in [110/20]

Example

R1 learns 10.5.0.0/24 from OSPF with cost 3 and from EIGRP with metric 3072. The numbers are not comparable. R1 installs the EIGRP route because 90 is lower than 110:

Output
D        10.5.0.0/24 [90/3072] via 10.0.13.2, 00:02:11, GigabitEthernet0/0/2

If OSPF had two paths, one with cost 3 and one with cost 5, OSPF itself would have picked cost 3 before offering anything to the RIB.

Order of decisions

  1. Inside each protocol: best metric.
  2. Between sources, for the same prefix: lowest AD.
  3. For each packet: longest prefix match across everything installed.

Traps

  • Saying a lower metric beats a lower AD. Metric is never compared across protocols.
How did you do?Book 3.4 Routing