I took 3 different routing protocols: EIGRP, OSPF, RIP (with AD equal to 90, 110, 120, respectively). When I was searching for some answers, I came across this link, however the explanations from this website are insufficient for me. We can speak about 2 different situations. In first scenario we choose 2 routing protocols and we are making AD for them equal, however we set AD for them to the "neutral value". In the second option, we set AD to the default value of the first (or second) routing protocol. In both cases we have to find out, which routing protocol will be preferred: this, which has lower default AD or this which has AD unchanged (this may work only for the second scenario). Or maybe this one, which had its AD set later?
I will use a simple topology with 2 routers, R1 and R2. R2 advertises few different networks to R1, as depicted in the following picture:
Basically, with all default settings, nothing suspicious can be observed:
R1#show ip route
Codes: C - connected, R - RIP, D - EIGRP, O - OSPF,
Codes: C - connected, R - RIP, D - EIGRP, O - OSPF,
D 192.168.4.0/24 [90/2681856] via 10.0.0.2, 00:06:37, Serial0/0
D 192.168.5.0/24 [90/2681856] via 10.0.0.2, 00:06:37, Serial0/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, Serial0/0
D 192.168.6.0/24 [90/2681856] via 10.0.0.2, 00:05:43, Serial0/0
R 192.168.0.0/24 [120/1] via 10.0.0.2, 00:00:12, Serial0/0
O 192.168.1.0/24 [110/128] via 10.0.0.2, 00:06:22, Serial0/0
D 192.168.2.0/24 [90/2681856] via 10.0.0.2, 00:06:37, Serial0/0
O 192.168.3.0/24 [110/128] via 10.0.0.2, 00:06:23, Serial0/0
Now let's change AD to some "neutral values". Here I will focus also on the order in which AD of different routing protocols is changed. Let's make the following changes:
- AD = 97, EIGRP, OSPF, RIP:
R1(config-router)#distance eigrp 97 170
R1(config-router)#exit
R1(config)#router ospf 1
R1(config-router)#distance 97
R1(config-router)#exit
R1(config)#router rip
R1(config-router)#distance 97
R1#show ip route
Codes: C - connected, R - RIP, D - EIGRP, O - OSPF,
D 192.168.4.0/24 [97/2681856] via 10.0.0.2, 00:01:48, Serial0/0
D 192.168.5.0/24 [97/2681856] via 10.0.0.2, 00:01:48, Serial0/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, Serial0/0
D 192.168.6.0/24 [97/2681856] via 10.0.0.2, 00:01:48, Serial0/0
R 192.168.0.0/24 [97/1] via 10.0.0.2, 00:00:24, Serial0/0
O 192.168.1.0/24 [97/128] via 10.0.0.2, 00:01:18, Serial0/0
D 192.168.2.0/24 [97/2681856] via 10.0.0.2, 00:01:48, Serial0/0
O 192.168.3.0/24 [97/128] via 10.0.0.2, 00:01:18, Serial0/0
- AD = 98, RIP, OSPF, EIGRP:
R1(config-router)#distance 98
R1(config-router)#exit
R1(config)#router ospf 1
R1(config-router)#distance 98
R1(config-router)#exit
R1(config)#router eigrp 1
R1(config-router)#distance eigrp 98 170
R1#show ip routeCodes: C - connected, R - RIP, D - EIGRP, O - OSPF,
D 192.168.4.0/24 [98/2681856] via 10.0.0.2, 00:00:35, Serial0/0
D 192.168.5.0/24 [98/2681856] via 10.0.0.2, 00:00:35, Serial0/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, Serial0/0
D 192.168.6.0/24 [98/2681856] via 10.0.0.2, 00:00:35, Serial0/0
R 192.168.0.0/24 [98/1] via 10.0.0.2, 00:00:24, Serial0/0
O 192.168.1.0/24 [98/128] via 10.0.0.2, 00:01:06, Serial0/0
D 192.168.2.0/24 [98/2681856] via 10.0.0.2, 00:00:35, Serial0/0
O 192.168.3.0/24 [98/128] via 10.0.0.2, 00:01:06, Serial0/0
- AD = 99, OSPF, EIGRP, RIP:
R1(config-router)#distance 99
R1(config-router)#exit
R1(config)#router eigrp 1
R1(config-router)#distance eigrp 99 170
R1(config-router)#exit
R1(config)#router rip
R1(config-router)#distance 99
R1#show ip routeCodes: C - connected, R - RIP, D - EIGRP, O - OSPF,
D 192.168.4.0/24 [99/2681856] via 10.0.0.2, 00:01:08, Serial0/0
D 192.168.5.0/24 [99/2681856] via 10.0.0.2, 00:01:08, Serial0/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, Serial0/0
D 192.168.6.0/24 [99/2681856] via 10.0.0.2, 00:01:08, Serial0/0
R 192.168.0.0/24 [99/1] via 10.0.0.2, 00:00:18, Serial0/0
O 192.168.1.0/24 [99/128] via 10.0.0.2, 00:02:00, Serial0/0
D 192.168.2.0/24 [99/2681856] via 10.0.0.2, 00:01:08, Serial0/0
O 192.168.3.0/24 [99/128] via 10.0.0.2, 00:02:00, Serial0/0
In all cases, the outputs taken from R1 are the same. Metrics are totally ignored, and EIGRP wins with RIP and OSPF, whereas OSPF wins with RIP. So it looks like that default AD is taken into account (EIGRP < OSPF < RIP). Later we will check if it is correct for EIGRP external routes, where default AD is 170.
Now let's set the AD to default OSPF AD (AD = 110), next to default RIP AD (AD = 120):
- AD = 110
R1(config-router)#distance 110
R1(config)#router eigrp 1
R1(config-router)#distance eigrp 110 170
R1#show ip routeCodes: C - connected, R - RIP, D - EIGRP, O - OSPF,
D 192.168.4.0/24 [110/2681856] via 10.0.0.2, 00:00:07, Serial0/0
D 192.168.5.0/24 [110/2681856] via 10.0.0.2, 00:00:07, Serial0/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, Serial0/0
D 192.168.6.0/24 [110/2681856] via 10.0.0.2, 00:00:07, Serial0/0
R 192.168.0.0/24 [110/1] via 10.0.0.2, 00:00:09, Serial0/0
O 192.168.1.0/24 [110/128] via 10.0.0.2, 00:01:33, Serial0/0
D 192.168.2.0/24 [110/2681856] via 10.0.0.2, 00:00:07, Serial0/0
O 192.168.3.0/24 [110/128] via 10.0.0.2, 00:01:33, Serial0/0
- AD = 120
R1(config-router)#distance eigrp 120 170
R1(config-router)#exit
R1(config)#router ospf 1
R1(config-router)#distance 120
R1#show ip routeCodes: C - connected, R - RIP, D - EIGRP, O - OSPF,
D 192.168.4.0/24 [120/2681856] via 10.0.0.2, 00:00:50, Serial0/0
D 192.168.5.0/24 [120/2681856] via 10.0.0.2, 00:00:18, Serial0/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, Serial0/0
D 192.168.6.0/24 [120/2681856] via 10.0.0.2, 00:00:18, Serial0/0
R 192.168.0.0/24 [120/1] via 10.0.0.2, 00:00:23, Serial0/0
O 192.168.1.0/24 [120/128] via 10.0.0.2, 00:00:18, Serial0/0
D 192.168.2.0/24 [120/2681856] via 10.0.0.2, 00:00:50, Serial0/0
O 192.168.3.0/24 [120/128] via 10.0.0.2, 00:00:18, Serial0/0
In both cases, the outputs from R1 are the same. Still EIGRP is "the best" and OSPF is "better" than RIP.
Now let's modify slightly our example. R2 will redistribute all EIGRP networks and advertised these networks to R1 as external with default AD equal to 170. Here is the output from R1, when AD is not modified:
R1#show ip route
Codes: Codes: C - connected, R - RIP, D - EIGRP, EX - EIGRP external, O - OSPF,
R 192.168.4.0/24 [120/1] via 10.0.0.2, 00:00:16, Serial0/0
O 192.168.5.0/24 [120/128] via 10.0.0.2, 00:02:47, Serial0/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, Serial0/0
O 192.168.6.0/24 [120/128] via 10.0.0.2, 00:02:47, Serial0/0
R 192.168.0.0/24 [120/1] via 10.0.0.2, 00:00:16, Serial0/0
O 192.168.1.0/24 [120/128] via 10.0.0.2, 00:08:03, Serial0/0
D EX 192.168.2.0/24 [170/2474496] via 10.0.0.2, 00:00:57, Serial0/0
O 192.168.3.0/24 [120/128] via 10.0.0.2, 00:08:03, Serial0/0
Now let's change AD of all protocols to 130 (first), and 102 (next).
- AD = 130, EIGRP first, next RIP, last OSPF:
R1(config-router)#distance eigrp 130 130
R1(config-router)#exit
R1(config)#router rip
R1(config-router)#distance 130
R1(config)#router ospf 1
R1(config-router)#distance 130
R1#show ip routeCodes: Codes: C - connected, R - RIP, D - EIGRP, EX - EIGRP external, O - OSPF,
D EX 192.168.4.0/24 [130/2474496] via 10.0.0.2, 00:00:49, Serial0/0
D EX 192.168.5.0/24 [130/2474496] via 10.0.0.2, 00:00:14, Serial0/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, Serial0/0
D EX 192.168.6.0/24 [130/2474496] via 10.0.0.2, 00:00:14, Serial0/0
R 192.168.0.0/24 [130/1] via 10.0.0.2, 00:00:26, Serial0/0
O 192.168.1.0/24 [130/128] via 10.0.0.2, 00:00:14, Serial0/0
D EX 192.168.2.0/24 [130/2474496] via 10.0.0.2, 00:00:49, Serial0/0
O 192.168.3.0/24 [130/128] via 10.0.0.2, 00:00:14, Serial0/0
- AD = 102, OSPF first, then RIP, EIGRP last:
R1(config-router)#distance 102
R1(config-router)#exit
R1(config)#router rip
R1(config-router)#distance 102
R1(config-router)#exit
R1(config)#router eigrp 1
R1(config-router)#distance eigrp 90 102
R1#show ip routeCodes: Codes: C - connected, R - RIP, D - EIGRP, EX - EIGRP external, O - OSPF,
D EX 192.168.4.0/24 [102/2474496] via 10.0.0.2, 00:00:09, Serial0/0
D EX 192.168.5.0/24 [102/2474496] via 10.0.0.2, 00:00:09, Serial0/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, Serial0/0
D EX 192.168.6.0/24 [102/2474496] via 10.0.0.2, 00:00:09, Serial0/0
R 192.168.0.0/24 [102/1] via 10.0.0.2, 00:00:04, Serial0/0
O 192.168.1.0/24 [102/128] via 10.0.0.2, 00:00:10, Serial0/0
D EX 192.168.2.0/24 [102/2474496] via 10.0.0.2, 00:00:09, Serial0/0
O 192.168.3.0/24 [102/128] via 10.0.0.2, 00:00:10, Serial0/0
Here we can see quite interesting thing. Still EIGRP wins with RIP and OSPF, and routes delivered by EIGRP are installed in the routing table, even if these routes are external with default AD of 170. So it looks like EIGRP is always preferred.
I also made some other tests. For example, eBGP is preferred than EIGRP (eBGP has AD = 20):
R1#show ip route
Codes: Codes: C - connected, R - RIP, D - EIGRP, EX - EIGRP external, O - OSPF, B - BGP,
D 192.168.4.0/24 [56/2681856] via 10.0.0.2, 00:00:17, Serial0/0
D 192.168.5.0/24 [56/2681856] via 10.0.0.2, 00:00:17, Serial0/0
B 192.168.2.0/24 [56/0] via 10.0.0.2, 00:00:30
! Some lines omitted
D 192.168.4.0/24 [56/2681856] via 10.0.0.2, 00:00:17, Serial0/0
D 192.168.5.0/24 [56/2681856] via 10.0.0.2, 00:00:17, Serial0/0
B 192.168.2.0/24 [56/0] via 10.0.0.2, 00:00:30
! Some lines omitted
Above we can see that the 192.168.2.0/24 is received via BGP and EIGRP. The AD of them (both BGP and EIGRP) is set to 56. IOS picked up the route received via BGP. Even iBGP (default AD = 200) is preferred than EIGRP:
R1#show ip bgp
BGP table version is 4, local router ID is 10.0.0.1
Status codes: * valid, > best, i - internal,
Network Next Hop Metric LocPrf Weight Path
*>i192.168.2.0 10.0.0.2 0 100 0 i
R1#show ip routeCodes: Codes: C - connected, R - RIP, D - EIGRP, EX - EIGRP external, O - OSPF, B - BGP,
D 192.168.4.0/24 [56/2681856] via 10.0.0.2, 00:01:05, Serial0/0
D 192.168.5.0/24 [56/2681856] via 10.0.0.2, 00:01:05, Serial0/0
B 192.168.2.0/24 [56/0] via 10.0.0.2, 00:01:05
However each time I have changed the AD for BGP (external or internal) after changing the AD for EIGRP, I had to prompt clear ip bgp * or clear ip route * so BGP could kick off the existing route which have been delivered via EIGRP (in other words, if AD of BGP was changed first, EIGRP didn't have any chance to install its routes to RIB, however if AD of EIGRP was changed before AD of BGP, and it was a lower value than the default AD of BGP, one of these two commands was required).
To sum up, it looks like the default AD is the tie-breaker. However IOS doesn't take into account default AD of external EIGRP nor iBGP, it just takes default AD equal to 90 and 20, respectively.
Just guessing, but a while ago my tests indicated the earliest or the latest route (= latest change) would make it into the IP routing table.
ReplyDeleteIf you really want to play with this, try enabling routing protocols in sequence ;) ... with EIGRP last.
Maybe now Cisco improved IOS, and in all cases default AD is the tie-breaker.
ReplyDelete