cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
9397
Views
10
Helpful
7
Replies

bgp path selection: ebgp vs ibgp vs ospf

Peter Handke
Level 1
Level 1

Hello,

If router get the same prefix from 3 sources in two cases:

case A

- ebgp med 100

- ospf

- ibgp med 100

case B

- ospf

- ibgp med 100

- ebgp med 80

AD is default, which path will be chosen in which order ? I put source protocol in order which i suppose is correct. Am i right ?

thanks for help

Peter

7 Replies 7

John Blakley
VIP Alumni
VIP Alumni

AD is going to be the winner when talking about different protocols. In your case, the order of preference would be:

ebgp

ospf

ibgp

Look at the following article for when med is used:

http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080b79d32.shtml

HTH,
John

*** Please rate all useful posts ***

HTH, John *** Please rate all useful posts ***

cadet alain
VIP Alumni
VIP Alumni

Hi,

in both cases  it will depend which path BGP considers as best then the router will consider AD to install the route in the RIB:

if the BGP best path was the iBGP then OSPF will win but if the best path was eBGP then BGP will win.

in case A if there is a tie up to MED then the eBGP route will be considered best path

in case B if there is a tie up to MED  then the lower MED will win

Regards

Alain

Don't forget to rate helpful posts.

Don't forget to rate helpful posts.

Alain,

I labbed this up and to my surprise got a totally different result than what I was expecting and was hoping you could shed some light on it.

I have 3 routers:

     one with ibgp

     one with ebgp

     one with ospf

All of them are advertising 1.1.1.1/3 and all are peering with a single router with subinterfaces. I would have though once the external bgp neighbor came up, the router would put it in the RIB, but the ospf route is staying and I'm getting a RIB failure:

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd

192.168.1.1     4     1       9       8        3    0    0 00:05:16        1

192.168.2.2     4     2       9       9        3    0    0 00:05:13        1

R4#sh ip ospf neigh

Neighbor ID     Pri   State           Dead Time   Address         Interface

1.1.1.1           1   FULL/DR         00:00:35    192.168.3.3     FastEthernet0/0.30

R4#sh ip bgp rib-failure

Network            Next Hop                      RIB-failure   RIB-NH Matches

1.1.1.1/32         192.168.1.1         Higher admin distance              n/a

Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path

r  1.1.1.1/32       192.168.2.2              0             0 2 i

r>i                 192.168.1.1              0    100      0 i

R4#sh ip route 1.1.1.1

Routing entry for 1.1.1.1/32

  Known via "ospf 1", distance 110, metric 11, type intra area

  Last update from 192.168.3.3 on FastEthernet0/0.30, 00:03:18 ago

  Routing Descriptor Blocks:

  * 192.168.3.3, from 1.1.1.1, 00:03:18 ago, via FastEthernet0/0.30

      Route metric is 11, traffic share count is 1

Being that the AD is higher than ebgp, I'm wondering why the routing table isn't being updated. Any thoughts?

HTH, John *** Please rate all useful posts ***

Hello John,

I think that your case is:

- iBGP route win over eBGP because of AS_PATH, 0 vs 1

- OSPF route wins over iBGP because of lower AD

So overall winer is OSPF route.

In general, Alain mentioned rules which apply when deciding which routes will be in routing table and which will not, so Alain is right. 

Best Regards

Please rate all helpful posts and close solved questions

Best Regards Please rate all helpful posts and close solved questions

You are EXACTLY correct. I've been playing around with things after posting that and that's what I noticed.

HTH, John *** Please rate all useful posts ***

Hi Alain,

Hope you are doing fine, are you working in networking now?

Wish you all the best!!

David Salazar
Level 1
Level 1

Regards, Peter

The question presents some ambiguity, however if we separate two ecenarios.

1) The router must select a route for RIB table and the route is learned by various routing protocols. For example: OSPF, eBGP, iBGP.

Here it is useful the following link: http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094823.shtml

2) The router will select a route from the BGP table that have different origins (whether you use the network command or redistribute the BGP routing protocol) for RIB table.

Here it is useful the following link:

http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094431.shtml

http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080b79d32.shtml

Importantly, the route selection algorithm used by BGP, takes multiple criteria in a sequential order where the MED (metric in BGP), which is located in 6th place of criteria to compare or take into account, it makes it unlikely in the selection, unless multiple conditions are met and / or use the command

---------------

Importantly, the response was preparing and translating had to go because my native language is Spanish. Respond when I saw that you already rated it respodieron correctly and then you gave important information to give you an answer.

But I did not stop publishing my response, I mention two technical documents that can be valuable to other people who see the future discucion.

Review Cisco Networking for a $25 gift card