AS Paths and AS Path Lists
AS Paths and AS Path Lists Overview
An AS path is the autonomous systems that routing information passed through to get to a specified router. It indicates the origin of this route. The AS path is used to prevent routing loops in BGP.
You can use this routing information to prefer one path to a destination network over another. To set route preferences, configure filters to apply to AS paths when importing and exporting routes. Each autonomous system through which a route passes appends its AS number to the beginning of the AS path.
Advanced Routing Suite includes a powerful implementation of AS path regular expressions. The entire AS path regular expression must be contained within the <...> or within (...). The content is read from left to right. The left side matches the beginning of the AS path; the right side matches the end of the AS path. The alphabet (set of valid members) is the valid range of AS numbers, or more specifically, {1 ... 65535}. Also, Advanced Routing Suite supports the following "wildcards" or expressions that can be used to build a regular expression:
. - (period) represents any valid member of the alphabet
* - (asterisk) matches zero or more of the preceding element/expression
+ - (plus sign) matches one or more of the preceding element/expression
# - (pound sign) matches zero or one occurrence of the preceding element/expression
Binary operators:
" " (AND) - any sequence of elements and/or expressions separated by a space (" ")
"| " (OR) - any sequence of elements and/or expressions separated by the vertical line symbol ("|")
The symbols "[] " are used to delimit a set of AS numbers. The set may be a list of AS numbers separated by a space or a range of AS numbers separated by a dash (- ). If the entire list of members is prefixed with a "^ ", then the valid members are those not listed in the set. (Because a null string or empty string is not an instance in the alphabet, AS numbers such as [^808] will not match an empty string.) Examples of AS path regular expressions follow:
Match any single AS number as the AS path:
"."
Match all AS paths coming from a given AS that start with 808:
"808 .*"
Match all paths that do not end with the given AS numbers but must have at least one AS:
".* [^808 809]"
Match a path that has only valid exterior AS numbers:
"[1-6451]+"
Match 305 808 and exactly one other AS number other than 100:
"305 808 [^100]"
Match 305 808 and any other AS number except 100 or no additional AS. That is, match either 305 808 as the complete path or 305 808 x, where x is any integer other than 100:
"305 808 [^100]"
Match either 808 or 305 with no additional AS numbers in the path:
"305|808"
Note: For users familiar with gated.conf or Advanced Routing Suite XML configuration, some characters that are normally used in regular expressions have special meaning in the Advanced Routing Suite CLI. Therefore, these characters are substituted by others.
- <space> is replaced by an underscore.
For example, the regular expressions 808 and 804 are separated by an underscore in this command:
(config)# ip as-path name bar 808_804 any - "?" is replaced by the character "#".
For example, the regular expression 808? is replaced by 808# in this command:
(config)# ip as-path name bar 808# any
ip as-path access-list
Name
ip as-path access-list - specifies a BGP AS_PATH regular expression to be used in filtering
Syntax
ip as-path access-list name [ ( [ permit | deny ]
regexp origin ) | [ named as-path-name ] ]
no ip as-path access-list name
Mode
Global Configuration
Parameters
name - the name of this AS Path access list specified as a string of characters
permit | deny - specifies whether to allow or reject this AS Path regular expression
regexp - the regular expression
origin - one of either egp , igp , incomplete , or any
named as-path-name - specifies the name of a configured access list
Description
The ip as-path access-list command specifies a BGP AS _PATH regular expression used in filtering. An AS path access list does nothing until it is referred to in the context of policy. This must be done within a route map and then referred to within a protocol.
The origin specifies whether the route was learned from an EGP source, an IGP source, or another source. An origin of igp indicates the route was learned from an Intra-Domain Routing Protocol and is most likely complete. An origin of egp indicates the route was learned from the EGP protocol, and the path is most likely not complete. When the route is learned from another source, an origin of incomplete is used. An origin of any can be used to match any origin.
Default
No AS path access lists are defined by default.
Command History
NGC 2.2 - This command was introduced.
Examples
Example 1
The following example configures an access list named "abc" with two list entries. The first entry permits regular expression 808.* with an origin of any. The second entry denies regular expression 900.* with an origin of any.
(config)# ip as-path access-list abc permit 808.* any
(config)# ip as-path access-list abc deny 909.* any
Example 2
The following example configures an access list named "abc" to apply the regular expression of a configured AS path named "blah."
(config)# ip as-path access-list abc named blah
ip as-path name
Name
ip as-path name - specifies a BGP AS_PATH regular expression to be used in filtering
Syntax
ip as-path name name regexp origin
no ip as-path name name
Mode
Global Configuration
Parameters
name - the name of this AS Path regular expression specified as a string of characters
regexp - the regular expression
origin - one of either egp , igp , incomplete , or any
Description
The ip as-path name command is used to specify a BGP AS _PATH regular expression used in filtering. An AS path list does nothing until it is referred to in the context of policy. This must be done within a route map and then referred to within a protocol.
The origin specifies whether the route was learned from an EGP source, an IGP source, or another source. An origin of igp indicates the route was learned from an Intra-Domain Routing Protocol and is most likely complete. An origin of egp indicates the route was learned from the EGP protocol, and the path is most likely not complete. When the route is learned from another source, an origin of incomplete is used. An origin of any can be used to match any origin.
Default
No AS paths are defined by default.
Command History
NGC 2.2 - This command was introduced.
Examples
Example 1
The following example configures an AS path regular expression called "bar" that permits regular expression 808.* with an origin of any.
(config)# ip as-path name bar 808.* any
Example 2
The following example configures an AS path regular expression called "bar" that permits regular expression 808.* with an origin of any. The configured AS path regular expression is then referenced in an AS Path Access List configuration.
(config)# ip as-path name bar 808.* any
(config)# ip as-path access-list abc permit named bar
show ip as-path-access-list
Name
show ip as-path-access-list - displays information about BGP access lists
Syntax
show ip as-path-access-list [name]?
Mode
User Execution
Parameters
name - optionally specify a single AS path access list name
Description
Use the show ip as-path-access-list query to obtain information about BGP access lists. If a name is given, then the information returned pertains only to that access list. If name is not given, then information about all AS path access lists is returned.
Command History
NGC 2.2 - This command was introduced.
Examples
The following example is a request for information about a single access list called "abc."
> show ip as-path-access-list abc
AS path access list abc
deny .*
permit 201
Field Descriptions
The following table describes the fields that appear in the BGP AS Path Access List Query.
BGP AS Path Access List Query Fields
Field
|
Description
|
AS path access list
|
The name of the AS Path Access List
|
permit/deny
|
Specifies whether the list is permitted or denied, followed by an AS Path regular expression
|
show ip bgp paths
Name
show ip bgp paths - displays information about BGP AS Paths
Syntax
show ip bgp paths
Mode
User Execution
Parameters
none
Description
Use the show ip bgp paths query to obtain information about all BGP AS Paths.
Command History
NGC 2.2 - This command was introduced.
Examples
The following example returns information for BGP AS Paths.
> show ip bgp paths
Refcount Metric Path
5 50 202 201 200
10 10 200
Field Descriptions
The following table describes the fields that appear in the BGP AS Path Query.
BGP AS Path Query Fields
Field
|
Description
|
Refcount
|
The number of routes using that path
|
Metric
|
The MED value for the path
|
Path
|
The AS Path value
|
|