Thursday 29 June 2023

What is Administrative Distance? How to change AD value of OSPF, EIGRP, RIPv2 and BGP?

 

 

Administrative Distances

The administrative distance is used to rate the accuracy of routing protocol information received on a router from a neighbor router. An administrative distance is an integer value ranging from 0 to 255, where 0 means most trusted and 255 untrusted no traffic will be passed through this route or this route will never be installed in the routing table.

 




What will happen if our router receives two updates for the same remote network?

The first task our route will do is to check the administrative distance (AD). If one of the two updates has a lower AD than the other route.  our router will install a lower AD route in the routing table.

Now again, what will happen if both the advertise updates have the same AD for the same remote network?

In this case, our router will find the best path for the remote network by comparing routing protocol metrics like hop count or the bandwidth of the lines depending on the routing protocol. The lowest metric will win and our router will install the route in the routing table.

Now one more time again, what if both advertise updates (route) have the same AD, and the same metric which route a router will install in its routing table?

The answer is router will do load balances to the remote network.

 

The administrative distance default values

Route source (protocol)

Default Administrative distance (AD)

Connected interface

0

Static route

1

Enhanced Interior Gateway Routing Protocol (EIGRP) summary route

5

External Border Gateway Protocol (BGP)

20

Internal EIGRP

90

IGRP

100

Open Shortest Path First OSPF OSPF

110

Intermediate System-to-Intermediate System (IS-IS)

115

Routing Information Protocol (RIP)

120

Exterior Gateway Protocol (EGP)

 

140

On-Demand Routing (ODR)

 

160

External EIGRP

 

 

170

Internal BGP

 

200

Unknown*

 

255

 if you want to change the default administrative distance value yes you can change it, so let's configure the experiment here we are going to advertise the same remote network with 5 different protocols. let's see the router will install which route and then we will change the default AD and see the router action.

(If you are familiar with Internetworks blogs you know we come straight to the point and like LABS, I request you please visit our YouTube program and click here thank you) 



Topology: -


  • configure the topology as per the diagram 
  • assign the IP addresses to their ports as per the topology
  • configure a static route between routers 1-2-7
  • configure EIGRP routing between routers 1-3-7
  • configure OSPF routing between routers 1-4-7 
  • configure RIPv2 routing between routers 1-5-7
  • configure IBGP routing between routers 1-6-7
  • advertise directly connected network
  • now you will see all the routers (R2, R3, R4, R5 and R6) advertising the same network 20.1.1.0 with different administrative distance
  • now ping from PC-1 to PC-2 and see which path router-1 will choose in order to reach the 20.0.0.0 network. 


Router-1#show ip interface brief
Interface                  IP-Address      OK? Method Status         Protocol
FastEthernet0/0       10.1.1.1        YES NVRAM  up                    up
Serial2/0                  12.2.2.1        YES NVRAM  up                    up
Serial2/1                  13.3.3.1        YES NVRAM  up                    up
Serial2/2                  14.4.4.1        YES NVRAM  up                    up
Serial2/3                  15.5.5.1        YES NVRAM  up                    up
Serial4/7                  16.6.6.1        YES NVRAM  up                    up


Router-2#show ip interface brief

Interface                  IP-Address      OK? Method Status           Protocol

Serial2/0                  12.2.2.2        YES NVRAM  up                    up

Serial4/4                  27.2.2.1        YES NVRAM  up                    up


Router-3#show ip interface brief
Interface                  IP-Address      OK? Method Status           Protocol
Serial2/1                  13.3.3.2        YES NVRAM  up                    up
Serial4/3                  37.3.3.1        YES NVRAM  up                    up




Router-4#show ip interface brief
Interface                  IP-Address      OK? Method Status           Protocol
Serial2/2                  14.4.4.2        YES NVRAM  up                    up
Serial4/2                  47.4.4.1        YES NVRAM  up                    up



Router-5#show ip interface brief
Interface                  IP-Address      OK? Method Status          Protocol
Serial2/3                  15.5.5.2        YES NVRAM  up                    up
Serial4/1                  57.5.5.1        YES NVRAM  up                    up



Router-6#show ip interface brief
Interface                  IP-Address      OK? Method Status            Protocol
Serial4/0                  67.6.6.1        YES NVRAM  up                    up
Serial4/7                  16.6.6.2        YES NVRAM  up                    up

R7#show ip interface brief
Interface                  IP-Address      OK? Method Status          Protocol
FastEthernet0/0       20.1.1.1        YES NVRAM  up                    up
Serial4/0                  67.6.6.2        YES NVRAM  up                    up
Serial4/1                  57.5.5.2        YES NVRAM  up                    up
Serial4/2                  47.4.4.2        YES NVRAM  up                    up
Serial4/3                  37.3.3.2        YES NVRAM  up                    up
Serial4/4                  27.2.2.2        YES NVRAM  up                    up

(As of now we have assigned the IP addresses)


(Configure a static route between routers 1-2-7)


Router-1(config)#ip route 20.0.0.0 255.0.0.0 12.2.2.2
Router-1(config)#ip route 27.0.0.0 255.0.0.0 12.2.2.2
Router-1(config)#exit

Router-1#show ip route static
S    20.0.0.0/8 [1/0] via 12.2.2.2
S    27.0.0.0/8 [1/0] via 12.2.2.2

Router-2(config)#ip route 20.0.0.0 255.0.0.0 27.2.2.0
Router-2(config)#ip route 10.0.0.0 255.0.0.0 12.2.2.1
Router-2(config)#exit

Router-2#show ip route static
S    20.0.0.0/8 [1/0] via 27.2.2.0
S    10.0.0.0/8 [1/0] via 12.2.2.1


R7(config)#ip route 10.0.0.0 255.0.0.0 27.2.2.1
R7(config)#ip route 12.0.0.0 255.0.0.0 27.2.2.1
R7(config)#exit

S    10.0.0.0/8 [1/0] via 27.2.2.1
S    12.0.0.0/8 [1/0] via 27.2.2.1


(Configure EIGRP routing between routers 1-3-7)

Router-1(config)#router eigrp 100
Router-1(config-router)#network 10.0.0.0
Router-1(config-router)#network 13.0.0.0
Router-1(config-router)#no auto-summary
Router-1(config-router)#exit

*Jun 28 15:50:45.319: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 13.3.3.2 (Serial2/1) is up: new adjacency
                                                                                                                                                                    

Router-1#show ip protocols
Routing Protocol is "eigrp 100"

  Maximum path: 4
  Routing for Networks:
    10.0.0.0
    13.0.0.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    13.3.3.2              90      00:00:23
  Distance: internal 90 external 170


Router-3(config)#router eigrp 100
Router-3(config-router)#network 13.0.0.0
Router-3(config-router)#network 37.0.0.0
Router-3(config-router)#no auto-summary
Router-3(config-router)#exit


Router-3#show ip protocols
Routing Protocol is "eigrp 100"

  Maximum path: 4
  Routing for Networks:
    13.0.0.0
    37.0.0.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    13.3.3.1              90      00:03:28
    37.3.3.2              90      00:02:37
  Distance: internal 90 external 170


R7(config)#router eigrp 100
R7(config-router)#network 20.0.0.0
R7(config-router)#network 37.0.0.0
R7(config-router)#no auto-summary
R7(config-router)#exit
R7(config)#end

R7#show ip protocols
Routing Protocol is "eigrp 100"
  
  Maximum path: 4
  Routing for Networks:
    20.0.0.0
    37.0.0.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    37.3.3.1              90      00:04:41
  Distance: internal 90 external 170


(Configure OSPF routing between routers 1-4-7)

Router-1(config)#router ospf 100
Router-1(config-router)#network 10.0.0.0 0.255.255.255 area 0
Router-1(config-router)#network 14.0.0.0 0.255.255.255 area 0
Router-1(config-router)#exit

Router-1#show ip protocol
Routing Protocol is "ospf 100"

  Router ID 16.6.6.1
  Maximum path: 4
  Routing for Networks:
    10.0.0.0 0.255.255.255 area 0
    14.0.0.0 0.255.255.255 area 0
 Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
    47.4.4.1             110      00:01:10
    67.6.6.2             110      00:00:25
  Distance: (default is 110)

Router-4(config)#router ospf 100
Router-4(config-router)#network 14.0.0.0 0.255.255.255 area 0
Router-4(config-router)#network 47.0.0.0 0.255.255.255 area 0
Router-4(config-router)#exit

Router-4#show ip protocol
Routing Protocol is "ospf 100"

  Router ID 47.4.4.1
  Maximum path: 4
  Routing for Networks:
    14.0.0.0 0.255.255.255 area 0
    47.0.0.0 0.255.255.255 area 0
 Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
    16.6.6.1             110      00:01:31
    67.6.6.2             110      00:00:36
  Distance: (default is 110)


R7(config)#router ospf 100
R7(config-router)#network 47.0.0.0 0.255.255.255 area 0
R7(config-router)#network 20.0.0.0 0.255.255.255 area 0
R7(config-router)#exit
R7(config)#end

Routing Protocol is "ospf 100"

  Router ID 67.6.6.2
  Maximum path: 4
  Routing for Networks:
    20.0.0.0 0.255.255.255 area 0
    47.0.0.0 0.255.255.255 area 0
 Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
    16.6.6.1             110      00:00:45
    47.4.4.1             110      00:01:02
  Distance: (default is 110)



(Configure RIPv2 routing between routers 1-5-7)


Router-1(config)#router rip
Router-1(config-router)#version 2
Router-1(config-router)#network 10.0.0.0
Router-1(config-router)#network 15.0.0.0
Router-1(config-router)#no auto-summary
Router-1(config-router)#exit
Router-1(config)#end


Router-1#show ip protocol
Routing Protocol is "rip"
  
  Redistributing: rip

  Maximum path: 4
  Routing for Networks:
    10.0.0.0
    15.0.0.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    15.5.5.2             120      00:00:13
  Distance: (default is 120)


Router-5(config)#router rip
Router-5(config-router)#version 2
Router-5(config-router)#network 15.0.0.0
Router-5(config-router)#network 57.0.0.0
Router-5(config-router)#no auto-summary
Router-5(config-router)#exit
Router-5(config)#end

Router-5#show ip protocol
Routing Protocol is "rip"
  
  Redistributing: rip
 
  Maximum path: 4
  Routing for Networks:
    15.0.0.0
    57.0.0.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    15.5.5.1             120      00:00:08
    57.5.5.2             120      00:00:22
  Distance: (default is 120)

R7(config)#router rip
R7(config-router)#version 2
R7(config-router)#network 57.0.0.0
R7(config-router)#network 20.0.0.0
R7(config-router)#no auto-summary
R7(config-router)#exit
R7(config)#end

R7#show ip protocol

Routing Protocol is "rip"
 
  Redistributing: rip

  Maximum path: 4
  Routing for Networks:
    20.0.0.0
    57.0.0.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    57.5.5.1             120      00:00:02
  Distance: (default is 120)


(Configure IBGP routing between routers 1-6-7)


Router-1(config)#router bgp 65100
Router-1(config-router)#neighbor 16.6.6.2 remote-as 65100
Router-1(config-router)#network 20.0.0.0
Router-1(config-router)#network 16.0.0.0
Router-1(config-router)#no auto-summary
Router-1(config-router)#no synchronization
Router-1(config-router)#exit
Router-1(config)#end


Routing Protocol is "bgp 65100"
 
  Neighbor(s):
    Address          FiltIn FiltOut DistIn DistOut Weight RouteMap
    16.6.6.2
  Maximum path: 1
  Routing Information Sources:
    Gateway         Distance      Last Update
    16.6.6.2             200      00:04:37
  Distance: external 20 internal 200 local 200


Router-6(config)#router bgp 65100
Router-6(config-router)#neighbor 16.6.6.1 remote-as 65100
Router-6(config-router)#neighbor 67.6.6.2 remote-as 65100
Router-6(config-router)#network 67.0.0.0
Router-6(config-router)#network 16.0.0.0
Router-6(config-router)#no auto-summary
Router-6(config-router)#no synchronization
Router-6(config-router)#exit


Router-6(config)#do show ip pro
Routing Protocol is "bgp 65100"

  Neighbor(s):
    Address          FiltIn FiltOut DistIn DistOut Weight RouteMap
    16.6.6.1
    67.6.6.2
  Maximum path: 1
  Routing Information Sources:
    Gateway         Distance      Last Update
    67.6.6.2             200      00:00:14
  Distance: external 20 internal 200 local 200


R7(config)#router bgp 65100
R7(config-router)#neighbor 67.6.6.1 remote-as 65100
R7(config-router)#network 67.0.0.0
R7(config-router)#network 20.0.0.0
R7(config-router)#no auto-summary
R7(config-router)#exit

Routing Protocol is "bgp 65100"

  Neighbor(s):
    Address          FiltIn FiltOut DistIn DistOut Weight RouteMap
    67.6.6.1
  Maximum path: 1
  Routing Information Sources:
    Gateway         Distance      Last Update
    67.6.6.1             200      00:03:57
  Distance: external 20 internal 200 local 200

(Now you will see all the routers (R2, R3, R4, R5 and R6) advertising the same network 20.1.1.0 with different administrative distance)

(Now ping from PC-1 to PC-2 and see which path router-1 will choose in order to reach the 20.0.0.0 network)


PC1> trace 20.1.1.2
trace to 20.1.1.2, 8 hops max, press Ctrl+C to stop
 1   10.1.1.1   14.927 ms  14.227 ms  14.842 ms
 2   12.2.2.2   44.245 ms  45.051 ms  44.502 ms
 3   27.2.2.2   75.052 ms  73.612 ms  61.008 ms
 4   20.1.1.2   99.213 ms  76.646 ms  75.808 ms

(So, when we ping from PC-1 the route our router chooses via router 2.)

 
Router-1#show ip route
Codes: 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

Gateway of last resort is not set

C    16.0.0.0/8 is directly connected, Serial4/7
S    20.0.0.0/8 [1/0] via 12.2.2.2
B    67.0.0.0/8 [200/0] via 16.6.6.2, 00:49:23
D    37.0.0.0/8 [90/2681856] via 13.3.3.2, 00:26:51, Serial2/1
R    57.0.0.0/8 [120/1] via 15.5.5.2, 00:00:09, Serial2/3
C    10.0.0.0/8 is directly connected, FastEthernet0/0
S    27.0.0.0/8 [1/0] via 12.2.2.2
C    12.0.0.0/8 is directly connected, Serial2/0
C    13.0.0.0/8 is directly connected, Serial2/1
O    47.0.0.0/8 [110/128] via 14.4.4.2, 00:11:42, Serial2/2
C    14.0.0.0/8 is directly connected, Serial2/2
C    15.0.0.0/8 is directly connected, Serial2/3

(All routers advertise a 20.0.0.0 network but router-1 installs a static route in its routing table because the static route is having less AD than others and also you will see the AD of (B 200) (R 120) (S 1) and (O 110)


(Now we shutdown the link between router1 and router 2 means static route)


Router-1(config)#interface serial 2/0
Router-1(config-if)#shutdown
Router-1(config-if)#exit

*Jun 28 17:25:43.979: %LINK-5-CHANGED: Interface Serial2/0, changed state to administratively down
*Jun 28 17:25:44.979: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to down

(Now again we try to ping 20.1.1.2 PC and see our router1 install which route)


Router-1#traceroute 20.1.1.2

Type escape sequence to abort.
Tracing the route to 20.1.1.2

  1 13.3.3.2 20 msec 32 msec 28 msec
  2 37.3.3.2 60 msec 64 msec 56 msec
  3 20.1.1.2 60 msec 76 msec 80 msec
Router-1#show ip route
Codes: 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

Gateway of last resort is not set

C    16.0.0.0/8 is directly connected, Serial4/7
D    20.0.0.0/8 [90/2684416] via 13.3.3.2, 00:03:52, Serial2/1
B    67.0.0.0/8 [200/0] via 16.6.6.2, 00:59:05
D    37.0.0.0/8 [90/2681856] via 13.3.3.2, 00:36:34, Serial2/1
R    57.0.0.0/8 [120/1] via 15.5.5.2, 00:00:14, Serial2/3
C    10.0.0.0/8 is directly connected, FastEthernet0/0
C    13.0.0.0/8 is directly connected, Serial2/1
O    47.0.0.0/8 [110/128] via 14.4.4.2, 00:21:24, Serial2/2
C    14.0.0.0/8 is directly connected, Serial2/2
C    15.0.0.0/8 is directly connected, Serial2/3

(Now you see router-1 install the route via router-3 which running EIGRP because EIGRP has an AD value of 90 and is less than 110, router-1 installed in its routing table)

(As per the requirement we want router-1 to install the OSPF route in its routing table)
(Changing the AD value of OSPF)

Router-1(config)#router ospf 100
Router-1(config-router)#distance 20
Router-1(config-router)#exit
Router-1(config)#exit

Router-1#show ip route
Codes: 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

Gateway of last resort is not set

C    16.0.0.0/8 is directly connected, Serial4/7
O    20.0.0.0/8 [20/129] via 14.4.4.2, 00:00:08, Serial2/2
B    67.0.0.0/8 [200/0] via 16.6.6.2, 01:20:46
D    37.0.0.0/8 [90/2681856] via 13.3.3.2, 00:06:05, Serial2/1
R    57.0.0.0/8 [120/1] via 15.5.5.2, 00:00:08, Serial2/3
C    10.0.0.0/8 is directly connected, FastEthernet0/0
C    13.0.0.0/8 is directly connected, Serial2/1
O    47.0.0.0/8 [20/128] via 14.4.4.2, 00:00:08, Serial2/2
C    14.0.0.0/8 is directly connected, Serial2/2
C    15.0.0.0/8 is directly connected, Serial2/3

Router-1#traceroute 20.1.1.2

Type escape sequence to abort.
Tracing the route to 20.1.1.2

  1 14.4.4.2 20 msec 28 msec 32 msec
  2 47.4.4.2 56 msec 60 msec 64 msec
  3 20.1.1.2 80 msec 72 msec 76 msec

(Now you see our router-1 install the route in its routing table advertised by router 4 because we change the AD of OSPF)


(Now again our requirement wants to install the EIGRP route in the router-1 routing table so we change the AD of EIGRP)


Router-1(config)#router eigrp 100
Router-1(config-router)#distance eigrp 10 50
Router-1(config-router)#exit

 

Router-1#show ip protocols
Routing Protocol is "eigrp 100"

  EIGRP maximum metric variance 1
  Redistributing: eigrp 100
  EIGRP NSF-aware route hold timer is 240s

  Maximum path: 4
  Routing for Networks:
    10.0.0.0
    13.0.0.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    13.3.3.2              10      00:00:32
  Distance: internal 10 external 50



Router-1#show ip route
Codes: 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

Gateway of last resort is not set

C    16.0.0.0/8 is directly connected, Serial4/7
D    20.0.0.0/8 [10/2684416] via 13.3.3.2, 00:00:48, Serial2/1
B    67.0.0.0/8 [200/0] via 16.6.6.2, 01:28:11
D    37.0.0.0/8 [10/2681856] via 13.3.3.2, 00:00:48, Serial2/1
R    57.0.0.0/8 [120/1] via 15.5.5.2, 00:00:16, Serial2/3
C    10.0.0.0/8 is directly connected, FastEthernet0/0
C    13.0.0.0/8 is directly connected, Serial2/1
O    47.0.0.0/8 [20/128] via 14.4.4.2, 00:07:33, Serial2/2
C    14.0.0.0/8 is directly connected, Serial2/2
C    15.0.0.0/8 is directly connected, Serial2/3


Router-1#traceroute 20.1.1.2

Type escape sequence to abort.
Tracing the route to 20.1.1.2

  1 13.3.3.2 36 msec 28 msec 32 msec
  2 37.3.3.2 56 msec 72 msec 60 msec
  3 20.1.1.2 68 msec 76 msec 76 msec

(Now in order to reach the 20.1.1.2 network, router-1 is using route 13.3.3.2 because we change the Default EIGRP AD)


(So, this LAB is getting long and long. thank you so much for visiting if you like my work please visit our YouTube program https://www.youtube.com/@internetworkss/playlists 






1 comment:

Anonymous said...

Thanks to you. That's a great pice of information. I need to follow this as I build myself.

What is Virtual Router Redundancy Protocol (VRRP)? How to configure Virtual Router Redundancy Protocol (VRRP)?

 Virtual Router Redundancy Protocol (VRRP) is a gateway redundancy networking protocol used to create a virtual gateway similar to HSRP . VR...