BGP routers receive multiple paths to the same destination. The algorithm determines the best path.
The BGP decision process is applied to the routes in the Routing Information Base, Incoming (RIB-In), which contains routes learned from inbound UPDATE messages. The output of the decision process is the set of routes that will be advertised to BGP speakers in local or remote autonomous systems and stored in the Adjacency RIB, Outgoing (RIB-Out).
The device uses the following algorithm to weigh the paths and determine the optimal path for the route. The optimal path depends on various parameters, which can be modified.
The as-path ignore command disables the comparison of the AS path lengths of otherwise equal paths.
This step can be skipped if the as-path-ignore command is configured.
The device compares the MEDs of two otherwise equivalent paths only if the routes were learned from the same neighboring autonomous system. This behavior is called deterministic MED. Deterministic MED is always enabled and cannot be disabled.
To ensure that the MEDs are always compared, regardless of the autonomous system information in the paths, the always-compare-med command can be used. This option is disabled by default.
The med-missing-as-worst command can be used to make the device regard a BGP4 route with a missing MED attribute as the least-favorable path when the MEDs of the route paths are compared.
MED comparison is not performed for internal routes that originate in the local autonomous system or confederation, unless the compare-med-empty-aspath command is configured.
Note
For EGP routes, load sharing applies only when the paths are from neighbors in the same remote autonomous system. EGP paths from neighbors in different autonomous systems are not compared, unless multipath multi-as is enabled.