cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1251
Views
0
Helpful
4
Replies

BGP path selection question: administrative distance is non-factor?

gwhuang5398
Level 2
Level 2

BGP routes have administrative distance of 20 for ebgp and 200 for ibgp. However in the first a few steps of path selection process, administrative distance is not a factor. This may cause ibgp routes to be selected over ebgp routes as the best route in BGP table and then gets installed into routing table. I was confused about this. Can someone give me a good education?

Using a typical example of local preference where you have two routers R1 and R2 as ibgp peers in AS1. Router R3 as R1's ebgp peer in AS3 and router R4 as R2's ebgp peer in AS4 (R1 connects to R3 and R2 connects to R4).

Now both R3 and R4 advertise the same prefix 11.0.0.0/8 to their ebgp peers: R3 to R1 and R4 to R2. R1 receives and sets local preference to 200. R2 also receives but keeps the local preference as 100.

Because R1 and R2 are ibgp peers. So R1 also advertises the prefix to R2 with local preference 200. After R2 receives, it will select this one as the best route in its BGP table as oppsed to the ebgp route with local preference of 100.

My confusion is: should R2 always use a ebgp route because lower administrative distance? but in that case, what about the local preference path selection? (this example is very typical in CCNP and CCIE books. I didn't make it up)

Thanks a lot

Gary

1 Accepted Solution

Accepted Solutions

Peter Paluch
Cisco Employee
Cisco Employee

Gary,

A similar problem has been discussed in this thread:

https://supportforums.cisco.com/message/3223477#3223477

You may want to read about it further.

Best regards,

Peter

View solution in original post

4 Replies 4

Peter Paluch
Cisco Employee
Cisco Employee

Hello Gary,

No, the administrative distance is never used in BGP bestpath algorithm. The administrative distance is a result of the algorithm, not its input parameter.

My confusion is: should R2 always use a ebgp route because lower 
administrative distance? but in that case, what about the local 
preference path selection? (this example is very typical in CCNP and 
CCIE books. I didn't make it up)

No, R2 should not use the eBGP route in your example. It has learned the 11.0.0.0/8 network via eBGP from R4, and via iBGP from R1. Because of the BGP bestpath algorithm, the local preference will decide that the better path is via R1. So, the R2 will install the network 11.0.0.0/8 via R1 into its routing table, and because it was learned via iBGP, it will be assigned the AD of 200.

The AD is assigned to routes when and only when they are being installed into the routing table. That means, however, that the best path algorithm has already decided which route is the best - so the AD could not have influenced this because during the best path computation, it was not present in the routing table at all.

Does this make sense?

Best regards,

Peter

Peter Paluch
Cisco Employee
Cisco Employee

Gary,

A similar problem has been discussed in this thread:

https://supportforums.cisco.com/message/3223477#3223477

You may want to read about it further.

Best regards,

Peter

Thanks Peter. It's clear now.

ciscomocsic
Level 1
Level 1

I know this is an old thread, but the Link of the solution is not available anymore. So to future colleagues. It is and id doesn't.

AD is mostly used to give preference or priority between routing protocols. For instance: an EIGRP route(internal) has an AD of 90 and it is preferred over an OSPF route with an AD of 110. Simple right? Now for BGP (eBGP vs iBGP) it is not about AD perse, but en external BGP route (or I should say Path) is preferred over an internal BGP Path and yes those are part of the PATH Selection Process:

W = Weight
L = Local Preference
O = Originate (local)
AS = AS_PATH (shortest)
O = ORIGIN Code (IGP > EGP > Incomplete)
M = MED (lowest)
P = Paths [ External over Internal ] <----
R = RID (lowest Router ID)


But think what will happen if the AD is taken into consideration. Then the PATH selection process won't work at all.

So if you learn a route from an eBGP Peer, then those routes would be preferred always because the AD will be always lower(20) than an iBGP route. So instead of relying on AD, the BGP PATH Selection Process and its attibutes is used.

Now, if you see an eBGP route as preferred, it is not about the AD, it just means that all the steps in the PSP (Path Selection Process) are equal until the "P" or Paths values (external or internal) breaks the tie.

The show ip route bgp command with this output: B 30.30.0.0/24 [200/0] via 10.0.12.1, 21:23:06 <<-- This doesn't mean the route was preferred because the AD is 200, it just showing the kind of BGP learnt route. This is an internal bgp path route.

and this: B 30.30.1.0/24 [20/0] via 10.0.26.6, 21:23:06 <<-- This is an external BGP Path learnt route.

But the show ip route bgp doesn't tell you why these routes are selected, the show ip bgp command will let you know, and it will be based on the PSP.

Review Cisco Networking for a $25 gift card