BGP Configuration Guide for Cisco 8000 Series Routers, Cisco IOS XR Releases

PDF

BGP large communities

Want to summarize with AI?

Log in

Overview

Describes BGP large communities, outlining restrictions and guidelines, and provides instructions for configuring named community sets, integrating large communities with route policies, setting attributes, applying and deleting filters, and verifying configurations using show commands.

BGP large community is a BGP routing attribute that

  • enables grouping of network destinations for routing policies

  • encodes both 4-byte autonomous system numbers (ASNs) and operator-assigned local values, and

  • supports complex route-matching and policy operations using community values.

BGP communities allow network operators to tag routes with information that can influence route acceptance, rejection, preference, or redistribution. Traditional BGP community attributes use 4 bytes, making them insufficient for encoding both 4-byte ASNs (introduced in RFC 6793) and local values. BGP extended communities can encode 4-byte ASNs in the global administrator field, but limitations in the local administrator field still exist.

Importance of BGP large communities

To address these limitations, BGP large communities were introduced. Each large community consists of three 4-byte, unsigned integers separated by colons (for example, 1:2:3). The first field typically encodes the ASN, while the other two fields are set by the operator.

Policy matching with BGP large communities

BGP large communities can be matched or set in route-policy languages (RPL) using flexible syntax and are compatible with various expressions for advanced policy matching.

Expressions used in BGP large community policies

You can use these expressions in route-policy statements to match or set BGP large community values (fields are separated by colons):

  • [x..y] — Specifies a range between x and y, inclusive.

  • * — Stands for any number.

  • peeras — Substitutes the ASN of the BGP neighbor (inbound or outbound as appropriate).

  • not-peeras — Matches any number except the ASN of the neighbor.

  • private-as — Matches a private ASN in the ranges [64512..65534] and [4200000000..4294967294].

Regular expressions can also be used for matches or deletes:

  • ios-regex example: '^5:.*:7$' is equivalent to the expression 5:*:7.


Restrictions and guidelines for BGP large communities

These restrictions and guidelines apply to BGP large communities.

  • All functionality available in the BGP community attribute is available for the BGP large-community attribute.

  • The send-community-ebgp command is required for the BGP speaker to send large communities to eBGP neighbors.

  • There are no well-known large communities defined.

  • The peeras expression cannot be used in a large-community-set.

  • The peeras expression can only be used in large-community match or delete statements that appear in route policies at neighbor-in or neighbor-out attach points.

  • The not-peeras expression cannot be used in a large-community-set or in policy set statements.


Configure a named large-community set

Create a named set of BGP large communities for use in route-policy matching and set statements.

Before you begin

Ensure you are in router configuration mode on a Cisco IOS XR device.

Procedure

Create a large-community set by specifying its name. Add large community values, each in the format A:B:C or with expressions as needed.

Example:

Router(config)# large-community-set catbert
Router(config-largecomm)#  1: 2: 3,
Router(config-largecomm)#  peeras:2:3
Router(config-largecomm)# end-set 

Match BGP large communities using route policies

Configure policies to match routes based on presence or pattern of large communities.

You can match if any, all, or a subset of a route’s large communities correspond to specific criteria.

Procedure

1.

Enter route-policy configuration mode, and use the if large-community matches-any command to match any element of a large community set.

Example:

Router(config)# route-policy elbonia
Router(config-rpl)# if large-community matches-any (1:2:3, 4:5:*) then
Router(config-rpl)# set local-preference 94
Router(config-rpl)# endif
Router(config-rpl)# end-policy
2.

Use the if large-community matches-every command to match every specification.

Example:

Router(config)# route-policy bob
Router(config-rpl)# if large-community matches-every (*:*:3, 4:5:*) then
Router(config-rpl)# set local-preference 94
Router(config-rpl)# endif
Router(config-rpl)# end-policy
3.

Use the if large-community matches-within command to match within a large community set. This command is similar to the large-community matches-any command but every large community in the route must match at least one match specification. If the route has no large communities, the condition matches.

Example:

Router(config)# route-policy bob
Router(config-rpl)# if large-community matches-within (*:*:3, 4:5:*) then
Router(config-rpl)# set local-preference 103
Router(config-rpl)# endif
Router(config-rpl)# end-policy

Set BGP large community attributes in a route policy

Assign BGP large community attributes to routes within a policy for use in route filtering and redistribution.

Before you begin

Ensure you have an existing large-community set or inline set, and are in route-policy configuration mode.

Procedure

1.

Use the set large-community command, specifying a set name or inline values.

Example:

Router(config)# route-policy mordac 
Router(config-rpl)# set large-community (1:2:3, peeras:2:3)
Router(config-rpl)# end-set
2.

(Optional) Include the additive keyword to retain existing large-community values.

Example:

router(config-rpl)# set large-community catbert additive 

The additive keyword keeps the existing large communities on a route and adds any new large communities you specify. It does not create duplicate entries.


Filter routes without large communities

Configure a route-policy that matches routes missing the large-community attribute.

Procedure

Enter route-policy configuration mode, and use the if large-community is-empty command to filter routes without large communities.

Example:

Router(config)# route-policy lrg_comm_rp4
Router(config-rpl)# if large-community is-empty then
Router(config-rpl)# set local-preference 104
Router(config-rpl)# endif
Router(config-rpl)# end-policy

Apply attribute filtering for BGP large communities

Filter BGP update messages based on large-community attributes using an attribute-filter group.

Before you begin

Ensure you are in BGP router configuration mode.

Procedure

Create an attribute-filter group specifying the LARGE-COMMUNITY attribute and desired action (for example, discard).

Example:


Router(config)# router bgp 100
Router(config-bgp)# attribute-filter group dogbert
Router(config-bgp-attrfg)# attribute LARGE-COMMUNITY discard
Router(config-bgp-attrfg)# neighbor 10.0.1.101
Router(config-bgp-nbr)# remote-as 6461
Router(config-bgp-nbr)# update in filtering
Router(config-nbr-upd-filter)# attribute-filter group dogbert

Updates containing specified large-community attributes from the neighbor are discarded as configured.


Delete BGP large communities from route policies

Remove specific BGP large-communities from routes using route-policy configuration.

Before you begin

Ensure you are in route-policy configuration mode.

Procedure

Use the delete large-community command with specific matching criteria, such as regular expressions, 'all', or inline specifications to delete large communities.

Example:


Router(config)# route-policy lrg_comm_rp2
Router(config-rpl)# delete large-community in (ios-regex '^100000:’)  
Router(config-rpl)# delete large-community all
Router(config-rpl)# delete large-community not in (peeras:*:*, 41289:*:*)
The specified large communities are removed from the affected routes according to the deletion criteria used.

Show commands for BGP large communities

  • To display routes containing specified large communities, use the show bgp large-community community-list exact-match command.

    • If exact-match keyword is specified, only routes with the exact set of listed communities are shown. Otherwise, routes with additional large communities are included.

    Example:

    Router# show bgp large-community 1:2:3 5:6:7
    Thu Mar 23 14:40:33.597 PDT
    BGP router identifier 10.4.4.4, local AS number 3
    BGP generic scan interval 60 secs
    Non-stop routing is enabled
    BGP table state: Active
    Table ID: 0xe0000000   RD version: 66
    BGP main routing table version 66
    BGP NSR Initial initsync version 3 (Reached)
    BGP NSR/ISSU Sync-Group versions 66/0
    BGP scan interval 60 secs
    
    Status codes: s suppressed, d damped, h history, * valid, > best
                  i - internal, r RIB-failure, S stale, N Nexthop-discard
    Origin codes: i - IGP, e - EGP, ? - incomplete
       Network            Next Hop            Metric LocPrf Weight Path
    * 10.0.0.3/32         10.10.10.3               0     94      0 ?
    * 10.0.0.5/32         10.11.11.5               0             0 5 ?
    
  • To display the large community for a specific network, use the show bgp ip-address / prefix-length command. The output displays route entries and the large-community attributes attached.

    Example:

    Router# show bgp 10.3.3.3/32
    Thu Mar 23 14:36:15.301 PDT
    BGP routing table entry for 10.3.3.3/32
    Versions:
      Process           bRIB/RIB  SendTblVer
      Speaker                 42          42
    Last Modified: Mar 22 20:04:46.000 for 18:31:30
    Paths: (1 available, best #1)
      Advertised to peers (in unique update groups):
        10.11.11.5
      Path #1: Received by speaker 0
      Advertised to peers (in unique update groups):
        10.11.11.5
      Local
        10.10.10.3 from 10.10.10.3 (10.3.3.3)
          Origin incomplete, metric 0, localpref 94, valid, internal, best, group-best
          Received Path ID 0, Local Path ID 0, version 42
          Community: 258:259 260:261 262:263 264:265
          Large Community: 1:2:3 5:6:7 4123456789:4123456780:4123456788