< Home

Configuring the BGP Community Attribute

Context

The Community attribute is a private BGP route attribute. It is transmitted between BGP peers and is not restricted within an AS. The Community attribute allows a group of BGP devices in multiple ASs to share the same routing policies, which simplifies routing policy applications and facilitates routing policy management and maintenance. A BGP device can add or change the community attributes of routes to be advertised.

Procedure

  1. Run system-view

    The system view is displayed.

  2. Run route-policy route-policy-name { deny | permit } node node

    A node is configured for a route-policy, and the view of the route-policy is displayed.

  3. (Optional) Configure matching rules for the route-policy to change only the community attributes of the routes that meet the matching rules.

    By default, all routes meet matching rules. For details, see (Optional) Configuring an if-match Clause.

  4. Run either of the following commands to configure the Community attribute.

    • Run apply community { community-number | aa:nn | internet | no-advertise | no-export | no-export-subconfed } &<1-32> [ additive ]

      Common community attributes are configured for BGP routes.

      You can run this command to configure a maximum of 32 community attributes at a time.
    • Run apply extcommunity { rt { as-number:nn | ipv4-address:nn } } &<1-16> [ additive ]

      An extended community attribute (route-target) is configured.

      Extended community attributes are extensions to community attributes in services. Currently, only the route-target attribute is supported in VPN.

  5. Run quit

    Return to the system view.

  6. Run bgp { as-number-plain | as-number-dot }

    The BGP view is displayed.

  7. Enter the corresponding address family view based on network type to configure BGP devices on networks.

    • Run ipv4-family { unicast | multicast }

      The IPv4 address family view is displayed.

    • Run ipv6-family [ unicast ]

      The IPv6 address family view is displayed.

  8. Add the Community attribute to routes.
    • Run peer { ipv4-address | group-name | ipv6-address } route-policy route-policy-name export

      The Community attribute is added to the routes advertised to BGP peers or peer groups.

    • Run peer { ipv4-address | group-name | ipv6-address } route-policy route-policy-name import

      The Community attribute is added to the routes received from BGP peers or peer groups.

    • Run import-route protocol [ process-id ] route-policy route-policy-name

      The Community attribute is added to the routes imported by BGP in import mode.

    • Run network { ipv4-address [ mask | mask-length ] | ipv6-address prefix-length } route-policy route-policy-name

      The Community attribute is added to the routes imported by BGP in network mode.

    Step 9 is required only when the Community attribute needs to be added to the routes advertised to BGP peers or peer groups.

  9. (Optional) Allow BGP to advertise community attributes when BGP adds community attributes to the routes advertised to BGP peers or peer groups.

    • Run peer { ipv4-address | group-name | ipv6-address } advertise-community

      BGP is allowed to advertise community attributes to BGP peers or peer groups.

      By default, BGP does not advertise community attributes to any peer or peer group.

    • To advertise an extended community attribute to a specified peer or peer group, perform the following steps:
      1. Run the peer { ipv4-address | group-name | ipv6-address } advertise-ext-community command to advertise an extended community attribute to a specified peer or peer group.

      2. Run the ext-community-change enable command to enable the device to change extended community attributes using a routing policy.

        By default, BGP peers cannot change extended community attributes using a route-policy; specifically, BGP peers advertise only the extended community attributes carried in routes to a specified peer or peer group, and the peer route-policy command cannot be used to modify the extended community attributes.

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