Basic questions on preferred routes (BGP vs. OSPF)

Answered Question
Mar 19th, 2009
User Badges:

Hey, imagine that I have in my routing table routes to a same destination:


a) iBGP (via a network /24) and OSPF destination via a /27 network address;

Given the administrative distance that for iBGP is 200, is the OSPF (adm distance=110) the preferred one in this case?

Correct Answer by Edison Ortiz about 8 years 3 months ago

Longest prefix will dictate the preferred route, not the administrative distance.


Based on your example, if you were to send:


192.168.1.0/27 via OSPF

and

192.168.1.0/24 via BGP


You will prefer to reach hosts from 192.168.1.1-31 via OSPF and 192.168.1.32-254 via BGP.


HTH,


__


Edison.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (2 ratings)
Loading.
Richard Burts Thu, 03/19/2009 - 14:15
User Badges:
  • Super Silver, 17500 points or more
  • Hall of Fame,

    Founding Member

  • Cisco Designated VIP,

    2017 LAN, WAN

Marlon


Your question is not clear to me. When you talk about a /24 for IBGP and a /27 for OSPF are these the masks for the networks you go through to get to the destination (in which case the mask of the network you go through does not have any impact on which route is preferred) or are these the masks of the prefix in the routing table (in which case you have two different prefixes and not two routes to the same prefix). Can you clarify this?


If it is two routes to the same prefix then OSPF is preferred over IBGP.


HTH


Rick

Correct Answer
Edison Ortiz Thu, 03/19/2009 - 14:16
User Badges:
  • Super Bronze, 10000 points or more
  • Hall of Fame,

    Founding Member

Longest prefix will dictate the preferred route, not the administrative distance.


Based on your example, if you were to send:


192.168.1.0/27 via OSPF

and

192.168.1.0/24 via BGP


You will prefer to reach hosts from 192.168.1.1-31 via OSPF and 192.168.1.32-254 via BGP.


HTH,


__


Edison.

Giuseppe Larosa Thu, 03/19/2009 - 14:18
User Badges:
  • Super Silver, 17500 points or more
  • Hall of Fame,

    Founding Member

Hello Marlon,

the most specific route is used regardless of AD and metric.


So in your case if destination address is within the /27 the OSPF route is used.

If the destination address is out of the /27 but within the /24 the BGP route is used.


AD is considered by the IP routing mantainer when two different protocols offer a path to the same prefix.

In this case the lower AD route is installed.


In your case being the two subnets with different prefix length both are installed in the routing table and the most specific is used as explained above.



Hope to help

Giuseppe


news2010a Thu, 03/19/2009 - 14:22
User Badges:

Hey thanks!

That explains what I see here, the prefix could win the decision over the AD itself!

Harold Ritter Thu, 03/19/2009 - 19:18
User Badges:
  • Cisco Employee,

Marton,


If you allow me just a precision. It is not that the prefix length wins over the AD but rather that AD only comes into play if two prefixes with the same prefix length are learned from two different sources.


Regards

lamav Fri, 03/20/2009 - 12:37
User Badges:
  • Blue, 1500 points or more

Marlon:


At the risk of being accused of beating a dead horse, let me say that the issue boils down to comparable routes.


Within a routing protocol, two comparable routes that are received will have their metrics compared. The better metric will be selected as the primary path.


When comparing two comparable routes learned from two different routing protocols, such as BGP and OSPF, the routing protocol with the lower AD will win.


Notice that in both cases the keyword to focus on is "comparable." That means they have to have the same prefix length. A /24 route and a /27 are not comparable, so no comparisons are drawn with regard to metrics or AD. Why? Because the more specific route - the one with the longer prefix -- is the better route, period. There is no comparison.


HTH


Victor

Actions

This Discussion