This is a short look at the third step in the BGP best-path selection process, which started from reading the explanation in the CCIE Routing and Switching Certification Guide text:

  • it first states that it prefers "Locally injected routes - Pick the route injected into BGP locally; (using the network command, redistribution, or route summarization)."
  • but then it also says "Choose Between Locally Injected Routes Based on ORIGIN PA" and concludes that you should remember the preference of the 3 codes that make the ORIGIN PA.

This is a bit confusing because, as you should know, the ORIGIN PA is tested at step 5 of the process. What the second one is saying is, that in the specific case where all of the routes that are being compared have been injected into BGP on the LOCAL router, the ORIGIN will, indeed, be the tie-breaker.

And this is true, but with a few considerations:

  • we are talking about a Cisco router, which first of all looks at the Weight of a route. All locally injected routes will have a 32768 weight, while learned routes have 0, so local routes will anyway be picked at step 1 of the process.
  • the only case in which the weight would be the same is when the routes are either both learned (and step 3 ignores them) or they are both locally injected. And in this second case the distinction between them is done by ORIGIN PA.

Step 3 described in other texts

Jeff Doyle's Routing TCP/IP Vol II

"If the LOCAL_PREF values are the same, prefer the route that was originated locally on the router. That is, prefer a route that was learned from an IGP on the same router."

Sam Halabi's Internet Routing Architectures

"If there are no locally originated routes and the local preference is the same, prefer the route with the shortest AS_PATH."

The examples

Let me give two examples, ignoring the administrative weight (as if we were on a non-Cisco router):

  • R1 receives a route for network 10.1.0.0/24 from a neighbor with origin (i). R1 also has a redistribute command that introduces a route towards network 10.1.0.0/24, but with an origin of (?) due to redistribution. BGP will choose the redistributed route because it is injected locally.
       Network          Next Hop            Metric LocPrf Weight Path
    *> 10.1.0.0/24      10.12.1.1               11         32768 ?
    * i                 10.12.0.1                0    100  32768 i
  • R1 has a route for network 10.1.0.0/24 through a network statement which will have an origin of (i). It also gets the route to 10.1.0.0/24 through a redistribute connected command with origin (?). As both of them are locally injected, the tiebreaker will be the ORIGIN.

Any comments? Contact me via Mastodon or e-mail.


Share & Subscribe!