Configuring BGP4
Table 10.2: BGP4 Special Characters for Regular Expressions (Continued)
( ) Parentheses allow you to create complex expressions. For example, the
following complex expression matches on “abc”, “abcabc”, or
“abcabcabcdefg”, but not on “abcdefgdefg”:
((abc)+)|((defg)?)
Character Operation
If you want to filter for a special character instead of using the special character as described in Table 10.2 on
page 10-49, enter “\” (backslash) in front of the character. For example, to filter on AS-path strings containing an
asterisk, enter the asterisk portion of the regular expression as “\*”.
HP9300(config-bgp-router)# as-path-filter 2 deny \*
To use the backslash as a string character, enter two slashes. For example, to filter on AS-path strings containing
a backslash, enter the backslash portion of the regular expression as “\\”.
HP9300(config-bgp-router)# as-path-filter 2 deny \\
Filtering Communities
You can filter routes received from BGP4 neighbors based on community names. Use either of the following
methods to do so.
A community is an optional attribute that identifies the route as a member of a user-defined class of routes.
Community names are arbitrary values made of two five-digit integers joined by a colon. You determine what the
name means when you create the community name as one of a route’s attributes. Each string in the community
name can be a number from 0 – 65535.
This format allows you to easily classify community names. For example, a common convention used in
community naming is to configure the first string as the local AS and the second string as the unique community
within that AS. Using this convention, communities 1:10, 1:20, and 1:30 can be easily identified as member
communities of AS 1.
The routing switch provides the following methods for filtering on AS-path information:
• Community filters
• Community list ACLs
NOTE: The routing switch cannot actively support community filters and community list ACLs at the same time.
Use one method or the other but do not mix methods.
NOTE: Once you define a filter or ACL, the default action for communities that do not match a filter or ACL is
“deny”. To change the default action to “permit”, configure the last filter or ACL entry as “permit any any”.
Community filters or ACLs can be referred to by match statements in a route map.
Defining a Community Filter
USING THE CLI
To define filter 3 to permit routes that have the NO_ADVERTISE community, enter the following command:
HP9300(config-bgp-router)# community-filter 3 permit no-advertise
Syntax: community-filter <num> permit | deny <num>:<num> | internet | local-as | no-advertise | no-export
The <num> parameter identifies the filter’s position in the community filter list and can be from 1 – 100. Thus, the
community filter list can contain up to 100 filters. The router applies the filters in numerical order, beginning with
the lowest-numbered filter. When a filter match is true, the router stops and does not continue applying filters from
the list.
10 - 51