An Autnonomous System path is a list of all the autonomous systems that a specific route passes through to reach one destination. The AS path is displayed as a series of autonomous system (AS) numbers separated by spaces, with the originator's AS number at the end of the path, and the next AS hop from the current router's location in the beginning of the path.
AS-paths are created when a BGP router receives an announcement from an exterior neighbor. When the router receives the route, it adds the AS number of the exterior neighbor to the AS-Path. As the route announcement passes from autonomous system to autonomous system, the path grows longer with each receiver adding the neighbor's AS to the path.
Here is an illustration. Given the following diagram showing the relationship between several AS you can trace the path between them by listing their AS numbers:
44 / \ / \ 12 ----- 6 9 --- 14 / \ / \ 3 5- 7 11
For AS 12 to reach AS 14, it would need to see an AS-Paths containing the following AS numbers tracing the actual path to vector through to reach back through the Internet to the originator of Network Layer Reachability Information for a CIDR block of addresses:
6 44 9 14 6 5 7 9 14
If we recall that by default, BGP
selects only 1 'best' path to a destination, as long as both paths are
valid (reachable), the route with the fewest hops might be the preferred route.
Since the first path has only 4 hops, it would be the preferred route, but only
if the AS hop count attribute were the tie breaker between the routes. As a
point of fact, the selection of the best path rarely comes down to AS-path hop
count as it is fairly low in the list of 'tie breaker' decisions in the BGP
Best Path Algorithm. Local Preference tends to be the tie breaker these
days since most ISP's offer a means to control their local preference by the
use of advertised communities.