BGP path selection mechanism

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-knownMandatoryDiscretionary
AS_PATH+
NEXT_HOP+
ORIGIN+
LOCAL_PREF+
ATOMIC_AGGREGATE+
OptionalTransitiveNon-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

NNEXT_HOPMake sure that next-hop is reachable
WWEIGHTExists in Cisco/Quagga/FRR. Highest preferred. Locally significant
LLOCAL_PREFHighest preferred. Works within BGP AS.
LLocally originatedPrefer locally originated path via network or aggregate command. NLRI originated by the BGP speaker
AAS_PATHShortest AS_PATH preferred. AS_SET counts as single AS within the AS_PATH attribute
OORIGINLowest origin type preferred
( 0 [IGP] < 1 [EGP] < 2 [INCOMPLETE] )
MMEDLowest preferred
NNeighbor typePrefer eBGP path over iBGP
IIGP metricPrefer lowest IGP metric to BGP next-hop
MMultipathIdentify if multipath path is required
OOldestOldest path preferred (based on the route age)
RRouter-IDPrefer lowest Router-ID
CCLUSTER_LISTMinimum CLUSTER_LIST length
ANeighbor addressLowest neighbor address

Leave a comment