Community Lists
For a community list, the input string is the community attribute of the routes to
which the list is applied using a route-map command. If the community attribute
matches the regular expression in the community list, the route matches the
community list.
The following commands apply route map 5 to routes forwarded to BGP peer 10.5.5.4.
Example
Route map 5 uses a regular expression to match community numbers ending with
305, setting the weight of matching routes to 150.
Community Numbers
When you use a regular expression to match a community number, use the
appropriate format for the community number in the community list. If you issue
the ip bgp-community new-format command, the community number has the
format AA:NN where AA is a number that identifies the autonomous system, and NN
is a number that identifies the community within the autonomous system. Otherwise,
the community number is an integer in the range 1–4294967295.
Metacharacters
Each regular expression consists of one or more metacharacters and zero or more
complete or partial AS or community numbers. Table 5 on page 45 describes the
metacharacters supported for regular expression pattern-matching.
Table 5: Supported Regular Expression Metacharacters
host1(config-router)#neighbor 10.5.5.4 remote-as 425
host1(config-router)#neighbor 10.5.5.4 route-map 5 out
host1(config-router)#exit
host1(config)#route-map 5 permit 10
host1(config-route-map)#match community 305$
host1(config-route-map)#set weight 150
Metacharacter
Description
^
Matches the beginning of the input string.
Alternatively, when used as the first character within brackets [^ ] matches
any number except the ones specified within the brackets.
$
Matches the end of the input string.
.
Matches any single character, including white space.
*
Matches zero or more sequences of the immediately previous character or
pattern.
+
Matches one or more sequences of the immediately previous character or
pattern.
Chapter 1: Configuring Routing Policy
Using Regular Expressions
45
Need help?
Do you have a question about the IP SERVICES - CONFIGURATION GUIDE V 11.1.X and is the answer not in the manual?
Questions and answers