BGP Best path selection process

Hi sir


sir, i`m using this link

R5#show ip bgp
BGP routing table entry for, version 17
Paths: (4 available, best #4, table default)
Advertised to update-groups:
Refresh Epoch 2
1 from (
Origin IGP, metric 515151, localpref 100, valid, external
Refresh Epoch 2
1, (received-only) from (
Origin IGP, metric 0, localpref 100, valid, external
Refresh Epoch 3
4 from (
Origin IGP, metric 545454, localpref 100, valid, external
Refresh Epoch 3
123 from (
Origin IGP, metric 525252, localpref 100, valid, external, best
sir, why the path via R2 is the best ?

if everything is tie up to MED value , R5 should choose the lowest MED value .but since the the command "bgp always-compare-med " is NOT configured on R5 which means R5 should skip this step -6 and move to step-7 which is lowest IGP metric to the next-hop.

as you can see i configured a static route via R1,AD=1.via R2 AD=2. via R4 AD=3 which means the path via R1 should be the best path. but that not happened, why ?

Hey Major,

So, two things. The first is, I know the answer to your question. The second is, I have no idea how you’re receiving any routes from Router 1 or Router 4. Since you only have ebgp multihop configured for router 2, you shouldn’t even be able to connect at the moment, which I find interesting, unless that section is slightly outdated.

For your actual question

  • Correct, everything up to MED is identical which means that you would check MED only if you had two routes with identical AS system paths. Since you do not, this will get skipped as you suggested.
  • Next comes EBGP over IBGP, but that is identical for all routes.
  • The next step is lowest IGP Metric. This is not the “metric” value you are editing with your route-map. That modifies MED. It is also NOT administrative distance (which determines routing protocol priority, not cost), which is what you set on the static route. It is the metric, provided by an IGP (like OSPF) to the BGP Next hop address. Since you used static routes, they are all identical values, as they are not originating from an IGP.
  • Now we choose the route that we received FIRST. So, you clearly formed neighbors with router 2 before any of the other routers, as this is the chosen path. If we went further, the next would choose Router ID, which since we chose R2, we know for a fact it wasn’t determined by Router ID.

So, to answer your question, it seems to be confusion over AD vs IGP Metric, which aren’t the same thing. OSPF always has an AD of 110, but the metric will vary wildly based on costs of the links to get to the destination.

1 Like


No, i`m using disable-connected-check . this parameter is an alternative to the ebgp multihop command .

Ah, good catch, I missed that when reviewing, but since it wasn’t relevant to the overall question didn’t look further.

1 Like