Related Documentation
- J Series
- Understanding BGP Path Selection
- Example: Ignoring the AS Path Attribute When Selecting the Best Path
- Example: Always Comparing MEDs
- LN Series
- Understanding BGP Path Selection
- M Series
- Understanding BGP Path Selection
- Example: Ignoring the AS Path Attribute When Selecting the Best Path
- Example: Always Comparing MEDs
- MX Series
- Understanding BGP Path Selection
- Example: Ignoring the AS Path Attribute When Selecting the Best Path
- PTX Series
- Understanding BGP Path Selection
- Example: Always Comparing MEDs
- QFX Series
- Understanding BGP Path Selection
- Example: Always Comparing MEDs
- SRX Series
- Understanding BGP Path Selection
- Example: Ignoring the AS Path Attribute When Selecting the Best Path
- Example: Always Comparing MEDs
- T Series
- Understanding BGP Path Selection
- Example: Ignoring the AS Path Attribute When Selecting the Best Path
- Example: Always Comparing MEDs
Understanding Routing Table Path Selection for BGP
By default, only the multiple exit discriminators (MEDs) of routes that have the same peer autonomous systems (ASs) are compared. You can configure routing table path selection options to obtain different behaviors.
The third step of the algorithm, by default, evaluates the length of the AS path and determines the active path. You can configure an option that enables the Junos OS to skip this third step of the algorithm by including the as-path-ignore option.
![]() | Note: The as-path-ignore option is not supported for routing instances. |
To configure routing table path selection behavior, include the path-selection statement:
For a list of hierarchy levels at which you can include this statement, see the statement summary section for this statement.
Routing table path selection can be configured in one of the following ways:
- Using the same nondeterministic behavior as does the Cisco
IOS software (cisco-non-deterministic). This behavior has
two effects:
- The active path is always first. All nonactive but eligible paths follow the active path and are maintained in the order in which they were received, with the most recent path first. Ineligible paths remain at the end of the list.
- When a new path is added to the routing table, path comparisons are made without removing from consideration those paths that should never be selected because those paths lose the MED tie-breaking rule.
![]() | Note: The result of these two effects is that the system only sometimes compares the MEDs between paths that it should otherwise compare. Because of this, we recommend that you not configure nondeterministic behavior. |
- Always comparing MEDs whether or not the peer ASs of the compared routes are the same (always-compare-med).
- Comparing the router ID between external BGP paths to determine the active path (external-router-id). By default, router ID comparison is not performed if one of the external paths is active. You can force the router ID comparison by restarting the routing process with the restart routing operational-mode command.
- Adding the IGP cost to the next-hop destination to the
MED before comparing MED values for path selection.
BGP multipath does not apply to paths that share the same MED-plus-IGP cost, yet differ in IGP cost. Multipath path selection is based on the IGP cost metric, even if two paths have the same MED-plus-IGP cost.
Related Documentation
- J Series
- Understanding BGP Path Selection
- Example: Ignoring the AS Path Attribute When Selecting the Best Path
- Example: Always Comparing MEDs
- LN Series
- Understanding BGP Path Selection
- M Series
- Understanding BGP Path Selection
- Example: Ignoring the AS Path Attribute When Selecting the Best Path
- Example: Always Comparing MEDs
- MX Series
- Understanding BGP Path Selection
- Example: Ignoring the AS Path Attribute When Selecting the Best Path
- PTX Series
- Understanding BGP Path Selection
- Example: Always Comparing MEDs
- QFX Series
- Understanding BGP Path Selection
- Example: Always Comparing MEDs
- SRX Series
- Understanding BGP Path Selection
- Example: Ignoring the AS Path Attribute When Selecting the Best Path
- Example: Always Comparing MEDs
- T Series
- Understanding BGP Path Selection
- Example: Ignoring the AS Path Attribute When Selecting the Best Path
- Example: Always Comparing MEDs


