match as-path

To match a Border Gateway Protocol (BGP) autonomous system (AS) path access list, use the match as-path command. To remove a path list entry, use the no form of this command.

match as-path name []

no match as-path name []

Syntax Description


Autonomous system path access list. The name can be any alphanumeric string up to 63 characters.

(Optional) Autonomous system path access list. You can configure up to 32 access list names.

Command Default

No path lists are defined.

Command Modes

Route-map configuration mode

Command History



This command was introduced.

Usage Guidelines

The values set by the match as-path command overrides global values.

A route map can have several parts. Any route that does not match at least one match clause relating to a route-map command is ignored; that is, the route is not advertised for outbound route maps and is not accepted for inbound route maps. If you want to modify some particular data, you must configure a second route-map section with an explicit match specified.


This example sets the autonomous system path to match BGP autonomous system path access list 20:

switch(config)# route-map IGP2BGP
switch(config-route-map)# match as-path 20

Related Commands


match community

Matches a BGP community.

match ip address

Distributes any routes that have a destination network number address that is permitted by a standard or expanded access list.

match ip next-hop

Redistributes any routes that have a next-hop router address passed by one of the access lists specified.

match route-type

Redistributes routes of the specified type.

match tag

Redistributes routes in the routing table that match the specified tags.


Defines the conditions for redistributing routes from one routing protocol into another.

set as-path

Modifies an autonomous system path for BGP routes.

set comm-list

Automatically computes the tag value in a route map configuration.

set community

Sets BGP community list (for deletion).

set level

Indicates where to import routes.

set local-preference

Specifies a preference value for the autonomous system path.

set metric (BGP, OSPF, RIP)

Sets the metric value for a routing protocol.

set metric-type

Sets the metric type for the destination routing protocol.

set origin (BGP)

Sets the BGP origin code.

set tag

Sets the value of the destination routing protocol.

set weight

Specifies the BGP weight for the routing table.