Technical Tip: Ignore shortest AS_PATH selection process in BGP routing protocol
Description
This article describes how to skip the best AS-PATH criteria while selecting the best route in the BGP routing protocol.
Scope
To ignore/skip the shortest AS_PATH selection process from the BGP best path selection algorithm.
Solution
In the BGP routing protocol, selecting a specific (destination) prefix/route as best will go through the BGP attribute and path selection process.
Regarding AS-PATH selection, i.e., the prefix with the shortest (least) AS-PATH will be selected as the best route.
To ignore/skip this AS-path selection process from the BGP best-path selection algorithm, use 'set bestpath-as-path-ignore enable' in BGP router configuration mode.
Command:
config router bgp
set bestpath-as-path-ignore enable
end
Example:

- Spoke firewall receiving prefix 1.1.1.1/32 from both ISP1 [AS-65001] and ISP2 [AS-65002]
- The best route has been selected via ISP2 due to the shortest AS Path.

- After applying bestpath-as-path-ignore, reset the bgp connection for ISP2[AS-65002].

- Now the best path has been selected of ISP1[AS-65001].

Related article: