Cisco Administrative Distance Tutorial

In this Cisco CCNA training tutorial, you’ll learn about administrative distance. Administrative Distance (AD) is used along with the metric to decide which of the available paths is going to make into the routing table. Scroll down for the video and text tutorial.

Cisco Administrative Distance Video Tutorial

YouTube video

Rob Hunton

Rob Hunton

Just a note to say, I’ve passed the CCNA exam. Thanks for producing the course. I must have bought 4 or 5 courses over the years and yours are by far the best ones I’ve learned from.

Rob Hunton

 

Metric

A router will typically only learn routes to a particular destination from a single routing protocol. It's not normal for an organization to be running multiple different routing protocols.

 

When multiple routes to a destination are learned through a routing protocol, the router will install the path or paths with the best (lowest) metric into the routing table. Different routing protocols use different methods to calculate the metric.

Cisco Metric

For example, we're using RIP as our routing protocol. We would want to get to our particular destination and we have two different paths to get there.

 

The first path goes from router A to B, to C, to D. So A to B, to C, to D would be a hop count of three. The other path is A to B to D, which would have a hop count of two.

 

RIP uses hop count as its metric. Therefore, it will put the path with the shortest hop count into the routing table. In our example, the path A to B to D would be preferred.

Cisco Metric 1

Using the same network topology with OSPF, let’s say path A to B to C to D has a cost of 60 and path A to B to D has a cost of 100 because it has lower bandwidth links.

 

OSPF takes the lowest bandwidth into account by default. All metrics prefer the lowest value therefore, with OSPF, the path A to B to C to D will be taken and will be added into the routing table.

 

If there are paths going to the same destination which are coming from different routing protocols, then the receiving router can't compare their metrics with each other.

 

For example, a RIP hop count of 5 can't be compared to an OSPF cost of 60. That comparison would be meaningless because every routing protocol calculates its own metric in a completely different way.

 

The router needs to use a different method in order to choose which routing protocol is going to be used. Hence, when routes to the same destination are received from different routing protocols, the router will use the administrative distance to determine the path that it would take.

Cisco Administrative Distance

Administrative Distance

The Administrative Distance (AD) is a measure of how trusted a particular routing protocol is. If routes to the same destination are received via different routing protocols, the protocol with the best (lowest) administrative distance wins.

 

Similar to the metric, the administrative distance with the lowest value will be preferred.

Cisco Administrative Distance 1

Default Administrative Distance

The default administrative distance values of our popular routing protocols can be seen in the table below. The worst is RIP, with an AD value of 120. EIGRP, the most preferred IGP, has an AD of 90, and the connected interfaces will always be the most preferred with an AD value of zero.

Default Administrative Distance

Administrative Distance and Metric

The difference between administrative distance and metric is that AD is used to choose between multiple paths learned via different routing protocols. Metric, on the other hand, is used to choose between multiple paths learned with the same routing protocol.

 

The administrative distance is considered first to narrow the choice down to the single best routing protocol. Then, the metric is considered next to choose the best path or paths which will make into the routing table.

Administrative Distance and Metric

show ip route

The show ip route command will show us what routes made into the routing table. In our example below, the connected routes have an administrative distance of zero. Therefore, they are going to be the most preferred.

 

There are some routes that were learned from RIP as well. The digits in the square brackets show the administrative distance and the metric.

 

The first value between the brackets is the administrative distance, we already know that RIP has an AD of 120. The second value is the metric. In this example, we can see that the first route has a hop count of one and the second route has a hop count of two.

show ip route

Administrative Distance Example

For example, we have a router and it receives multiple routes to the 10.10.10.0/24 network. It receives those routes from both OSPF and RIP.

 

When paths to the same destination are received from multiple routing protocols, the administrative distance is considered first before the metric. OSPF has a better AD of 110 compared to RIP with an AD of 120, therefore, the RIP routes will be discarded consequently.

Administrative Distance Example

The router will then compare the routes that we've received via OSPF and place the one with the lowest cost into the routing table. If there are multiple equal cost paths, all of the routes will go into the routing table and the router will load balance between them.

Administrative Distance Example 1

Floating Static Routes

When the router detects that the best path to a destination is lost, a link went down for an instance, the router will remove the route and replace it with the next best route.

 

We might want to configure a static route as a backup for the route learned via a routing protocol. However, static routes have a default administrative distance of 1 which will always be preferred over the routes that are learned via an IGP.

Floating Static Routes

If we're running an IGP, its routes are not going to be preferred. The added static route won't work as a backup by default because it is going to be preferred over the IGP routes.

 

In order to make the static route as a backup, we have to configure it as a floating static route. We will change the AD of the static route from the default AD of 1 to a value which higher than the AD of our current routing protocol.

Floating Static Routes - OSPF

We have an example network topology below. We’re running OSPF along the path from R4 to R3, to R2 and to R1. R5 is not running and does not support OSPF.

 

OSPF is used in the first path, going along the top from R4 to R3, to R2, and to R1. Then, we would configure a backup static route on R4 that is going to send the traffic through R5 if the top path is not available.

Floating Static Routes - OSPF

We can't add a normal static route because the traffic would go through R5 as its preferred route. So, we create a floating static route with the command:

ip route 10.0.1.0 255.255.255.0 10.1.3.2 115

We will set the R5 as the next hop and the number at the end of the command sets its AD value as 115. The set AD value must be higher than the OSPF AD of 110, this will be then used as the backup route.

 

Now, we would also need to add static routes coming back in the other direction along the bottom path. We also need a static route going from R5 to R1.

Floating Static Routes -Static Routes

You can use floating static routes where you're using static routes only. For example, on R4, I can reach the 10.0.1.0/24 network by going through my first choice (preferred) path through 10.1.1.2, which is on R3. I could have my second choice or backup route via 10.1.3.2, which is on R5.

 

I would do that by giving the backup route an administrative distance value of 5. If I entered both of these routes without setting the administrative distance of the second path, the traffic would load balance between the two routes.

Floating Static Routes -Static Routes

By configuring the second route to have an AD of 5, only the first route will be placed into the routing table. But if the link from R4 to R3 goes down, the route will be removed from the routing table and it will use the second route, R4 to R5, instead.

 

A word of warning with this. In our first example, if you do a floating static route as a backup for OSPF and if any of the links from R4 to R1 goes down, OSPF will detect that and the route will be removed from the routing table. It will work just fine.

 

In our second example, if the link from R4 to R3 goes down, R4 will detect that and it will work just fine. But if the link from R3 to R2, or R2 to R1 goes down, R1 would not know about it. R1 will continue sending traffic along the top path. The traffic will only get as far as R3 where the broken link is and then the traffic is going to fail.

 

Floating static routes will work fine if you have a router to router connection, without other routers along the path. If not, be careful with this one or you could end up causing problems.

Cisco Administrative Distance Configuration Example

YouTube video

This configuration example is taken from my free ‘Cisco CCNA Lab Guide’ which includes over 350 pages of lab exercises and full instructions to set up the lab for free on your laptop.

 

Click here to download your free Cisco CCNA Lab Guide.

 

Cisco Administrative Distance Configuration Example

  1. Enter the command below to remove OSPF on every router

no router ospf 1

2. Will R1 still have connectivity to R4?

Yes. RIP is still running so RIP routes will replace the removed OSPF routes in the routing table.

R1#show ip route

Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2

i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

ia - IS-IS inter area, * - candidate default, U - per-user static route

o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP

+ - replicated route, % - next hop override

 

Gateway of last resort is not set

 

10.0.0.0/8 is variably subnetted, 10 subnets, 2 masks

C 10.0.1.0/24 is directly connected, FastEthernet0/1

L 10.0.1.1/32 is directly connected, FastEthernet0/1

C 10.0.2.0/24 is directly connected, FastEthernet1/0

L 10.0.2.1/32 is directly connected, FastEthernet1/0

C 10.0.3.0/24 is directly connected, FastEthernet1/1

L 10.0.3.1/32 is directly connected, FastEthernet1/1

R 10.1.0.0/24 [120/3] via 10.0.3.2, 00:00:12, FastEthernet1/1

R 10.1.1.0/24 [120/2] via 10.0.3.2, 00:00:12, FastEthernet1/1

R 10.1.2.0/24 [120/2] via 10.0.3.2, 00:00:12, FastEthernet1/1

R 10.1.3.0/24 [120/1] via 10.0.3.2, 00:00:12, FastEthernet1/1

3. What is the metric to the 10.1.1.0/24 network on R1?

A hop count of 2.

4. Why is there only one route on R1 to the 10.1.1.0/24 network now?

Interface FastEthernet 0/0 on R2 is still shut down so no routes go through it.

5. Make the required change so that there are two routes to the 10.1.1.0/24 network in the routing table on R1.

R2(config)#interface f0/0

R2(config-if)#no shut

R1#show ip route

Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default, U - per-user static route, o - ODR

P - periodic downloaded static route

 

Gateway of last resort is not set

 

10.0.0.0/8 is variably subnetted, 12 subnets, 2 masks

C 10.0.0.0/24 is directly connected, FastEthernet0/0

L 10.0.0.1/32 is directly connected, FastEthernet0/0

C 10.0.1.0/24 is directly connected, FastEthernet0/1

L 10.0.1.1/32 is directly connected, FastEthernet0/1

C 10.0.2.0/24 is directly connected, FastEthernet1/0

L 10.0.2.1/32 is directly connected, FastEthernet1/0

C 10.0.3.0/24 is directly connected, FastEthernet1/1

L 10.0.3.1/32 is directly connected, FastEthernet1/1

R 10.1.0.0/24 [120/1] via 10.0.0.2, 00:00:03, FastEthernet0/0

R 10.1.1.0/24 [120/2] via 10.0.3.2, 00:00:15, FastEthernet1/1

   [120/2] via 10.0.0.2, 00:00:03, FastEthernet0/0

R 10.1.2.0/24 [120/2] via 10.0.3.2, 00:00:15, FastEthernet1/1

R 10.1.3.0/24 [120/1] via 10.0.3.2, 00:00:15, FastEthernet1/1

6. Enter the commands below on each router to provision a basic EIGRP configuration and enable EIGRP on every interface.

router eigrp 100

no auto-summary

network 10.0.0.0 0.255.255.255

7. What changes do you expect to see in the routing tables? Why?

The RIP routes will be replaced by EIGRP because its Administrative Distance of 90 is preferred to RIP’s AD of 120.

8. Verify the changes to the routing table on R1.

R1#show ip route

Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2

i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

ia - IS-IS inter area, * - candidate default, U - per-user static route

o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP

+ - replicated route, % - next hop override

 

Gateway of last resort is not set

 

10.0.0.0/8 is variably subnetted, 12 subnets, 2 masks

C 10.0.0.0/24 is directly connected, FastEthernet0/0

L 10.0.0.1/32 is directly connected, FastEthernet0/0

C 10.0.1.0/24 is directly connected, FastEthernet0/1

L 10.0.1.1/32 is directly connected, FastEthernet0/1

C 10.0.2.0/24 is directly connected, FastEthernet1/0

L 10.0.2.1/32 is directly connected, FastEthernet1/0

C 10.0.3.0/24 is directly connected, FastEthernet1/1

L 10.0.3.1/32 is directly connected, FastEthernet1/1

D 10.1.0.0/24 [90/30720] via 10.0.0.2, 00:00:32, FastEthernet0/0

D 10.1.1.0/24 [90/33280] via 10.0.0.2, 00:00:29, FastEthernet0/0

D 10.1.2.0/24 [90/35840] via 10.0.0.2, 00:00:25, FastEthernet0/0

D 10.1.3.0/24 [90/261120] via 10.0.3.2, 00:00:19, FastEthernet1/1

9. What is the metric to the 10.1.1.0/24 network on R1?

A composite metric of 33280.

10. Why is there only one route to the 10.1.1.0/24 network on R1?

EIGRP uses a composite metric that takes into account interface bandwidth and delay. The interfaces on R5 have a configured bandwidth of 10Mbps. The interfaces along the top path of the network topology all have the default FastEthernet bandwidth of 100Mbps so this route is preferred. All traffic will go via the next hop 10.0.0.2.

11. Disable RIP and EIGRP on R5 with the commands below.

R5(config)#no router rip

R5(config)#no router eigrp 100

12. Configure the network so that there is still connectivity between all subnets if the link between R1 and R2 goes down. Accomplish this with six commands. Do not enable EIGRP on R5 but note that the routing protocol is expected to be enabled there in the future.

Floating static routes need to be added as a backup to the EIGRP routes. We want to ensure EIGRP routes are preferred when available so set the AD to be higher than EIGRP’s AD of 90.

R1(config)#ip route 10.1.0.0 255.255.0.0 10.0.3.2 95

R2(config)#ip route 10.0.0.0 255.255.0.0 10.1.0.1 95

R3(config)#ip route 10.0.0.0 255.255.0.0 10.1.1.1 95

R4(config)#ip route 10.0.0.0 255.255.0.0 10.1.3.2 95

R5(config)#ip route 10.0.0.0 255.255.0.0 10.0.3.1 95

R5(config)#ip route 10.1.0.0 255.255.0.0 10.1.3.1 95

R5 is not running EIGRP so it is not currently necessary to set the Administrative Distance for its routes to 95. It is required to prevent the floating static routes from being preferred when EIGRP is enabled in the future, however.

Summary routes need to be used to accomplish the task in six commands.

13. What changes do you expect to see to the routing table on R1?

The summary route will be added to the routing table but not used because it has a prefix length of /16, compared to the EIGRP routes which have a longer prefix length of /24.

If individual floating static routes had been added for each of the /24 destination networks then these would not have appeared in the routing table (unless a link went down) because EIGRP has a better Administrative Distance.

14. Verify the changes to the routing table on R1.

R1#sh ip route

Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2

i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

ia - IS-IS inter area, * - candidate default, U - per-user static route

o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP

+ - replicated route, % - next hop override

 

Gateway of last resort is not set

 

10.0.0.0/8 is variably subnetted, 13 subnets, 3 masks

C 10.0.0.0/24 is directly connected, FastEthernet0/0

L 10.0.0.1/32 is directly connected, FastEthernet0/0

C 10.0.1.0/24 is directly connected, FastEthernet0/1

L 10.0.1.1/32 is directly connected, FastEthernet0/1

C 10.0.2.0/24 is directly connected, FastEthernet1/0

L 10.0.2.1/32 is directly connected, FastEthernet1/0

C 10.0.3.0/24 is directly connected, FastEthernet1/1

L 10.0.3.1/32 is directly connected, FastEthernet1/1

S 10.1.0.0/16 [95/0] via 10.0.3.2

D 10.1.0.0/24 [90/30720] via 10.0.0.2, 00:04:48, FastEthernet0/0

D 10.1.1.0/24 [90/33280] via 10.0.0.2, 00:04:45, FastEthernet0/0

D 10.1.2.0/24 [90/35840] via 10.0.0.2, 00:04:41, FastEthernet0/0

D 10.1.3.0/24 [90/266240] via 10.0.0.2, 00:03:02, FastEthernet0/0

15. Verify that traffic from PC1 to PC3 still goes via R2.

C:\>tracert 10.1.2.10

Tracing route to 10.1.2.10 over a maximum of 30 hops:

1 1 ms 0 ms 1 ms 10.0.1.1

2 0 ms 3 ms 0 ms 10.0.0.2

3 1 ms 0 ms 0 ms 10.1.0.1

4 0 ms 1 ms 0 ms 10.1.1.1

5 * 0 ms 0 ms 10.1.2.10

Trace complete.

16. Shut down interface FastEthernet 0/0 on R2.

R2(config)#interface f0/0

R2(config-if)#shutdown

17. What changes do you expect to see on R1’s routing table?

The EIGRP routes will be removed.

18. Verify the changes to the routing table on R1.

R1#show ip route

Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2

i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

ia - IS-IS inter area, * - candidate default, U - per-user static route

o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP

+ - replicated route, % - next hop override

 

Gateway of last resort is not set

 

10.0.0.0/8 is variably subnetted, 7 subnets, 3 masks

C 10.0.1.0/24 is directly connected, FastEthernet0/1

L 10.0.1.1/32 is directly connected, FastEthernet0/1

C 10.0.2.0/24 is directly connected, FastEthernet1/0

L 10.0.2.1/32 is directly connected, FastEthernet1/0

C 10.0.3.0/24 is directly connected, FastEthernet1/1

L 10.0.3.1/32 is directly connected, FastEthernet1/1

S 10.1.0.0/16 [95/0] via 10.0.3.2

19. Verify connectivity between PC1 and PC3.

C:\>ping 10.1.2.10

Pinging 10.1.2.10 with 32 bytes of data:

Reply from 10.1.2.10: bytes=32 time=1ms TTL=125

Reply from 10.1.2.10: bytes=32 time=1ms TTL=125

Reply from 10.1.2.10: bytes=32 time=1ms TTL=125

Reply from 10.1.2.10: bytes=32 time<1ms TTL=125

 

Ping statistics for 10.1.2.10:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 1ms, Average = 0ms

20. Verify the traffic goes via R5.

C:\>tracert 10.1.2.10

Tracing route to 10.1.2.10 over a maximum of 30 hops:

1 0 ms 0 ms 1 ms 10.0.1.1

2 0 ms 0 ms 0 ms 10.0.3.2

3 0 ms 0 ms 0 ms 10.1.3.1

4 0 ms 0 ms 1 ms 10.1.2.10

Trace complete.

21. Bring interface FastEthernet 0/0 on R2 back up.

R2(config)#interface f0/0

R2(config-if)#no shutdown

22. Enter the commands below on R5 to provision a basic EIGRP configuration and enable EIGRP on every interface.

R5(config)#router eigrp 100

R5(config-router)#no auto-summary

R5(config-router)#network 10.0.0.0 0.255.255.255

Additional Resources

What Is Administrative Distance?: https://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/15986-admin-distance.html

Administrative Distance & Metric: https://study-ccna.com/administrative-distance-metric/

Introduction to Administrative Distance: https://networklessons.com/cisco/ccna-routing-switching-icnd1-100-105/introduction-to-administrative-distance

Want to practice Cisco CCNA technologies on your laptop? Download my complete 350-page Cisco CCNA Lab Guide for free.

 

Click Here to get my Cisco CCNA Gold Bootcamp, the highest rated CCNA course online with a 4.8 star rating from over 20,000 public reviews.

 

Libby Teofilo

Text by Libby Teofilo, Technical Writer at www.flackbox.com

With a mission to spread network awareness through writing, Libby consistently immerses herself into the unrelenting process of knowledge acquisition and dissemination. If not engrossed in technology, you might see her with a book in one hand and a coffee in the other.