Wednesday, February 19, 2020

How to configure Administrative Distance

When two or more sources are giving you information about a certain prefix you need to choose which information you are going to use. For example OSPF might tell you to go “left” if you want to reach network X, EIGRP might tell you that you need to go “right”. Who do you trust? OSPF or EIGRP? You can’t put both in the routing table for network X.
The administrative distance solves this problem. When two sources give us information about the exact same network we’ll have to make a decision and it’s done by looking at the administrative distance. Let me show you the different values:
SourceAdministrative Distance
Directly connected0
Static route1
EIGRP summary5
External BGP20
EIGRP90
IGRP100
OSPF110
IS-IS115
RIP120
ODR160
External EIGRP170
Internal BGP200
Unknown255
The lower the better…as you can see EIGRP has a lower administrative distance (90) than OSPF (110) so we will use EIGRP in my example.
Keep in mind:
  • The administrative distance is only local and can be different for each router.
  • The administrative distance can be modified.
Especially when we use redistribution we sometimes have to change the administrative distance. Let me show you how you can do this:
R1(config)#router eigrp 12      
R1(config-router)#distance eigrp 90 160
Above we have EIGRP and with the distance command I can change the administrative distance for EIGRP globally. Internal EIGRP will keep its AD of 90 but external EIGRP will have an AD of 160. You will see this change in the routing table:
R1#show ip route eigrp 
     3.0.0.0/24 is subnetted, 1 subnets
D EX    3.3.3.0 [160/1734656] via 192.168.12.2, 00:00:30, FastEthernet0/0
D EX 192.168.23.0/24 [160/1734656] via 192.168.12.2, 00:00:30,FastEthernet0/0
You can verify it by looking at the routing table, the external networks on router R1 now have an AD of 160.
We can change the AD of the other routing protocols as well, here are some examples:
R1(config)#router ospf 1
R1(config-router)#distance ospf external 150 inter-area 80 intra-area 80
For OSPF you can change the external, inter-area and intra-area administrative distance. In my example I’ve set the external distance (type 5 and 7 external LSAs) to 150. Inter-area distance is 80 and intra-area is 80. This means that your router will now prefer OSPF information above EIGRP (AD 90).
The downside of the two examples above is that it applies to all prefixes. I can also change the administrative distance only for certain prefixes, here’s how to do it:
R1(config)#router rip
R1(config-router)#distance 70 0.0.0.0 255.255.255.255 MY_PREFIXES
R1(config)#ip access-list standard MY_PREFIXES
R1(config-std-nacl)#permit 1.1.1.0 0.0.0.255
I use the distance command and combine it with a standard access-list called “MY_PREFIXES”. All networks that match this access-list will have their AD changed to 70.
R1#show ip route rip 
R    192.168.12.0/24 [120/10] via 192.168.23.2, 00:00:15, FastEthernet0/0
     1.0.0.0/24 is subnetted, 1 subnets
R       1.1.1.0 [70/10] via 192.168.23.2, 00:00:15, FastEthernet0/0
Above you see the new administrative distance for network 1.1.1.0 /24.
That’s all I wanted to show you for now, if you have any questions feel free to ask!


No comments:

Post a Comment