Two tie-breakers: AD and metric
Sometimes a router learns the same prefix (same network, same length) in more than one way. It needs a tie-breaker. There are two:
- Administrative distance (AD): how much the router trusts the source of a route. It is a number from 0 to 255. Lower is better. It compares routes from different sources, for example a static route against an OSPF route.
- Metric: the "cost" of a path, calculated by one routing protocol. Lower is better. It compares paths learned from the same protocol. Each protocol measures it differently.
| Route source | Default AD | Metric it uses |
|---|---|---|
| Connected | 0 | - |
| Static | 1 | 0 |
| eBGP (external BGP) | 20 | Path attributes, not one number |
| EIGRP (internal) | 90 | Bandwidth and delay |
| OSPF | 110 | Cost, based on bandwidth |
| IS-IS | 115 | Cost |
| RIP | 120 | Hop count (number of routers) |
| EIGRP (external) | 170 | Bandwidth and delay |
| iBGP (internal BGP) | 200 | Path attributes |
| Unknown / unreachable | 255 | Never used |
Installation and forwarding are different decisions
Each protocol selects candidate paths using its own rules. For the same prefix, administrative distance helps the routing table choose between sources. Usable equal-cost paths may be installed when the protocol and configured multipath limits allow it.
Device key: PC1 (computer) · R1, R2, R3 (router)
Lines show the example’s network connections. Thick links: uplinks/WAN, as labelled. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.
Reading the addresses
IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.
An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.
- PC1: IP 192.168.1.10
- Server: IP 192.168.3.10
- 1. Via R2, from OSPF: R1 learns 192.168.3.0/24 through R2 with AD 110.
- 2. Via the backup link, from RIP: the same /24, one hop away, but RIP's AD is 120. Fewer hops doesn't help: different sources are compared by AD only.
- 3. Result: the OSPF route is installed. The RIP route waits in the background and is used only if the OSPF route disappears.
Why a RIP hop can't be weighed against an OSPF cost
Metrics can't be compared across protocols. An OSPF cost of 3 and a RIP hop count of 1 measure different things, like comparing kilometres with minutes. So the router first asks "which source do I trust?", using AD, and only then "which path is cheapest?", using the metric from that one source.
The default values follow a simple idea: the more the router knows first-hand, the more it trusts the route. A connected network (AD 0) is a fact. A route someone typed in (AD 1) is a strong statement. Routes heard from protocols come next.
In practice, AD earns its keep during migrations. When a second routing protocol is switched on next to the old one, the source with the lower AD quietly takes over every prefix both of them know, which is worth predicting before the change rather than discovering after.
You can change the AD of a static route by adding a number at the end of the command. The “Floating static routes” lesson uses this to build a backup route that stays hidden until it's needed.
Finding [AD/metric] in the routing table
Both numbers appear in brackets as [AD/metric]. This output is based on Cisco documentation, not run on a lab device.
R1#show ip route 192.168.3.0 Routing entry for 192.168.3.0/24 Known via "ospf 1", distance 110, metric 3, type intra area Last update from 10.0.12.2 on GigabitEthernet0/1, 00:12:31 ago Routing Descriptor Blocks: * 10.0.12.2, from 3.3.3.3, 00:12:31 ago, via GigabitEthernet0/1 Route metric is 3, traffic share count is 1
O 192.168.3.0/24 [110/3] via 10.0.12.2. The RIP route doesn't appear at all, because only the winner is installed.Test yourself on AD and metrics
R1 has a static route and an OSPF route for exactly 10.5.0.0/16. Which is installed?
OSPF offers two paths to the same network: cost 20 and cost 20. What does the router do?
OSPF offers 10.1.0.0/16 and RIP offers 10.1.1.0/24. Where does a packet to 10.1.1.9 go?
Cisco reference: Route installation, administrative distance and forwarding.