Administrative distance (AD) is how a router determines which source of routes it should use if it has two identical routes from different sources. In other words, the router needs to be able to determine which routes to trust if it's receiving the same information from two different sources. For a better idea, consider trying to decide which local news program, all of which more or less cover the same events, is most trustworthy.
If you only have one router with one routing protocol and one WAN circuit, or if you're only using static routes, administrative distance doesn't affect your situation. But that doesn't mean you shouldn't be familiar with its purpose.
But if you have a slightly more complex networkâ€”say you have two WAN circuits or you're using two routing protocols (even if one of them is static routing)â€”administrative distance takes on more importance.
The sources of the routes aren't only routing protocols, such as RIP, OSPF, or BGP. Possible sources can also be connected routes (i.e., the interfaces on the router) and static routes (which you entered as network administrator).
The router determines which source is the most trustworthy (i.e., reliable) according to the administrative distance. The lower the administrative distance, the more trustworthy the routing source.
To help make this decision, routers contain a preprogrammed table that lists all of the possible sources and their default administrative distances. Listing A offers an example of what this table looks like. (While administrators can change default administrative distances by using the distance command in Router Configuration Mode, this is usually not advisable.)
SOURCE OF THE ROUTE DEFAULT DISTANCE Connected Interface or static route to an Interface 0 Static route to an IP Address 1 EIGRP Summary 5 BGP External 20 EIGRP Internal 90 IGRP 100 OSPF 110 IS-IS 115 RIP 120 EIGRP External 170 BGP Internal 200 Unknown Source 255
The main considerations while building the routing table are:
Administrative distance - This is the measure of trustworthiness of the source of the route. If a router learns about a destination from more than one routing protocol, administrative distance is compared and the preference is given to the routes with lower administrative distance. In other words, it is the believability of the source of the route.
Metrics - This is a measure used by the routing protocol to calculate the best path to a given destination, if it learns multiple paths to the same destination. Each routing protocol uses a different metric.
As each routing process receives updates and other information, it chooses the best path to any given destination and attempts to install this path into the routing table. For instance, if EIGRP learns of a path toward 10.1.1.0/24, and decides this particular path is the best EIGRP path to this destination, it tries to install the path it has learned into the routing table.
The router decides whether or not to install the routes presented by the routing processes based on the administrative distance of the route in question. If this path has the lowest administrative distance to this destination (when compared to the other routes in the table), it's installed in the routing table. If this route isn't the route with the best administrative distance, then the route is rejected.
To understand this better, let's look at an example. Assume a router has four routing processes running: EIGRP, OSPF, RIP, and IGRP. Now, all four of these processes have learned of various routes to the 192.168.24.0/24 network, and each has chosen its best path to that network through its internal metrics and processes.
Each of these four processes attempts to install their route toward 192.168.24.0/24 into the routing table. The routing processes are each assigned an administrative distance, which is used to decide which route to install.
|Default Administrative Distances|
|EIGRP summary route||5|
Since the internal EIGRP route has the best administrative distance (the smaller the administrative distance, the higher the preference), it's installed in the routing table.
What do the other protocols, RIP, IGRP, and OSPF, do with the routes that weren't installed? What if the most preferred route, learned from EIGRP, fails? Cisco IOSÂ® Software uses two approaches to solve this problem: The first is to have each routing process attempt to install its best routes periodically. If the most preferred route fails, the next best route (according to administrative distance) succeeds on the next attempt. The other solution is for the routing protocol that failed to install its route in the table to hang on to the route, and tell the routing table process to report if the best path fails.
For protocols that don't have their own routing information tables, such as IGRP, the first method is used. Every time IGRP receives an update about a route, it attempts to install the updated information in the routing table. If there's already a route to this same destination in the routing table, the installation attempt fails.
For protocols that have their own database of routing information, such as EIGRP, IS-IS, OSPF, BGP, and RIP, a backup route is registered when the initial attempt to install the route fails. If the route installed in the routing table fails for some reason, the routing table maintenance process calls each routing protocol process that has registered a backup route, and asks them to reinstall the route in the routing table. If there are multiple protocols with registered backup routes, the preferred route is chosen based on administrative distance.
The default administrative distance might not always be right for your network; you may want to adjust them so that RIP routes are preferred over IGRP routes, for instance. Before explaining how to adjust the administrative distances, we need to look at the implications of changing the administrative distance.
Changing the administrative distance on routing protocols can be very dangerous! Changing the default distances can actually lead to routing loops and other oddities in your network. We recommend you change administrative distance with caution, and only after you have thought through what you want to achieve, and all the consequences of your actions.
For entire protocols, changing the distance is relatively easy; simply configure the distance using the distance command in the routing process sub-configuration mode. You can also change the distance for routes learned from one source only in some protocols, and you can change the distance on just some routes. For more information, refer to Adjust Administrative Distance for Route Selection in Cisco IOS Routers Configuration Example .
For static routes, you can change the distance of each route by entering a distance after the ip route command:
ip route network subnet mask next hop distance
You can't change the administrative distance for all the static routes at once.