This tutorial explains what administrative distance is and how routers use it to select the best route to a destination. Learn the AD values of some most common routing protocols.
A router can learn routing information from a variety of sources. If it learns routing information for the same destination from two or more sources, it uses the sources' AD values to decide which source is more reliable. An AD value is the trustworthiness of the source. Routers assign an AD value to each source from the range 0 – 255. In this range, a smaller number is considered more reliable than a bigger number. For example, if a source has an AD value of 40, it will be considered more reliable than a source that has an AD value of 50. Routers assign the value 0 to the most reliable source and the value 255 to the most unreliable source.
In simple words, Administrative Distance (AD) is a scale the router uses to measure the trustworthiness of a source that provides routing information.
The following table lists the default AD value of some most common routing sources.
Source | AD value |
Connected | 0 |
Static | 1 |
BGP (external routes [eBGP]) | 20 |
EIGRP (internal routes) | 90 |
IGRP | 100 |
OSPF | 110 |
IS-IS | 115 |
RIP | 120 |
EIGRP (external routes) | 170 |
BGP (internal routes [iBGP]) | 200 |
DHCP default route | 254 |
Unreliable source | 255 |
If required, you can change default AD values. You can change the default AD value of a particular routing protocol, a particular route, or even a static route. If you change the AD value of a source, the router's IOS will use the updated AD value to compare the source with other sources.
A router can learn routing information from the following sources: Interface configuration, Manual configuration, and Routing protocols. Let's discuss how AD works for each source.
A router's interface is used as the default gateway. When you assign the IP configuration to an interface, the router automatically extracts the network information from the IP configuration and adds that information to the routing table. For example, if you assign the IP address 10.0.0.1 255.0.0.0 to the F0/0 interface, the router adds the following entry to the routing table.
Network 10.0.0.0 255.0.0.0 exit interface F0/0
You can manually add routing information to the routing table.
You can configure a routing protocol. The routing protocol will learn and add all routing information to the routing table. Depending on the network topology, multiple routes to the same destination can exist.
To select the best route for each subnet, the routing protocol uses the metric. A metric is the cost of a route. The routing protocol computes the metric of all routes and compares the metrics to select the best route for each subnet. After selecting a single best route for each subnet, the routing protocol provides all routing information to the Router's IOS. The Router's IOS checks each route and adds the route to the routing table if it meets certain conditions.
If only one routing protocol is running in the network, the routing protocol's metric is sufficient to select the best route for each subnet. Different routing protocols use different metrics to select the best route. Because of this, if two or more routing protocols are running in the network, they can select different routes as the best route for the same destination.
In such a situation, the router's IOS checks the AD value of each routing protocol. The router's IOS selects the routing information of the routing protocol which has the lower AD value. For example, a router receives the routing information for the same destination from RIP and EIGRP. The AD values of RIP and EIGRP are 120 and 90, respectively. Since the AD value of EIGRP is lower than the AD value of RIP, the router will select the routing information it receives from EIGRP.
Let's take an example to understand how this process works. The following image shows a network.
In this network, Router0 has two routes to reach the network 200.0.0.0/24. The first route is via the S0/0/1 interface and the second route is via the S0/0/0 interface. Which route the router will use is depend on the routing configuration. We have two options. We can manually add the route to the routing table or we can configure a routing protocol that will select and add the best route to the routing table. If we select the first option, the router will use that. The default AD value (1) of a static route is less than all routing protocols.
If we select the second option and configure only one routing protocol in the network, the router will use the route selected by the routing protocol. Now let's suppose, we configured RIP routing protocol in this network. In this situation, Router0 will select the second route (via S0/0/0) to reach the network 200.0.0.0/24.
RIP uses the number of routers (hops) in the path to select the best route. It selects the route that has the least number of routers in the path. The following image shows the selection process.
To verify it, we can use the 'show ip route' command. The following image shows the output of this command.
Currently, only one routing protocol is running in the network. The router uses the route the routing protocol selects. If we configure another routing protocol without removing the current routing protocol and both routing protocols select different routes for the same destination, the router will use the route selected by the routing protocol that has the lower AD value. Let's understand it through the example.
Currently, RIP is running on this network. Now suppose, we configure EIGRP in this network. By default, EIGRP uses the configured bandwidth and delay on all exit interfaces of the path to compute the metric of the path. After computing the metric of all paths, it selects the path that has the least metric value.
The metric of the first route is 2684416. The metric of the second route is 256514560. Since the first route has a lower metric, EIGPR will select this route to reach the network 200.0.0.0/8. To verify this, you can use the 'show ip eigrp topology' command. The following image shows the output of this command.
Now, Router0 has two different routes reported as the best routes to reach the network 200.0.0.0/24. RIP says the second route (via - serial0/0/0) is the best route to reach the network 200.0.0.0/24. EIGRP says the first route (via – serial0/0/1) is the best route to reach the network 200.0.0.0/24.
In this situation, the router will compare the AD value of both routing protocols and will select the route reported by the routing protocol that has a lower AD value. The AD value of EIGRP is 90 and the AD value of RIP is 120. Since the AD value of EIGRP is lower than the AD value of RIP, the router will select the route reported by EIGRP. To verify, this you can use the 'show ip route' command. The following image shows the output of this command.
That's all for this tutorial. In this tutorial, we discussed what administrative distance is and how routers use it to select the best route.