Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?


community (Policy Options)


Hierarchy Level


Define a community, extended community or large community for use in a routing policy match condition.


name—Name that identifies the regular expression. The name can contain letters, numbers, and hyphens (-) and can be up to 255 characters. To include spaces in the name, enclose it in quotation marks (“ ”).

invert-match—Invert the results of the community expression matching. The community match condition defines a regular expression and if it matches the community attribute of the received prefix, Junos OS returns a TRUE result. If not, Junos OS returns a FALSE result. The invert-match statement makes Junos OS behave to the contrary. If there is a match, Junos OS returns a FALSE result. If there is no match, Junos OS returns a TRUE result.

members community-ids—One or more community members. If you specify more than one member, you must enclose all members in brackets.

The format for community-ids is:

Starting in Junos OS Release 15.1, you can apply a wildcard member segmented-nh:.*:0 to apply the BGP policy to all the S-PMSI A-D routes carrying extended community information.

as-number is the AS number and can be a value in the range from 0 through 65,535. community-value is the community identifier and can be a number in the range from 0 through 65,535.

You also can specify community-ids for communities as one of the following well-known community names, which are defined in RFC 1997, BGP Communities Attribute:

  • no-export—Routes containing this community name are not advertised outside a BGP confederation boundary.

  • no-advertise—Routes containing this community name are not advertised to other BGP peers.

  • no-export-subconfed—Routes containing this community name are not advertised to external BGP peers, including peers in other members' ASs inside a BGP confederation.

You can explicitly exclude BGP community information with a static route using the none option. Include none when configuring an individual route in the route portion of the static statement to override a community option specified in the defaults portion of the statement.

The format for extended community-ids is the following:

type is the type of extended community and can be either a bandwidth, target, origin, domain-id, src-as, rt-import, or a 16-bit number that identifies a specific BGP extended community. The target community identifies the destination to which the route is going. The origin community identifies where the route originated. The domain-id community identifies the OSPF domain from which the route originated. The src-as community identifies the autonomous system from which the route originated. The rt-import community identifies the route to install in the routing table.


For src-as, you can specify only an AS number and not an IP address. For rt-import, you can specify only an IP address and not an AS number.

administrator is the administrator. It is either an AS number or an IPv4 address prefix, depending on the type of extended community.

assigned-number identifies the local provider.

The format for linking a bandwidth with an AS number is:


as-number specifies the AS number and bandwidth specifies the bandwidth in bytes per second.


In Junos OS Release 9.1 and later, you can specify 4-byte AS numbers as defined in RFC 4893, BGP Support for Four-octet AS Number Space, as well as the 2-byte AS numbers that are supported in earlier releases of the Junos OS. In plain-number format, you can configure a value in the range from 1 through 4,294,967,295. To configure a target or origin extended community that includes a 4-byte AS number in the plain-number format, append the letter “L” to the end of number. For example, a target community with the 4-byte AS number 334,324 and an assigned number of 132 is represented as target:334324L:132.

In Junos OS Release 9.2 and later, you can also use AS-dot notation when defining a 4-byte AS number for the target and origin extended communities. Specify two integers joined by a period: 16-bit high-order value in decimal.16-bit low-order value in decimal. For example, the 4-byte AS number represented in plain-number format as 65546 is represented in AS-dot notation as 1.10.

As defined in RFC 8092, BGP large community uses 12-byte encoding and the format for BGP large community-ids is:

large indicates BGP large community.

global-administrator is the administrator. It is a 4-byte AS number.

assigned-number is a 4-byte value used to identify the local provider. BGP large community uses two 4-byte assigned number to identify the local provider.

Required Privilege Level

routing—To view this statement in the configuration.

routing-control—To add this statement to the configuration.

Release Information

Statement introduced before Junos OS Release 7.4.

Support for configuration in the dynamic database introduced in Junos OS Release 9.5.

Support for configuration in the dynamic database introduced in Junos OS Release 9.5 for EX Series switches.

Support for BGP large community introduced in Junos OS Release 17.3 for MX Series, PTX Series, and QFX Series.