Lesson Overview

In enterprise networks, routers frequently learn multiple routes to the same destination through different routing protocols, static routes, and directly connected interfaces.


For example, a Cisco router may learn the network 192.168.100.0/24 through OSPF, EIGRP, and a static route simultaneously. However, the router must determine which route should be installed in its routing table and used to forward packets.


Cisco routers use several mechanisms to make routing decisions, including:

  • Longest Prefix Match (LPM).

  • Administrative Distance (AD).

  • Routing protocol metrics.

  • Route preference and route installation.

  • Equal-Cost Multi-Path (ECMP).

  • Recursive next-hop resolution.

  • Routing Information Base (RIB) and Forwarding Information Base (FIB).

Understanding these mechanisms is essential for configuring and troubleshooting enterprise routing networks.


This lesson explains how Cisco routers select routes, how administrative distance affects route installation, how metrics are compared, and how to troubleshoot routing decisions using real-world topologies, Cisco IOS/IOS XE configurations, and verification commands.


Learning Objectives

After completing this lesson, you will be able to:

  1. Explain Administrative Distance and its purpose.

  2. Identify default Administrative Distance values for common Cisco routing sources.

  3. Differentiate Administrative Distance from routing protocol metrics.

  4. Understand how routers select the best route.

  5. Explain Longest Prefix Match and route lookup.

  6. Understand route selection within and between routing protocols.

  7. Configure and verify static, floating static, OSPF, and EIGRP routes.

  8. Explain Equal-Cost Multi-Path routing.

  9. Understand the roles of the RIB, FIB, and Cisco Express Forwarding (CEF).

  10. Troubleshoot unexpected routing decisions.

1. Administrative Distance Fundamentals

Administrative Distance (AD) is a Cisco route-source preference value. It tells the router which routing information source to trust when the SAME destination prefix is available from more than one source. Lower AD is preferred.


AD is local to the router. It is not advertised to neighboring routers as part of OSPF, EIGRP, or BGP updates.

AD compares route sources such as connected, static, EIGRP, OSPF, and BGP. It does not compare the internal quality of two paths inside the same protocol.

Routing protocol metrics select the best path inside a protocol: OSPF uses cost, EIGRP uses a composite metric, and BGP uses its path-selection attributes.

Longest Prefix Match (LPM) is the forwarding decision that selects the most specific installed prefix matching the destination address.

Important: For troubleshooting, think in this order: identify the most specific matching prefix, then understand which source won by AD for that prefix, then inspect the metric/path-selection logic inside the winning protocol. Do not numerically compare an OSPF cost to an EIGRP metric or BGP attribute.


Example

A router learns the same destination network through:

Routing Source

Administrative Distance

Static Route

1

EIGRP Internal

90

OSPF

110

Assuming all three routes refer to the same destination prefix, are valid, and are eligible for installation, the static route is preferred because its AD is the lowest.


The decision sequence students must remember

1. LONGEST PREFIX MATCH

Which installed prefix is most specific?

2. ADMINISTRATIVE DISTANCE

Which route source is preferred for the same prefix?

3. PROTOCOL METRIC

Which path is best inside that protocol?


1.1 Administrative Distance Range

Cisco Administrative Distance values range from 0 to 255.

AD Value

Meaning

0

Highest preference, commonly connected routes

1–254

Usable route preference values

255

Route is not eligible for installation based on that AD

A route with AD 255 is not installed in the routing table.


Important Characteristics

  • AD is evaluated locally on each router.

  • AD is not generally advertised to neighboring routers as a route attribute.

  • Different routers may use different AD values.

  • AD can be modified for certain routing sources.

  • AD is used to compare competing routes to the same prefix.

  • AD does not directly measure bandwidth, delay, or path quality.

2. Administrative Distance vs Routing Metric

A routing metric is a value used by a routing protocol to evaluate and select paths. Different routing protocols calculate metrics using different methods.

Routing Protocol

Metric

RIP

Hop count

OSPF

Cost

EIGRP

Composite metric based on configured K-values

IS-IS

Cost

BGP

Multiple path attributes, not a single universal metric


Administrative Distance vs Metric

Feature

Administrative Distance

Routing Metric

Purpose

Prefer routing sources

Compare paths within routing protocols

Scope

Local router

Protocol-specific

Lower Value Preferred

Generally yes

Depends on protocol

Same Across Protocols

Can compare route sources

Metrics are not directly comparable

Configurable

Yes, where supported

Yes, depending on protocol

Example

OSPF AD 110

OSPF cost 20


Example

A router learns the same prefix through:

  • OSPF: AD 110, cost 10.

  • EIGRP Internal: AD 90, metric 500,000.

The EIGRP route is preferred for RIB installation, assuming both are valid competing routes, because EIGRP has the lower AD. The router does not directly compare OSPF cost 10 with EIGRP metric 500,000.


3. How Cisco Routers Select Routes

There are two important decisions to distinguish:

Control-plane route selection: Which routes should be installed in the routing table?

Data-plane packet forwarding: Which installed route matches a packet's destination address?

These decisions are related but are not the same operation.


Simplified Route Selection Workflow

Pasted content image
Figure 3 - Understanding of Route Selection Process.

This is a conceptual model. The exact control-plane processing sequence depends on the routing protocol and platform.  

4. LAB Topology

The following lab topology represents a route-selection router receiving the same test prefix from different routing sources. This makes AD behavior easy to observe in a controlled lab.

Pasted content image

Figure 4 - R1 receives the same test prefix from OSPF, EIGRP and eBGP upstream; a static route can be added to demonstrate AD and floating-static behavior.


Lab addressing and route sources

Device / Link

Address / Prefix

Routing role

PC-A

192.168.10.10/24

Client on R1 LAN

R1 G0/0

192.168.10.1/24

Connected route source

R1–R2

10.12.12.0/30

OSPF adjacency

R1–R3

10.13.13.0/30

EIGRP adjacency

R1–R4

10.14.14.0/30

eBGP adjacency

Test prefix

172.16.100.0/24

Advertised to R1 by multiple sources

Lab design note: In a sandbox, upstream routers can originate the same test prefix specifically to demonstrate route-source preference. In production, make sure the prefix represents valid redundant reachability rather than accidental duplicate addressing.


Common Cisco default AD values

Route source

Default AD

What it means

Connected

0

Directly connected network; most trusted route source.

Static

1

Manually configured route; normally preferred over dynamic protocols.

eBGP

20

Route learned from an external BGP neighbor.

EIGRP internal

90

EIGRP route learned inside the EIGRP autonomous system.

OSPF

110

OSPF intra-area, inter-area and external routes use AD 110 by default.

EIGRP external

170

Route redistributed into EIGRP from another routing source.

iBGP

200

BGP route learned from an internal BGP neighbor.

Platform note: These are Cisco defaults. AD can be changed by configuration, and other vendors can use different preference values.

Connected route preference

A connected route appears when an interface has an IP address and the line protocol is operational. Its AD is 0. A local host route (/32) also appears for the router interface address on modern IOS/IOS XE.

R1# show ip route 192.168.10.0

Routing entry for 192.168.10.0/24

 Known via "connected", distance 0, metric 0

 * directly connected, via GigabitEthernet0/0

Static route preference

A standard static route uses AD 1 unless you explicitly configure another value. Because AD 1 is lower than EIGRP 90 and OSPF 110, an ordinary static route normally wins for the same prefix.

R1(config)# ip route 172.16.100.0 255.255.255.0 10.12.12.2

R1# show ip route 172.16.100.0

S 172.16.100.0/24 [1/0] via 10.12.12.2


EIGRP, OSPF and BGP preference

Source

AD

Example routing-table code

Selection implication

eBGP

20

B

Wins against EIGRP/OSPF for the same prefix when all routes are valid.

EIGRP internal

90

D

Wins against OSPF 110 for the same prefix.

OSPF

110

O / O IA / O E1 / O E2

Loses to internal EIGRP 90, but wins against external EIGRP 170 and iBGP 200.

EIGRP external

170

D EX

Often loses to OSPF 110 for the same prefix.

iBGP

200

B

Often loses to OSPF/EIGRP in the RIB unless policy changes the preference.

BGP nuance: BGP first runs its own BGP path-selection algorithm and offers its best BGP path to the routing table. AD then determines whether that BGP route is installed over a competing OSPF/EIGRP/static route for the same prefix.


5. Route Selection: Longest Prefix Match → AD → Metric

Step 1 - Longest Prefix Match (LPM)

When forwarding an IP packet, the router compares the destination IP address against installed routes and chooses the route with the longest matching subnet mask. A /32 beats a /24, a /24 beats a /16, and a /16 beats a /8.

Installed prefix

Source

AD / metric

Does 10.20.20.50 match?

10.0.0.0/8

Static

1/0

Yes

10.20.0.0/16

OSPF

110/20

Yes

10.20.20.0/24

EIGRP

90/30720

Yes

10.20.20.0/25

OSPF

110/30

Yes — MOST SPECIFIC

Result: 10.20.20.50 uses 10.20.20.0/25. The /25 wins even though its OSPF AD 110 is higher than the EIGRP route AD 90 and static AD 1 on less-specific prefixes.

Critical concept: AD never causes a less-specific route to beat a more-specific installed route. This is one of the most common route-selection troubleshooting mistakes.


Step 2 - Administrative Distance for the same prefix

After you identify the exact destination prefix being considered, look at competing route sources for that same prefix. The lowest AD is preferred.

Candidate for 172.16.100.0/24

Default AD

Selected if all are valid?

Static route

1

Yes — if configured as normal static

eBGP

20

Yes if no lower-AD route exists

EIGRP internal

90

Yes if static/eBGP are absent

OSPF

110

Yes if lower-AD sources are absent

EIGRP external

170

Only if lower-AD candidates are absent

iBGP

200

Only if lower-AD candidates are absent


Step 3 - Routing protocol metric / path selection

Metric is used to choose the best route inside a routing protocol. Metrics from different protocols are not comparable because they measure path quality differently.

Protocol

Internal best-path value

Lower / higher preferred?

Examples

OSPF

Cost

Lower

Interface cost derived from reference bandwidth/bandwidth unless manually set.

EIGRP

Composite metric

Lower

Uses bandwidth and delay by default; other K-values exist.

BGP

BGP path attributes

Policy sequence

Weight, local preference, locally originated, AS path, origin, MED, eBGP/iBGP and other tie-breakers.

Static

No dynamic metric

N/A

Routing table usually displays metric 0; AD controls preference versus other sources.

Metric rule: When two OSPF paths exist to the same prefix, OSPF cost selects the best path. When EIGRP and OSPF both advertise the same prefix, do not compare EIGRP metric to OSPF cost; compare AD 90 versus 110.


6. Longest Prefix Match

Longest Prefix Match (LPM) is the forwarding rule that selects the most specific matching route for a destination IP address. A route with a longer subnet mask is more specific.


Example Routing Table

Destination

Prefix Length

Next Hop

10.0.0.0/8

/8

R2

10.10.0.0/16

/16

R3

10.10.10.0/24

/24

R4

10.10.10.128/25

/25

R5

Destination: 10.10.10.150

The destination matches all four routes.

The router selects:

10.10.10.128/25

because /25 is the longest matching prefix.


Important

Even if the /8 route has a lower Administrative Distance than the /25 route, the router forwards the packet using the /25 route, provided that route is installed and usable.


Longest Prefix Match takes precedence during forwarding because it determines which destination prefix applies. Administrative Distance is used when choosing competing routes for the same prefix.


7. Same-Prefix Route Comparison - Worked Examples

Scenario A - EIGRP vs OSPF

R1# show ip route 172.16.100.0

Routing entry for 172.16.100.0/24

 Known via "eigrp 100", distance 90, metric 30720, type internal

 * 10.13.13.2, from 10.13.13.2, 00:00:22 ago, via GigabitEthernet0/2

OSPF may also know 172.16.100.0/24, but the RIB installs the EIGRP route because AD 90 is lower than OSPF 110. Use the protocol databases to verify non-installed alternatives.


Useful checks

R1# show ip eigrp topology 172.16.100.0/24

R1# show ip ospf database | include 172.16.100.0

R1# show ip protocols


Scenario B - eBGP vs EIGRP vs OSPF

If eBGP, internal EIGRP and OSPF all offer the same valid /24, the default AD values are 20, 90 and 110. The eBGP route is preferred by the RIB because 20 is lowest.

R1# show ip route 172.16.100.0

B 172.16.100.0/24 [20/0] via 10.14.14.2, 00:01:07

R1# show ip bgp 172.16.100.0/24

*> 172.16.100.0/24 10.14.14.2 0 0 65004 i


Scenario C - Normal static route overrides dynamic routes

R1(config)# ip route 172.16.100.0 255.255.255.0 10.12.12.2

R1# show ip route 172.16.100.0

S 172.16.100.0/24 [1/0] via 10.12.12.2

A normal static route with AD 1 wins against eBGP 20, EIGRP 90 and OSPF 110 for the same prefix. This is why an old or forgotten static route is a frequent cause of “wrong path” incidents.


8. Floating Static Routes

A floating static route is a static route configured with an AD that is intentionally higher than the primary route. It stays out of the routing table while the primary route exists, then becomes active when the primary route disappears.

Pasted content image

Figure 8 - OSPF is primary (AD 110); a static route with AD 200 floats as backup.


Example configuration

! Primary route is learned by OSPF (AD 110)

! Backup static route uses AD 200

R1(config)# ip route 10.50.50.0 255.255.255.0 10.13.13.2 200

Healthy state - primary available

R1# show ip route 10.50.50.0

O 10.50.50.0/24 [110/20] via 10.12.12.2, 00:03:21, GigabitEthernet0/1

The AD 200 static route is configured but not installed because the OSPF route has lower AD 110.


Failure state - OSPF route removed

R1# show ip route 10.50.50.0

S 10.50.50.0/24 [200/0] via 10.13.13.2

Once OSPF no longer provides the prefix, the floating static route is eligible and is installed.

Failure scenario: If the floating static AD is accidentally configured below the dynamic route AD, it will become the primary route instead of the backup.


9. Configuration Lab - Connected, OSPF, EIGRP, BGP and Static

The following IOS/IOS XE examples demonstrate the route sources students should recognize. Adjust interface numbers and addresses for the platform being used.

R1 - Base interface configuration

hostname R1

!

interface GigabitEthernet0/0

 description USER-LAN

 ip address 192.168.10.1 255.255.255.0

 no shutdown

!

interface GigabitEthernet0/1

 description TO-R2-OSPF

 ip address 10.12.12.1 255.255.255.252

 no shutdown

!

interface GigabitEthernet0/2

 description TO-R3-EIGRP

 ip address 10.13.13.1 255.255.255.252

 no shutdown

!

interface GigabitEthernet0/3

 description TO-R4-EBGP

 ip address 10.14.14.1 255.255.255.252

 no shutdown

R1 - OSPF

router ospf 1

 router-id 1.1.1.1

 network 10.12.12.0 0.0.0.3 area 0

R1 - EIGRP

router eigrp 100

 eigrp router-id 1.1.1.1

 network 10.13.13.0 0.0.0.3

 passive-interface default

 no passive-interface GigabitEthernet0/2

R1 - eBGP

router bgp 65001

 bgp log-neighbor-changes

 neighbor 10.14.14.2 remote-as 65004

R1 - Static route examples

! Normal static route - AD 1

ip route 172.16.100.0 255.255.255.0 10.12.12.2

! Floating static route - AD 200

ip route 172.16.100.0 255.255.255.0 10.13.13.2 200


Upstream lab prefix origination

To demonstrate the same prefix from different route sources in a controlled lab, each upstream can originate the same test network. One simple emulator approach is to place a loopback in the test prefix on each isolated upstream and advertise it using that router’s protocol. Use this only as a training construct.

! R2 example - OSPF source

interface Loopback100

 ip address 172.16.100.2 255.255.255.0

router ospf 1

 network 172.16.100.0 0.0.0.255 area 0

!

! R3 example - EIGRP internal source

interface Loopback100

 ip address 172.16.100.3 255.255.255.0

router eigrp 100

 network 172.16.100.0 0.0.0.255

!

! R4 example - eBGP source

interface Loopback100

 ip address 172.16.100.4 255.255.255.0

router bgp 65004

 network 172.16.100.0 mask 255.255.255.0

 neighbor 10.14.14.1 remote-as 65001


10. Routing-Table Interpretation

Understanding [AD/metric]

Cisco routing-table entries commonly display values in brackets as [administrative distance / metric].

Example entry

Interpretation

D 172.16.100.0/24 [90/30720] via 10.13.13.2

EIGRP internal route. AD 90, EIGRP metric 30720.

O 172.16.100.0/24 [110/20] via 10.12.12.2

OSPF route. AD 110, OSPF cost 20.

B 172.16.100.0/24 [20/0] via 10.14.14.2

eBGP route. AD 20; routing-table metric field is 0 in this example.

S 172.16.100.0/24 [200/0] via 10.13.13.2

Floating static route with explicitly configured AD 200.

C 192.168.10.0/24 is directly connected

Connected route; AD 0 is implicit in normal summary output.


Common route codes

Code

Meaning

What to verify

C

Connected

Interface address and line protocol.

L

Local /32 interface address

Router’s own interface IP.

S

Static

Next hop / exit interface and configured AD.

D

EIGRP internal

Neighbor, topology metric, successor.

D EX

EIGRP external

Redistribution source and AD 170.

O

OSPF intra-area

OSPF cost and area.

O IA

OSPF inter-area

ABR path and cost.

O E1 / E2

OSPF external

Redistribution and external metric type.

B

BGP

Best BGP path, next hop, AS-path/policy.


Sample routing table

R1# show ip route

Codes: C - connected, S - static, D - EIGRP, O - OSPF, B - BGP

C 192.168.10.0/24 is directly connected, GigabitEthernet0/0

C 10.12.12.0/30 is directly connected, GigabitEthernet0/1

C 10.13.13.0/30 is directly connected, GigabitEthernet0/2

C 10.14.14.0/30 is directly connected, GigabitEthernet0/3

B 172.16.100.0/24 [20/0] via 10.14.14.2


11. Verification - What to Check

Command

Purpose

Key field

show ip route

View installed routes and route codes.

Selected prefix and [AD/metric].

show ip route <prefix>

Detailed installed route for one prefix.

Known via, distance, metric, next hop.

show ip route longer-prefixes <network>

Find more-specific routes.

Unexpected /24, /25, /32 entries.

show ip protocols

Inspect routing processes and configured distance values.

Administrative distance / network statements.

show ip eigrp topology <prefix>

Inspect EIGRP candidate paths.

Successor, feasible distance, reported distance.

show ip ospf rib / show ip ospf database

Inspect OSPF-calculated routes / LSDB.

OSPF cost and route type.

show ip bgp <prefix>

Inspect BGP best-path candidates.

Best marker >, next hop, AS path, local-pref.

show running-config | include ^ip route

Find static routes and explicit AD values.

Trailing distance value.

show ip cef <destination> detail

Verify actual forwarding entry.

FIB next hop and adjacency.


Verification example - identify why EIGRP won over OSPF

R1# show ip route 172.16.100.0

Routing entry for 172.16.100.0/24

 Known via "eigrp 100", distance 90, metric 30720, type internal

 * 10.13.13.2, from 10.13.13.2, via GigabitEthernet0/2

What to check:

Exact prefix is 172.16.100.0/24.

Route source is EIGRP 100.

AD is 90. This is lower than OSPF 110, so EIGRP wins at the RIB for the same prefix.

Metric 30720 is meaningful only for EIGRP path selection, not as a number to compare against OSPF cost.


Verification example - more-specific route overrides lower AD

R1# show ip route 10.20.20.50

Routing entry for 10.20.20.0/25

 Known via "ospf 1", distance 110, metric 30

 * 10.12.12.2, via GigabitEthernet0/1

R1# show ip route longer-prefixes 10.20.0.0

D 10.20.20.0/24 [90/30720] via 10.13.13.2

O 10.20.20.0/25 [110/30] via 10.12.12.2

The destination 10.20.20.50 matches both /24 and /25. The OSPF /25 is selected for forwarding because /25 is more specific; its higher AD does not matter against a different-length prefix.


12. Incorrect AD - Configuration and Troubleshooting

How AD becomes incorrect

  • A static route was configured without a distance value, so it defaults to AD 1 and unexpectedly overrides OSPF/EIGRP/BGP.
  • A floating static route was given AD 90 while the intended primary is OSPF 110, so the static route becomes primary.
  • The distance command was changed under OSPF, EIGRP or BGP and the change was forgotten.
  • Redistribution changed the route type: an EIGRP route became external (AD 170), allowing OSPF 110 to win.
  • An engineer expects iBGP AD 200 to beat OSPF 110 because the BGP path “looks better”; the RIB still prefers OSPF unless policy changes the route preference.
  • A more-specific prefix exists, creating the appearance that AD is being ignored.

Check for static routes first

R1# show running-config | include ^ip route

ip route 172.16.100.0 255.255.255.0 10.12.12.2

ip route 0.0.0.0 0.0.0.0 10.13.13.2 200

The first line has no explicit distance, so it uses AD 1. If this route is not intended to be primary, change or remove it.


Check protocol AD customization

R1# show ip protocols

Routing Protocol is "ospf 1"

 Administrative distance 110

Routing Protocol is "eigrp 100"

 Distance: internal 90 external 170

Operational practice: Use the distance command only when the design specifically requires it. Record any non-default distance in the network design and troubleshooting runbook.


13. Route-Selection Troubleshooting Scenarios

Symptom

Likely reason

Advanced checks

Traffic uses OSPF even though EIGRP exists

EIGRP route may be external AD 170, absent from topology, filtered, or using a different prefix length.

Check show ip route <prefix>, show ip eigrp topology, route type, prefix length and show ip protocols.

Traffic uses static path instead of OSPF

Static route defaults to AD 1.

Check show running-config | include ^ip route. Remove it or increase AD if it should float.

Floating static never activates

Primary route still exists, static next hop cannot resolve, or static route is misconfigured.

Verify show ip route, next-hop reachability, interface status and exact prefix/mask.

Floating static is primary all the time

Backup AD is lower than primary dynamic route AD.

Set the floating static AD above the primary route AD.

Router appears to ignore AD

A more-specific prefix is being used.

Use show ip route <destination> and show ip route longer-prefixes to verify LPM.

OSPF beats iBGP

Default OSPF AD 110 is lower than iBGP 200.

This is expected; do not confuse BGP path attributes with RIB AD.

eBGP unexpectedly beats EIGRP/OSPF

eBGP default AD 20 is lower than EIGRP 90 and OSPF 110.

Verify route source and design intent; change policy only if required.

Route keeps changing

Neighbor/link instability, metric change, route withdrawal, tracking event, or redistribution loop.

Check logs, protocol neighbor state, interface counters, timestamps and route update behavior.

Route is not installed at all

Next hop unresolved, route filtered, protocol adjacency down, network not advertised, or route considered invalid.

Check protocol-specific database plus RIB/FIB, not only show ip route.

Two equal routes are installed

Equal-cost multipath is supported and both paths meet protocol selection criteria.

Check show ip route and show ip cef for multiple next hops.

Advanced troubleshooting workflow

Identify the exact destination IP that is failing or taking an unexpected path.

Run show ip route <destination> and identify the most specific installed prefix.

Use show ip route longer-prefixes <summary> if you suspect a hidden more-specific route.

Record the installed route source, AD, metric, next hop, outgoing interface and route age.

Check static routes in the running configuration.

Check show ip protocols for protocol state and non-default distance values.

Inspect non-installed candidates in EIGRP topology, OSPF RIB/LSDB and BGP table.

Validate next-hop resolution and CEF forwarding.

If failover is involved, remove/restore the primary source in a lab and watch the route table change.

Confirm the final forwarding path with ping/traceroute from the correct source address and show ip cef.

Quick knowledge check

1. R1 learns 10.10.10.0/24 through internal EIGRP (AD 90) and OSPF (AD 110). Which route is normally installed?

Answer: EIGRP.

2. A packet destined for 10.10.10.150 matches /8, /16, /24, and /25 installed routes. Which prefix is used?

Answer: /25.

3. In [90/3072], what does 3072 represent?

Answer: Protocol metric

4. Which command displays Cisco Express Forwarding entries?

Answer: show ip cef displays CEF forwarding information on supported IOS/IOS XE devices.