03-22-2024 06:05 PM
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.
03-22-2024 06:55 PM - edited 03-22-2024 06:57 PM
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
03-22-2024 07:00 PM
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 *******
03-24-2024 06:00 AM - edited 03-24-2024 06:02 AM
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
03-24-2024 06:20 AM - edited 03-24-2024 06:22 AM
(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.
03-24-2024 06:30 AM
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
03-24-2024 07:44 AM
"On the other hand, the ranges as described in the answer are wrong in my opinion. They should read:"
Not just your opinion. ; )
03-24-2024 08:00 AM
Thank you Joseph. Everybody can be wrong from time to time.
03-24-2024 09:52 AM
@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. ; )
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide