3

would a network select /24 or /23 path with ospf or with BGP which one is preferred !!

1
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer.
    – Ron Maupin
    Commented Apr 1, 2018 at 22:49

2 Answers 2

10

The route with the longest mask (/24) is always preferred regardless of how it’s learned. The protocol doesn’t matter.

7

Most specific match (longest subnet mask match) will win regardless of routing protocol. If the subnet masks are equal, the route with the lowest administrative distance wins. In this case eBGP routes (learned from routers in different BGP Autonomous Systems) have a lower AD than OSPF routes, which have a lower AD than iBGP routes (learned from routers in the same BGP AS).

Worth noting - if the /24 is inside the /23, the other half of the /23 route will be honored. In other words, if you have a route for 1.1.0.0/23 pointing to 192.168.1.1 and a route for 1.1.0.0/24 pointing to 192.168.1.2, all traffic in 1.1.0.0/24 will go to 192.168.1.2 and all traffic in 1.1.1.0/24 will go to 192.168.1.1

/24 beats /23 eBGP beats OSPF beats iBGP

https://en.wikipedia.org/wiki/Administrative_distance

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.