The following algorithm is applied for the selection of the best path:
- The next hop in the BGP update message is available.
- The device's own AS is not in the AS-Path.
- The next hop is not the device's own address.
- Highest weight
- Highest local preference
- Shortest AS_PATH (AS_SET counts as length 1)
- Lowest origin (IGP < EGP < Incomplete)
- Lowest MEDNote: This applies only if the compared routes are from the same neighbor AS.
- eBGP is preferred before iBGP.
- Lowest router ID
- Neighbor with lowest IP address
- Neighbor with lowest RTG tag
- The oldest path is preferred over a newly learned path.