Administrative Distance

How do we choose which route to install into forwarding table from the routing table? If longest prefix matches are equal, Cisco routers use the Administrative Distance (AD) of a route to determine which one is “best”. 

In general, a lower AD means the route can be more trusted. The default distances are listed below, but it’s easy to change the AD of a particular routing protocol on a router.

+-------------------------------+------+
| Route Source Default Distance | |
+-------------------------------+------+
| Connected interface | 0 |
| Static route | 1 |
| EIGRP summary route | 5 |
| BGP | 20 |
| Internal EIGRP | 90 |
| IGRP | 100 |
| OSPF | 110 |
| IS-IS | 115 |
| RIP | 120 |
| EGP | 140 |
| ODR | 160 |
| External EIGRP | 170 |
| Internal BGP | 200 |
| Unknown | 255 |
+-------------------------------+------+

 

To change the AD of a protcol, use the distance command under most routing protocols. You can see distances in “show ip protocols”. 

EIGRP

Change AD in EIGRP, first number is internal, second external. 

router eigrp 10
distance eigrp 15 190

If you need to change the AD of a EIGRP summary route, 

int gi1
ip summary-address eigrp 10 192.168.0.0 255.255.255.0 95
! 10 = EIGRP AS
! 192.168.0.0 255.255.255.0 = subnet
! 95 = administrative distance

OSPF 

router ospf 1
distance 77

If you need to change the distance of a redistributed protocol, such as EIGRP: 

router ospf 1
 redistribute eigrp 1 subnets
 distance ospf external 10

 

BGP 

The BGP distance command uses three distances, the first external, second internal, third local: 

router bgp 65101
distance bgp 25 26 27

 

Using administrative distance is a great way to execute a routing protocol changeover. You can set the new protocol to a higher AD, enable it on your links and check the topology tables, LSDB, and RIB as applicable and be confident your new protocol converges. Then, flip the AD and the new protocol will takeover.