Difference between revisions of "Manual:BGP Best Path Selection Algorithm"

From MikroTik Wiki
Jump to: navigation, search
m (Protected "BGP Best Path Selection Algorithm": will be in manual [edit=sysop:move=sysop])
Line 7: Line 7:
 
A router running BGP arranges all paths for the same prefix in a list that is later used to select the best path. Some paths in this list are not considered for the best path selection algorithm. Routers ignore paths in the following circumstances:
 
A router running BGP arranges all paths for the same prefix in a list that is later used to select the best path. Some paths in this list are not considered for the best path selection algorithm. Routers ignore paths in the following circumstances:
  
* Paths from an external BGP (eBGP) neighbor if the local autonomous system (AS) appears in the [[BGP_Case_Studies_2#AS_PATH_Attribute|AS_PATH]] attribute.
+
* Paths from an external BGP (eBGP) neighbor if the local autonomous system (AS) appears in the AS_PATH attribute.
  
 
: Such paths are not even installed in the BGP Routing Information Base (RIB) and thus do not consume memory. The same applies to any path that is discarded ('''action=discard''') by the routing filters.
 
: Such paths are not even installed in the BGP Routing Information Base (RIB) and thus do not consume memory. The same applies to any path that is discarded ('''action=discard''') by the routing filters.
  
 
==How Routers Select the best Path==
 
==How Routers Select the best Path==
*Prefer the path with the highest [[BGP_Case_Studies_2#WEIGHT_Attribute|WEIGHT]].
+
*Prefer the path with the highest WEIGHT.
:[[BGP_Case_Studies_2#WEIGHT_Attribute|WEIGHT]] parameter is local to the router on which it is configured. A route without assigned [[BGP_Case_Studies_2#WEIGHT_Attribute|WEIGHT]] have a default value of 0.
+
:WEIGHT parameter is local to the router on which it is configured. A route without assigned WEIGHT have a default value of 0.
  
*Prefer the path with the highest [[BGP_Case_Studies_2#LOCAL_PREF_Attribute|LOCAL_PREF]].  
+
*Prefer the path with the highest LOCAL_PREF.
:A path without [[BGP_Case_Studies_2#LOCAL_PREF_Attribute|LOCAL_PREF]] have a value of 100 by default.
+
:A path without LOCAL_PREF attribute have a value of 100 by default.
  
*Prefer the path with the shortest [[BGP_Case_Studies_2#AS_PATH_Attribute|AS_PATH]]. (skipped if '''ignore-as-path-len''' set to '''yes''')
+
*Prefer the path with the shortest AS_PATH. (skipped if '''ignore-as-path-len''' set to '''yes''')
:The router does not compare [[BGP_Case_Studies_2#AS_PATH_Attribute|AS_PATH]] length if '''ignore-as-path-len''' parameter is set to '''yes''' for the respective BGP instance. Each AS_SET counts as 1, regardless of the set size. The AS_CONFED_SEQUENCE and AS_CONFED_SET are not included in the [[BGP_Case_Studies_2#AS_PATH_Attribute|AS_PATH]] length.
+
:The router does not compare AS_PATH attribute length if '''ignore-as-path-len''' parameter is set to '''yes''' for the respective BGP instance. Each AS_SET counts as 1, regardless of the set size. The AS_CONFED_SEQUENCE and AS_CONFED_SET are not included in the AS_PATH length.
  
*Prefer the path that was locally originated via [[BGP_Case_Studies_1#BGP_Aggregates|aggregate]] BGP subcommand
+
*Prefer the path that was locally originated via [[BGP_Case_Studies#BGP_Aggregates|aggregate]] or ''network'' BGP subcommand
  
 
*Prefer the path with the lowest origin type.
 
*Prefer the path with the lowest origin type.
 
:Interior Gateway Protocol (IGP) is lower than Exterior Gateway Protocol (EGP), and EGP is lower than INCOMPLETE
 
:Interior Gateway Protocol (IGP) is lower than Exterior Gateway Protocol (EGP), and EGP is lower than INCOMPLETE
  
*Prefer the path with the lowest multi-exit discriminator ([[BGP_Case_Studies_2#MULTI_EXIT_DISC_Attribute|MED]]).  
+
*Prefer the path with the lowest multi-exit discriminator (MED).  
: The router compare [[BGP_Case_Studies_2#MULTI_EXIT_DISC_Attribute|MED]] only for paths that have the same neighboring (leftmost) AS. Paths with now [[BGP_Case_Studies_2#MULTI_EXIT_DISC_Attribute|MED]] are assigned a [[BGP_Case_Studies_2#MULTI_EXIT_DISC_Attribute|MED]] of 0
+
: The router compare MED attribute only for paths that have the same neighboring (leftmost) AS. Paths without explicit MED value are treated as with MED of 0
  
 
*Prefer eBGP over iBGP paths
 
*Prefer eBGP over iBGP paths
Line 36: Line 36:
  
 
*Prefer the path that comes from the lowest neighbor address
 
*Prefer the path that comes from the lowest neighbor address
[[User:Eugene|Eugene]]
 
  
 
[[Category:Routing]]
 
[[Category:Routing]]

Revision as of 16:49, 14 August 2008

Introduction

Routers running Border Gateway Protocol (BGP) typically receive multiple paths to the destination. The BGP best path selection algorithm decides which is the best path to instal in the IP routing table and use for forwarding traffic.

Best path algorithm compares routes received by a single BGP instance. Routes installed by different BGP instances are compared by the general algorithm, i.e. route distances are compared and the route with lower distance is preferred.

Why Routers Ignore Paths

A router running BGP arranges all paths for the same prefix in a list that is later used to select the best path. Some paths in this list are not considered for the best path selection algorithm. Routers ignore paths in the following circumstances:

  • Paths from an external BGP (eBGP) neighbor if the local autonomous system (AS) appears in the AS_PATH attribute.
Such paths are not even installed in the BGP Routing Information Base (RIB) and thus do not consume memory. The same applies to any path that is discarded (action=discard) by the routing filters.

How Routers Select the best Path

  • Prefer the path with the highest WEIGHT.
WEIGHT parameter is local to the router on which it is configured. A route without assigned WEIGHT have a default value of 0.
  • Prefer the path with the highest LOCAL_PREF.
A path without LOCAL_PREF attribute have a value of 100 by default.
  • Prefer the path with the shortest AS_PATH. (skipped if ignore-as-path-len set to yes)
The router does not compare AS_PATH attribute length if ignore-as-path-len parameter is set to yes for the respective BGP instance. Each AS_SET counts as 1, regardless of the set size. The AS_CONFED_SEQUENCE and AS_CONFED_SET are not included in the AS_PATH length.
  • Prefer the path that was locally originated via aggregate or network BGP subcommand
  • Prefer the path with the lowest origin type.
Interior Gateway Protocol (IGP) is lower than Exterior Gateway Protocol (EGP), and EGP is lower than INCOMPLETE
  • Prefer the path with the lowest multi-exit discriminator (MED).
The router compare MED attribute only for paths that have the same neighboring (leftmost) AS. Paths without explicit MED value are treated as with MED of 0
  • Prefer eBGP over iBGP paths
  • Prefer the route that comes from the BGP router with the lowest router ID. If a route carries the ORIGINATOR_ID attribute, then the ORIGINATOR_ID is used instead of router ID.
  • Prefer the route with the shortest route reflection cluster list. Routes without a cluster list are considered to have a cluster list of length 0.
  • Prefer the path that comes from the lowest neighbor address