A “metric” allows a router to choose the best path within a routing protocol. Distance vector routing protocols use “distance” (usually hop-count) as their metric. Link state protocols will use some sort of calculated “cost” as their metric.
Only routes with the best metric are added to the routing table, even if a particular routing protocol (for example, RIP) has four routes to the same network, only the route with the best metric (hop-count in this example) would make it to the routing table. If multiple equal-metric routes exist to a particular network, most routing protocols will load-balance. Ie Share the packets across the available routes to balance the load on each link.
If your router is running multiple routing protocols, Administrative Distance is used to determine which routing protocol to trust the most. The Lowest administrative distance wins.
If a router receives two RIP routes to the same network, it will use the routes’ metric to determine which path to use. If the metric is identical for both routes, the router will load balance between both paths.
If a router receives a RIP and an OSPF route to the same network, it will use Administrative Distance to determine which routing path to choose.
The Administrative Distance of common routing protocols (remember the lowest wins):
A route with an “unknown” Administrative Distance will never be inserted into the routing table.
Viewing the routing table
You can view a routers routing table to see which routes it knows about. This is very useful when troubleshooting.
The following command will allow you to view the routing table:
Router# show ip route
Gateway of last resort is 192.168.1.1 to network 0.0.0.0
C 192.168.1.0/24 is directly connected, Ethernet0
220.127.116.11/24 is subnetted, 1 subnets
C 18.104.22.168 is directly connected, Loopback1
C 192.168.123.0 is directly connected, Serial0
C 192.168.111.0 is directly connected, Serial1
R 10.0.0.0 [120/1] via 192.168.123.1, 00:00:00, Serial0
[120/1] via 192.168.111.2, 00:00:00, Serial1
S* 0.0.0.0/0 [1/0] via 192.168.1.1
Routes are labelled based on what protocol placed them in the table:
- C – Directly connected
- S – Static
- S* – Default route
- D – EIGRP
- R – RIP
- I – IGRP
- i – IS-IS
- O – OSPF
Notice the RIP routes contain the following field: [120/1]. This indicates both the administrative distance and the metric (the 120 is the AD, and the 1 is the hop-count metric).