cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
658
Views
4
Helpful
8
Replies

Question about prefix-length

BeakedPoint
Level 1
Level 1

I got this question about which route would be selected with these routes and destination:

S 10.20.0.0/16 [1/0] via 192.168.10.2
D 10.20.0.0/20 [90/2809856] via 192.168.10.4
R 10.20.0.0/24 [120/3] via 192.168.10.3
O 10.20.0.0/28 [110/64] via 192.168.10.1
Destinaton is 10.20.0.17

I thought the OSPF route would be selected due to the longest matching prefix, but the RIP route (192.168.10.3) is the correct answer and I'm trying to understand why -- obviously my understanding of prefix-length is lacking in this context of routing selection. The explanation didn't really elucidate it enough for me other than describing the associated ranges, which I'm also having some trouble understanding. Specifically why the /24 route goes from 16-255 when the /24 block size, typically, is much smaller than that.

These are the ranges as described in the answer:
/28 range is 10.20.0.0-10.20.0.15
/24 range is 10.20.0.16-10.20.0.255
/20 range is 10.20.1.0-10.20.15.255
/16 range is 10.20.16.0-10.20.255.255

Thanks.

8 Replies 8

This is a very common question to make sure you understand longest prefix. (Its funny how RIP is usually the answer as it has the highest AD and that what people tend to lean towards in a fast judgement, I know I did at one time).

Lets go through these:

S 10.20.0.0/16 [1/0] via 192.168.10.2
D 10.20.0.0/20 [90/2809856] via 192.168.10.4
R 10.20.0.0/24 [120/3] via 192.168.10.3
O 10.20.0.0/28 [110/64] via 192.168.10.1
Destinaton is 10.20.0.17

Eliminating 2 answers right away it wont be the static or OSPF route. Here's why:

Static route covers 10.20.0.0-10.20.255.255 <-range is too big

OSPF route covers 10.20.0.0 -10.20.0.14 <- range is too small

You say you thought it was OSPF due to longest match. While it is the most specific route its too specific and doesn't include your destination of 10.20.0.17
Not sure what material you are using but a /24 is NOT 10.20.0.16-10.20.0.255. Its 10.20.0.0-10.20.0.255.

Lastly the EIGRP route is 10.20.0.0-10.20.15.255 <- this is also another big range

This leaves the RIP route which is perfect at 10.20.0.0 - 10.20.0.255 <- the destination address of 10.20.0.17 fits here while also being the most specific route in the table that includes it.

 

Hope this helps

 

-David

 

Gopinath_Pigili
Spotlight
Spotlight

Hello BeakedPoint,

As you thought the OSPF route would be selected due to the longest matching prefix, but ospf length /28 range is 10.20.0.0-10.20.0.15, but the Destinaton is 10.20.0.17, it is not comes under ospf range. 10.20.0.15 is Broadcast ID which is not valid, the last valid ip address is 10.20.0.14.

Next Longest match is with RIP R 10.20.0.0/24  and its range is 10.20.0.0-10.20.0.255, the Destination 10.20.0.17 exactly fall under this range, that the reason Answer is with RIP

 

Best regards
******* If This Helps, Please Rate *******

S 10.20.0.0/16 [1/0] via 192.168.10.2 <4th>  <— this is a catch all prefix but any longer prefixes within this range will override it - the same is applicable to the other routes  you see in the route table…
D 10.20.0.0/20 [90/2809856] via 192.168.10.4 <3rd>
R 10.20.0.0/24 [120/3] via 192.168.10.3 <2nd>
O 10.20.0.0/28 [110/64] via 192.168.10.1  <1st

 


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul

Joseph W. Doherty
Hall of Fame
Hall of Fame

(Condensed version of what the other posters are saying.)

The rule is longest prefix that includes the destination IP in its address block.

The OSPF route is the longest prefix but it doesn't include the .17.

If the OSPF route was 10.20.0.16/28, it would have been the best match.

The RIP route is the longest prefix that includes the .17.

liviu.gheorghe
Spotlight
Spotlight

The route selected to route to destination 10.20.0.17 will be the RIP route 10.20.0.0/24 for the reasons well described by @David Ruess and @Gopinath_Pigili .

On the other hand, the ranges as described in the answer are wrong in my opinion. They should read:
/28 range is 10.20.0.0-10.20.0.15
/24 range is 10.20.0.0-10.20.0.255
/20 range is 10.20.0.0-10.20.15.255
/16 range is 10.20.0.0-10.20.255.255

Regards, LG
*** Please Rate All Helpful Responses ***

"On the other hand, the ranges as described in the answer are wrong in my opinion. They should read:"

Not just your opinion.  ; )

Thank you Joseph. Everybody can be wrong from time to time.

Regards, LG
*** Please Rate All Helpful Responses ***


@liviu.gheorghe wrote:

Thank you Joseph. Everybody can be wrong from time to time.


Indeed!

Why there was the one time I thought I too made a mistake; but I was mistaken.  ; )

Review Cisco Networking for a $25 gift card