Configuring the Community Attribute
To create a named community and define the community members, include the
communitystatement:communityname{invert-match;members [community-ids];}You can include this statement at the following hierarchy levels:
To include the community in a routing policy, include the
communitycondition in thefromstatement:[edit policy-options]communitynamemembers [community-ids];policy-statementpolicy-name{termterm-name{from {community [names];}}}
nameidentifies the community or communities. It can contain letters, numbers, and hyphens (-) and can be up to 255 characters long. To include spaces in the name, enclose the entire name in quotation marks (double quotes).
community-idsdefines one or more members of the community. It consists of two components, which you specify in the following format:as-number:community-value
as-number—AS number of the community member. It can be a value from 1 through 65,534. You can specify the AS number in one of the following ways:
- AS number.
- Asterisk (*)—A wildcard character that matches all AS numbers. (In the definition of the community attribute, the asterisk also functions as described in Table 19.)
- Period (.)—A wildcard character that matches any single digit in an AS number.
- Group of AS numbers—A single AS number or a group of AS numbers enclosed in parentheses. Grouping the numbers in this way allows you to perform a common operation on the group as a whole and to give the group precedence. The grouped numbers can themselves include regular expression operators. For more information about the community regular expressions, see Configuring the Community Attribute Using UNIX Regular Expressions.
community-value—Identifier of the community member. It can be a number from 0 through 65,535. You can specify the community value in one of the following ways:
- Community value number.
- Asterisk (*)—A wildcard character that matches all community values. (In the definition of the community attribute, the asterisk also functions as described in Table 19.)
- Period (.)—A wildcard character that matches any single digit in a community value number.
- Group of community value numbers—A single community value number or a group of community value numbers enclosed in parentheses. Grouping the regular expression in this way allows you to perform a common operation on the group as a whole and to give the group precedence. The grouped path can itself include regular expression operators.
You also can specify
community-idas one of the following well-known community names, which are defined in RFC 1997, BGP Communities Attribute:
no-advertise—Routes in this community name must not be advertised to other BGP peers.no-export—Routes in this community must not be advertised outside a BGP confederation boundary.no-export-subconfed—Routes in this community must not be advertised to external BGP peers, including peers in other members' ASs inside a BGP confederation.Additionally, you can explicitly exclude BGP community information with a static route by using the
noneoption. Include this option when configuring an individual route in therouteportion to override a community option specified in thedefaultsportion.