Recently I caught myself struggling to remember the exact BGP path selection mechanism process, so I thought it would be an excellent opportunity to come back and make one more attempt at writing refreshing notes.
BGP is considered the most popular and most flexible routing protocol, at least at this moment.
The protocol’s flexibility involves complicated processes working behind the scenes, including the path selection mechanism itself.
The BGP has many tiebreakers, and even before starting work with the route, it checks the validity. If the route is not suppressed, there is no rib-failure, no local AS shown in the AS-PATH, etc.
Attributes are divided into several groups, described in the RFC 4271 and RFC 4456
| Well-known | Mandatory | Discretionary |
|---|---|---|
| AS_PATH | + | |
| NEXT_HOP | + | |
| ORIGIN | + | |
| LOCAL_PREF | + | |
| ATOMIC_AGGREGATE | + |
| Optional | Transitive | Non-Transitive |
|---|---|---|
| AGGREGATOR | + | |
| Community | + | |
| MED | + | |
| ORIGINATOR | + | |
| CLUSTER_LIST | + |
The BGP path selection process heavily relies on attributes. However, besides attributes, it includes additional parameters considered during the process.
The selection process depends on a vendor or specific BGP implementation. A particular one was chosen based on Cisco devices’ behavior.
My favourite menmonics for the Path selection mechanism:
N WLLA OMNI ORCA
| N | NEXT_HOP | Make sure that next-hop is reachable |
| W | WEIGHT | Exists in Cisco/Quagga/FRR. Highest preferred. Locally significant |
| L | LOCAL_PREF | Highest preferred. Works within BGP AS. |
| L | Locally originated | Prefer locally originated path via network or aggregate command. NLRI originated by the BGP speaker |
| A | AS_PATH | Shortest AS_PATH preferred. AS_SET counts as single AS within the AS_PATH attribute |
| O | ORIGIN | Lowest origin type preferred ( 0 [IGP] < 1 [EGP] < 2 [INCOMPLETE] ) |
| M | MED | Lowest preferred |
| N | Neighbor type | Prefer eBGP path over iBGP |
| I | IGP metric | Prefer lowest IGP metric to BGP next-hop |
| M | Multipath | Identify if multipath path is required |
| O | Oldest | Oldest path preferred (based on the route age) |
| R | Router-ID | Prefer lowest Router-ID |
| C | CLUSTER_LIST | Minimum CLUSTER_LIST length |
| A | Neighbor address | Lowest neighbor address |
Leave a comment