top of page
  • Writer's pictureMcCube

Dive into Route Precedence

Updated: Mar 25, 2022



Introduction

The other week as part of my #DailyCCNAQuestion on twitter I asked the following question, and got these final results.


The question itself is a common styled CCNA question that is trying to ensure you understand Route precedence. What is interesting is that only 6.1% got this one right. So, we decided to do a live lab covering why the /25 EIGRP route wins.

Route precedence (by default) goes like this.

  1. What is the most accurate route?

  2. How did the router learn about the route?

  3. Are their multiple paths?

Let's break each down a little.


What is the most accurate route?

The most accurate route to an IP address is a /32 (subnetmask 255.255.255.255) you can see it in a routing table mostly as "L" routes.

The smaller the CIDR number gets the less accurate to a single point it becomes. Let's use the example from the question 192.168.0.61

Destination route

Covers

Accuracy to 192.168.0.61

192.168.0.61/32

192.168.0.61

100% Accurate

192.168.0.32/27

192.168.0.32-192.168.0.63

Very Accurate

192.168.0.0/24

192.168.0.0-192.168.0.255

Accurate

0.0.0.0/0

0.0.0.0 - 255.255.255.255

Not accurate be still in range

As you can see the further away from /32 the larger the range becomes, and the more inaccuracy involved.

It comes down to the fact that it doesn't matter where you learn a route from If it is more accurate than other options. This will be the option used.


How did the router learn about the route?

This is where administrative distance comes in. So, an example here is what if the network 192.168.0.32/27 is being advertised by OSPF, EIGRP and is configured as a static route?

Destination route

Method

Administrative Distance

192.168.0.32/27

RIP

120

192.168.0.32/27

OSPF

110

192.168.0.32/27

EIGRP

90

192.168.0.32/27

Static

1

So, in this example we have 3 entries for the same destination. Which to use? the one with the lowest Administrative Distance.


Are their multiple paths?

Finally, it is possible that multiple paths to the same destination network may exist all being offered by the same routing protocol . This is where Metrics come in to play.

Imagine that OSPF was our most trusted source of the 192.168.0.32/27 but that there were 3 possible paths to get to it.

Destination route

Method

Egress (exit) interface

Metric (Cost)

192.168.0.32/27

OSPF

G0/0

65

192.168.0.32/27

OSPF

G0/1

35

192.168.0.32/27

OSPF

G0/2

15

In this instance the winner will be the route that exits out of G0/2 because this route has the lowest cost.


Can we lab this up? Of course.


Instructions

In this lab (Download lab pack here) all initial routing protocol configuration is present. All that is missing is network statements in both EIGRP and OSPF.

The lab itself is (intentionally) poorly designed. There are overlapping network ranges, and as we progress, we will even see redundant routing entries because of this.

The goal of this lab is to see the impact of route precedence on R1, and we will tackle it from 3 points.

Topology




Activity


The routing table we want to focus on will be held on R1. We will be adding routes to this table by configuring R2,R3 and R4. All routers have formed adjacencies in both OSPF and EIGRP but none of 192 networks are advertised.


The Static Route

Let's see what we are starting with on R1

There is a static route to 192.168.0.0/24 via 10.1.2.2

R1# show ip route | begin Gateway
Gateway of last resort is not set
 10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
C  10.1.2.0/24 is directly connected, GigabitEthernet0/0/0
L  10.1.2.1/32 is directly connected, GigabitEthernet0/0/0
C  10.1.3.0/24 is directly connected, GigabitEthernet0/0/1
L  10.1.3.1/32 is directly connected, GigabitEthernet0/0/1
C  10.1.4.0/24 is directly connected, GigabitEthernet0/0/2
L  10.1.4.1/32 is directly connected, GigabitEthernet0/0/2
S    192.168.0.0/24 [1/0] via 10.1.2.2 

R1#

At this point this is the preferred route for the destination 192.168.0.61

R1#show ip route 192.168.0.61
Routing entry for 192.168.0.0/24
Known via "static", distance 1, metric 0
  Routing Descriptor Blocks:
  * 10.1.2.2
      Route metric is 0, traffic share count is 1
R1#

The OSPF routes

Now we can start adding routes into the routing table using OSPF

To keep this simple we will use a generic network statement to ensure all interfaces participate in OSPF.

Start with R4

R4(config)#router ospf 997
R4(config-router)#network 0.0.0.0 255.255.255.255 area 0
R4(config-router)#end
R4#

Investigate R1 to see the difference.

R1#show ip route | begin Gateway
Gateway of last resort is not set
 10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
C  10.1.2.0/24 is directly connected, GigabitEthernet0/0/0
L  10.1.2.1/32 is directly connected, GigabitEthernet0/0/0
C  10.1.3.0/24 is directly connected, GigabitEthernet0/0/1
L  10.1.3.1/32 is directly connected, GigabitEthernet0/0/1
C  10.1.4.0/24 is directly connected, GigabitEthernet0/0/2
L  10.1.4.1/32 is directly connected, GigabitEthernet0/0/2
 192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
S  192.168.0.0/24 [1/0] via 10.1.2.2
O  192.168.0.0/25 [110/2] via 10.1.4.4, 00:00:45, GigabitEthernet0/0/2

R1#

As you can see on R1, there is now an entry for 192.168.0.0/25 in the routing table. But interestingly there is still the 192.168.0.0/24 static route there too.


If we throw R3 into the mix, more interesting stuff happens.

R3(config)# router ospf 998
R3(config-router)# network 0.0.0.0 255.255.255.255 area 0
R3(config-router)#

Investigate R1 to see the difference.

R1# show ip route | b Gateway
Gateway of last resort is not set
 10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
C  10.1.2.0/24 is directly connected, GigabitEthernet0/0/0
L  10.1.2.1/32 is directly connected, GigabitEthernet0/0/0
C  10.1.3.0/24 is directly connected, GigabitEthernet0/0/1
L  10.1.3.1/32 is directly connected, GigabitEthernet0/0/1
C  10.1.4.0/24 is directly connected, GigabitEthernet0/0/2
L  10.1.4.1/32 is directly connected, GigabitEthernet0/0/2
 192.168.0.0/24 is variably subnetted, 4 subnets, 3 masks
S  192.168.0.0/24 [1/0] via 10.1.2.2
O  192.168.0.0/25 [110/2] via 10.1.4.4, 01:08:37, GigabitEthernet0/0/2
O  192.168.0.0/26 [110/2] via 10.1.3.3, 00:00:12, GigabitEthernet0/0/1
O  192.168.0.64/26 [110/2] via 10.1.3.3, 00:00:02, GigabitEthernet0/0/1

R1#

The routing table on R1 is getting bigger. There is 3 ospf routes. the /25 from R4 and 2x/26 router from R3

One thing that is interesting is that the /25 route although present at this stage is redundant!

Entry

Range

Interface

192.168.0.0 /25

192.168.0.0 - 192.168.0.127

G0/0/2

192.168.0.0 /26

192.168.0.0 - 192.168.0.63

G0/0/1

192.168.0.64 /26

192.168.0.64 - 192.168.0.127

G0/0/1

As you can see both the /26 routes cover the entire range of the /25. This is one of the reasons the design of this network is flawed, it has inefficient routing. The routing table is bigger for no real reason. In an ideal situation we would remove the redundant route.


Time to get R2 onboard with all of this.

R2(config)#router ospf 999
R2(config-router)#network 0.0.0.0 255.255.255.255 area 0
R2(config-router)#

Yet gain we can see the routing table is growing to accommodate all the /27 routes.

R1#show ip route | b Gateway
Gateway of last resort is not set


 10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
C  10.1.2.0/24 is directly connected, GigabitEthernet0/0/0
L  10.1.2.1/32 is directly connected, GigabitEthernet0/0/0
C  10.1.3.0/24 is directly connected, GigabitEthernet0/0/1
L  10.1.3.1/32 is directly connected, GigabitEthernet0/0/1
C  10.1.4.0/24 is directly connected, GigabitEthernet0/0/2
L  10.1.4.1/32 is directly connected, GigabitEthernet0/0/2
 192.168.0.0/24 is variably subnetted, 9 subnets, 4 masks
S  192.168.0.0/24 [1/0] via 10.1.2.2
O  192.168.0.0/25 [110/2] via 10.1.4.4, 01:21:40, GigabitEthernet0/0/2
O  192.168.0.0/26 [110/2] via 10.1.3.3, 00:13:15, GigabitEthernet0/0/1
O  192.168.0.0/27 [110/2] via 10.1.2.2, 00:01:08, GigabitEthernet0/0/0
O  192.168.0.32/27 [110/2] via 10.1.2.2, 00:00:58, GigabitEthernet0/0/0
O  192.168.0.64/26 [110/2] via 10.1.3.3, 00:13:05, GigabitEthernet0/0/1
O  192.168.0.64/27 [110/2] via 10.1.2.2, 00:00:58, GigabitEthernet0/0/0
O  192.168.0.96/27 [110/2] via 10.1.2.2, 00:00:58, GigabitEthernet0/0/0
O  192.168.0.128/27 [110/2] via 10.1.2.2, 00:00:58, GigabitEthernet0/0/0

R1#

Similarly, the /26 routes are now redundant for similar reasons as before.


We can check the preferred route at this point for our desired destination. As you can see the static route is no longer the preferred route.

R1# show ip route 192.168.0.61
Routing entry for 192.168.0.32/27
Known via "ospf 999", distance 110, metric 2, type intra area
  Last update from 10.1.2.2 on GigabitEthernet0/0/0, 00:05:25 ago
  Routing Descriptor Blocks:
  * 10.1.2.2, from 192.168.0.129, 00:05:25 ago, via GigabitEthernet0/0/0
      Route metric is 2, traffic share count is 1
R1# 

The EIGRP routes

At this point we are going to add EIGRP, it has a lower AD so will it immediately take over all the available routes?

R4(config)# router eigrp 997
R4(config-router)# network 0.0.0.0 255.255.255.255
R4(config-router)# no auto-summary
R1# show ip route | b Gateway
Gateway of last resort is not set
 10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
C  10.1.2.0/24 is directly connected, GigabitEthernet0/0/0
L  10.1.2.1/32 is directly connected, GigabitEthernet0/0/0
C  10.1.3.0/24 is directly connected, GigabitEthernet0/0/1
L  10.1.3.1/32 is directly connected, GigabitEthernet0/0/1
C  10.1.4.0/24 is directly connected, GigabitEthernet0/0/2
L  10.1.4.1/32 is directly connected, GigabitEthernet0/0/2
 192.168.0.0/24 is variably subnetted, 9 subnets, 4 masks
S  192.168.0.0/24 [1/0] via 10.1.2.2
D  192.168.0.0/25 [90/5376] via 10.1.4.4, 00:00:02, GigabitEthernet0/0/2
O  192.168.0.0/26 [110/2] via 10.1.3.3, 00:23:05, GigabitEthernet0/0/1
O  192.168.0.0/27 [110/2] via 10.1.2.2, 00:10:58, GigabitEthernet0/0/0
O  192.168.0.32/27 [110/2] via 10.1.2.2, 00:10:48, GigabitEthernet0/0/0
O  192.168.0.64/26 [110/2] via 10.1.3.3, 00:22:55, GigabitEthernet0/0/1
O  192.168.0.64/27 [110/2] via 10.1.2.2, 00:10:48, GigabitEthernet0/0/0
O  192.168.0.96/27 [110/2] via 10.1.2.2, 00:10:48, GigabitEthernet0/0/0
O  192.168.0.128/27 [110/2] via 10.1.2.2, 00:10:48, GigabitEthernet0/0/0

R1#

Notice this route has only taken the place of the exact match that was available via OSPF. It has not however taken over the rest of the OSPF routes.


We will speed through the rest here, but feel free to keep checking in with R1s routing table at your own pace.

R3(config)#router eigrp 998
R3(config-router)#network 0.0.0.0 255.255.255.255
R3(config-router)#no auto-summary 
R2(config)#router eigrp 999
R2(config-router)#network 0.0.0.0 255.255.255.255
R2(config-router)#no auto-summary

Back on R1 and you can see that the routing table has not grown. Instead, all routes have been swapped out by ones advertised by EIGRP.


R1# show ip route | b Gateway
Gateway of last resort is not set
 10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
C 10.1.2.0/24 is directly connected, GigabitEthernet0/0/0
L 10.1.2.1/32 is directly connected, GigabitEthernet0/0/0
C 10.1.3.0/24 is directly connected, GigabitEthernet0/0/1
L 10.1.3.1/32 is directly connected, GigabitEthernet0/0/1
C 10.1.4.0/24 is directly connected, GigabitEthernet0/0/2
L 10.1.4.1/32 is directly connected, GigabitEthernet0/0/2
 192.168.0.0/24 is variably subnetted, 9 subnets, 4 masks
S 192.168.0.0/24 [1/0] via 10.1.2.2
D 192.168.0.0/25 [90/5376] via 10.1.4.4, 00:03:55, GigabitEthernet0/0/2
D 192.168.0.0/26 [90/28416] via 10.1.3.3, 00:01:04, GigabitEthernet0/0/1
D 192.168.0.0/27 [90/28416] via 10.1.2.2, 00:00:25, GigabitEthernet0/0/0
D 192.168.0.32/27 [90/28416] via 10.1.2.2, 00:00:25, GigabitEthernet0/0/0
D 192.168.0.64/26 [90/28416] via 10.1.3.3, 00:01:04, GigabitEthernet0/0/1
D 192.168.0.64/27 [90/28416] via 10.1.2.2, 00:00:25, GigabitEthernet0/0/0
D 192.168.0.96/27 [90/28416] via 10.1.2.2, 00:00:25, GigabitEthernet0/0/0
D 192.168.0.128/27 [90/28416] via 10.1.2.2, 00:00:25, GigabitEthernet0/0/0

R1#

A final check to see which route is most favourable for 192.168.0.61

R1# show ip route 192.168.0.61
Routing entry for 192.168.0.32/27
Known via "eigrp 999", distance 90, metric 28416, type internal
  Redistributing via eigrp 999
  Last update from 10.1.2.2 on GigabitEthernet0/0/0, 00:02:44 ago
  Routing Descriptor Blocks:
  * 10.1.2.2, from 10.1.2.2, 00:02:44 ago, via GigabitEthernet0/0/0
      Route metric is 28416, traffic share count is 1
      Total delay is 110 microseconds, minimum bandwidth is 100000 Kbit
      Reliability 255/255, minimum MTU 1500 bytes
      Loading 1/255, Hops 1


R1#

Now the most favourable route is by EIGRP not OSPF. Both OSPF and EIGRP are offering it. but EIGRP has the Lower AD to the most specific route.

The Answer


Back to the question and which option is the answer. Let’s go A-D and discuss them one by one.


A. 192.168.0.0/25 via OSPF

This route is more accurate than the /24 static. However, the route itself would be overthrown by any EIGRP routes to the same network as we have seen here.


B. 192.168.0.0/25 via EIGRP

This is the correct answer.

This route is just as accurate as the OSPF /25 and has a lower AD than OSPF and is the most accurate route.


C. 192.168.0.32 /26 via OSPF

This was mean admittedly, but this was a red herring. At first glance this option should be the correct answer. However, Look as hard as you might. 192.168.0.32/26 is not a valid network.

Try to add it as a static route. You will get the following.

R1(config)# ip route 192.168.0.32 255.255.255.192 g0/0/1
%Inconsistent address and mask
R1(config)#

This network addresses for /26's will only ever be the following

Network Address

Range

X.X.X.0

0-63

X.X.X.64

64-127

X.X.X.128

128-191

X.X.X.192

192-255


D. 192.168.0.0/24 via Static

The static route is always present in this lab as the least accurate route. However, it is good to note that unlike some of the others. This route was never redundant. It closer represents something called "a null route"

This is basically a catch all for any other route that does not have a more accurate route specified. For example, there is no valid route for any address in the latter part of the 192.168.0.0/24 range that has been discovered through EIGRP or OSPF.

E.g., 192.168.0.221

In this instance the static route is the only option available for this address. Have a look for yourself.

R1# show ip route 192.168.0.221
Routing entry for 192.168.0.0/24
Known via "static", distance 1, metric 0
  Routing Descriptor Blocks:
  * 10.1.2.2
      Route metric is 0, traffic share count is 1
R1#

That folks, is route precedence. I hope you have a greater understanding of routing table entries after all of this.


Happy routing.

Recent Posts

See All
bottom of page