To understand the difference between the administrative distance (AD) and metric we will have to look at the purpose of both and then we will use a scenario to reinforce the concept.
Metric –Whenever you need to do a comparison between two things you need a method to measure so that you can compare and tell which of them is longer, bigger or more. Similarly when routing protocol has to compare routes in order to find a preferable or better route metric is used. Just like we have different units for measurement of different things similar to that there are the different metric for various routing protocols. Based on the Metric value the route with lower metric is put by the router in the routing table. The routing table is the collection of best routes that router maintains in its RAM and then routes packets based on that. The various metric for routing protocols are mentioned below:
RIP counts the number of routers it has to cross in order to reach a certain network and prefers a path from where there is the lower number of hop counts (or routers). OSPF uses a mechanism of allocating cost for each link where cost is inversely proportional to the bandwidth of the link. Higher the bandwidth lower will have the cost of the link. It prefers a lower cost path to select the best route for any network. To take an example have a look at the scenario below:
In the above-mentioned topology if you use RIP for routing then the path marked as A will be preferred from R1 for the network of
18.104.22.168. Hence R1 will not install route information given by R4 and will route the packets destined to the network of 22.214.171.124 through R2.
In the above-mentioned topology if you use RIP for routing then the path marked as A will be preferred from R1 for the network of 126.96.36.199. Hence R1 will not install route information given by R4 and will route the packets destined to the network of 188.8.131.52 through R2.
Administrative Distance–By definition, an administrative distance is “trustworthiness of a routing information source”. For this, there is a value from 0-255 where 0 means most trust worthy and 255 means least trustworthy. Routes with an AD value of 255 are never added in the routing table. AD value for various routing protocols is mentioned below:
|Routing Protocol||AD Value|
|EIGRP Summary route||5|
|OSPF(Open Shortest Path First)||110|
|IS-IS(Intermediate System-to-Intermediate System)||115|
So the question beginners commonly ask is “why was AD required when we had Metric?”To answer this let us take the same topology and now this time let’s say we run two routing protocols on all the routers RIP and OSPF. Now from R1 for the network of 184.108.40.206 RIP will prefer path marked as A since it has lesser hop count (or routers) to cross but on the contrary, OSPF will prefer path marked as B which has lower total cost. Both of these metric are incomparable.
This is where AD comes to help. If any router learns about the same network from multiple routing information sources then it checks the AD value to know which routing information source is more trustworthy because it only puts the best route entry in the routing table. In this case, since OSPF has a lower AD value of 110 compared to RIP’s AD value of 120, so routes learned via OSPF will be added to the routing table. On any network, there can be multiple routing information sources that can be used to learn routes. Hence AD value becomes important as well.
AD is locally significant. So even if you change it at one router it does not affect the other routers
I hope this clears the difference between AD and Metric. If you still feel some doubt feel free to drop a comment and I will clarify.