Configuring a Community Set

Community sets apply only to BGP and are used to match the community attribute of BGP routes. This section describes how to configure community sets.

Procedure

  • Configure a community set using the paragraph editing mode.
    1. Run the edit xpl community-list community-list-name command to enter the community set paragraph editing interface view.
    2. Press i to enter the text editing mode.

      Sets or route-filters can be configured only in the text editing mode. If you exit from the text editing mode, you can perform shortcut key operations only.

    3. Configure a start clause (xpl community-list community-list-name) for a community set.
    4. Configure elements in the format of aa:nn (100:1 for example), a community number, or a known community attribute (internet, no-export-subconfed, no-advertise, or no-export) for the community set and separate every two neighboring elements with a comma (,). You can also configure elements in the regular regular-expression format to indicate that the community attribute of a route matches a specified regular expression, and regular-expression specifies a regular expression. An asterisk (*) in an element can be used to match any digit. For example, 100:* indicates that the element matches all community values with the AS number 100.

      Regular expression processing is computing-intensive. When a large number of regular expressions are configured in an XPL policy to match a BGP route attribute and the length of the route attribute is long, the processing performance of the XPL policy deteriorates. To improve the processing performance of the routing policy, decrease the number of regular expressions or use a non-regular expression matching command.

      It is recommended that a maximum of 100 regular expressions be configured for each policy.

    5. Configure an end clause (end-list) for the community set.
    6. Press Esc to exit from the text editing mode.
    7. Press :wq and Enter to save the configurations and exit from the global variable set paragraph editing interface view.

      A message is displayed for you to confirm whether to commit the configurations when you attempt to exit from the global variable set paragraph editing interface view. To commit the configurations, press Y.

      To exit from the global variable set paragraph editing interface view without saving the configurations, press :q! and Enter.

  • Configure a community set using the line editing mode.
    1. Run the system-view command to enter the system view.
    2. Run the xpl community-list community-list-name command to enter the community set view.
    3. Configure elements in the format of aa:nn (100:1 for example), a community number, or a known community attribute (internet, no-export-subconfed, no-advertise, or no-export) for the community set and separate every two neighboring elements with a comma (,). You can also configure elements in the regular regular-expression format to indicate that the community attribute of a route matches a specified regular expression, and regular-expression specifies a regular expression. An asterisk (*) in an element can be used to match any digit. For example, 100:* indicates that the element matches all community values with the AS number 100.

      Regular expression processing is computing-intensive. When a large number of regular expressions are configured in an XPL policy to match a BGP route attribute and the length of the route attribute is long, the processing performance of the XPL policy deteriorates. To improve the processing performance of the routing policy, decrease the number of regular expressions or use a non-regular expression matching command.

      It is recommended that a maximum of 100 regular expressions be configured for each policy.

    4. Run the end-list command to conclude the configuration of the community set, exit the community set view, and return to the system view.
    5. Run the commit command to commit the configuration.

Example

If only paragraph editing is used as an example, the corresponding line editing is similar. To use the line editing mode, perform the operations described in paragraph editing.

For detailed set and route-filter configuration steps, see Configuration Procedures of Sets and Route-Filters Using the Paragraph Editing Mode. For details about XPL clauses, see XPL Paragraph Editing Clauses.

Objective

Configure a community set to match the routes carrying community set 100:1, 200:1, 300:1, or no-export.

Configuration Example 1

<HUAWEI> edit xpl community-list aaa

xpl community-list aaa
100:1,
200:1,
300:1,
no-export
end-list

The community set aaa includes four elements and matches the routes carrying community set 100:1, 200:1, 300:1, or no-export.

Objective

Configure a community set to match the routes carrying community set 100:*, 200:*, or 300:1.

Configuration Example 2

<HUAWEI> edit xpl community-list bbb

xpl community-list bbb
regular 100:*,
regular 200:*,
300:1
end-list

The community set bbb includes three elements and matches the routes carrying community set 100:*, 200:*, or 300:1.

Objective

Configure a route-filter to add communities 100:1, 200:1, 300:1, and no-export to the routes with the Local_Pref value less than or equal to 100.

Reference Example 1

<HUAWEI> edit xpl route-filter r1

xpl route-filter r1
if local-preference le 100 then
apply community aaa additive
endif
end-filter

The route-filter r1 references community set aaa and adds communities 100:1, 200:1, 300:1, and no-export to the routes with the Local_Pref value less than or equal to 100.

Objective

Configure a route-filter to set the next hop addresses of the routes carrying all the communities listed in community set bbb or carrying only some of the listed communities to 1.1.1.1.

Reference Example 2

<HUAWEI> edit xpl route-filter r2

xpl route-filter r2
if community matches-within bbb then
apply ip next-hop 1.1.1.1
endif
end-filter

The route-filter r2 references community set bbb and sets the next hop addresses of the routes carrying all the communities listed in community set bbb or carrying only some of the listed communities to 1.1.1.1.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >