The decision process Quagga BGP uses to select routes is as follows:
prefer higher local weight routes to lower routes.
prefer higher local preference routes to lower.
Prefer local routes (statics, aggregates, redistributed) to received routes.
Prefer shortest hop-count AS_PATHs.
Prefer the lowest origin type route. That is, prefer IGP origin routes to EGP, to Incomplete routes.
Where routes with a MED were received from the same AS, prefer the route with the lowest MED. See BGP MED.
Prefer the route received from an external, eBGP peer over routes received from other types of peers.
Prefer the route with the lower IGP cost.
If multi-pathing is enabled, then check whether the routes not yet distinguished in preference may be considered equal. If bgp bestpath as-path multipath-relax is set, all such routes are considered equal, otherwise routes received via iBGP with identical AS_PATHs or routes received from eBGP neighbours in the same AS are considered equal.
Where both routes were received from eBGP peers, then prefer the route which is already selected. Note that this check is not applied if bgp bestpath compare-routerid is configured. This check can prevent some cases of oscillation.
Prefer the route with the lowest router-ID. If the route has an ORIGINATOR_ID attribute, through iBGP reflection, then that router ID is used, otherwise the router-ID of the peer the route was received from is used.
The route with the shortest cluster-list length is used. The cluster-list reflects the iBGP reflection path the route has taken.
Prefer the route received from the peer with the higher transport layer address, as a last-resort tie-breaker.
This command specifies that the length of confederation path sets and sequences should should be taken into account during the BGP best path decision process.
This command specifies that BGP decision process should consider paths of equal AS_PATH length candidates for multipath computation. Without the knob, the entire AS_PATH must match for multipath computation.
Ensure that when comparing routes where both are equal on most metrics, including local-pref, AS_PATH length, IGP cost, MED, that the tie is broken based on router-ID.
If this option is enabled, then the already-selected check, where already selected eBGP routes are preferred, is skipped.
If a route has an ORIGINATOR_ID attribute because it has been reflected, that ORIGINATOR_ID will be used. Otherwise, the router-ID of the peer the route was received from will be used.
The advantage of this is that the route-selection (at this point) will be more deterministic. The disadvantage is that a few or even one lowest-ID router may attract all trafic to otherwise-equal paths because of this check. It may increase the possibility of MED or IGP oscillation, unless other measures were taken to avoid these. The exact behaviour will be sensitive to the iBGP and reflection topology.