set as-path




set as-path {tag | prepend as-path-string}
no set as-path {tag | prepend as-path-string}


Syntax Description:

tag Converts the tag of a route into an autonomous system path. Applies only when redistributing routes into BGP.
prepend as-path-string Appends the string following the keyword prepend to the autonomous system path of the route that is matched by the route map. Applies to inbound and outbound BGP route maps.


Command Description:

To modify an autonomous system path for BGP routes, use the set as-path command in route-map configuration mode. To not modify the autonomous system path, use the no form of this command.

The only global BGP metric available to influence the best path selection is the autonomous system path length. By varying the length of the autonomous system path, a BGP speaker can influence the best path selection by a peer further away.

By allowing you to convert the tag into an autonomous system path, the set as-path tag variation of this command modifies the autonomous system length. The set as-path prepend variation allows you to "prepend" an arbitrary autonomous system path string to BGP routes. Usually the local autonomous system number is prepended multiple times, increasing the autonomous system path length.


The following example converts the tag of a redistributed route into an autonomous system path:

Router(config)#route-map set-as-path-from-tag
Router(config-route-map)#set as-path tag

Router(config)#router bgp 100
Router(config-router)#redistribute ospf 109 route-map set-as-path-from-tag

The following example prepends 100 100 100 to all the routes advertised to

Router(config)#route-map set-as-path
Router(config-route-map)#match as-path 1
Router(config-route-map)#set as-path prepend 100 100 100

Router(config)#router bgp 100
Router(config-router)#neighbor route-map set-as-path out



Related Commands:

match as-path
match community
match interface
match ip address
match ip next-hop
match ip route-source
match metric
match route-type
match tag
set automatic-tag
set community
set level
set local-preference
set metric
set metric-type
set next-hop
set origin
set tag
set weight

� Cisco Systems, Inc. 2001, 2002, 2003
World Wide Education

Converted from CHM to HTML with chm2web Pro 2.85 (unicode)