Technical Documentation

Configuring 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 get different behaviors.

You can also configure an option that enables the JUNOS Software to skip the third step of the algorithm that determines the active path.

To configure routing table path selection behavior, include the path-selection statement:

path-selection {(cisco-non-deterministic | always-compare-med | external-router-id);med-plus-igp {igp-multiplier number;med-multiplier number;}}

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.

These two effects cause the system to only sometimes compare 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).

For an example of always comparing MEDs, see Configuring Routing Table Path Selection for BGP.

  • 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.
  • Adding the IGP cost to the next-hop destination to the MED before comparing MED values for path selection.

For a description of the algorithm used to determine the active path, see How the Active Route Is Determined.

Example: Always Comparing MEDs

In this example, paths learned from 208.197.169.15 have their MED values compared to the sum of 4 and the MED values of the same paths learned from 208.197.169.14:

[edit]protocols {bgp {path-selection always-compare-med;group ref {type external;import math;peer-as 10458;neighbor 208.197.169.14;}group ref {type external;peer-as 10;neighbor 208.197.169.15;}}}policy-options {policy-statement math {then {metric add 4;}}}

Published: 2010-01-12