Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?


Example: Configuring Extended Communities in a Routing Policy

An extended community is similar in most ways to a regular community. Some networking implementations, such as virtual private networks (VPNs), use extended communities because the 4-octet regular community value does not provide enough expansion and flexibility. An extended community is an eight-octet value divided into two main sections.


No special configuration beyond device initialization is required before configuring this example.


In this example, Device R1 and Device R2 are OSPF neighbors in autonomous system (AS) 64510. Device R3 has an external BGP (EBGP) connection to Device R1. Device R2 has customer networks in the 172.16/16 address space, simulated with addresses on its loopback interface (lo0). Device R1 has static routes to several 172.16.x/24 networks, and attaches regular community values to these routes. Device R1 then uses an export policy to advertise the routes to Device R3. Device R3 receives these routes and uses an import policy to add extended community values to the routes.


Figure 1 shows the sample network.

Figure 1: Topology for Extended BGP CommunitiesTopology for Extended BGP Communities

CLI Quick Configuration shows the configuration for all of the devices in Figure 1.

The section #configuration587__policy-extended-community-st describes the steps on Device R3.


CLI Quick Configuration

To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.

Device R1

Device R2

Device R3


Step-by-Step Procedure

The following example requires that you navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Use the CLI Editor in Configuration Mode in the Junos OS CLI User Guide.

To configure Device R3:

  1. Configure the interfaces.

  2. Configure the EBGP connection to Device R1.

  3. Configure the policy that adds extended community values to the routes received from Device R1.

    An extended community uses a notation of type:administrator:assigned-number.

    The specific community values can be anything that accomplishes your administrative goals, within certain parameters, as explained in community (Policy Options).

  4. Configure the autonomous system (AS) number and router ID.


From configuration mode, confirm your configuration by entering the show interfaces, show protocols, show policy-options, and show routing-options commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.

If you are done configuring the device, enter commit from configuration mode.


Confirm that the configuration is working properly.

Verifying the Routes on Device R1


On Device R1, check the 172.16. routes in the routing table.



The output shows that the regular community values are attached to the routes.


The communities are attached to static routes, thus demonstrating that communities can be attached to non-BGP routes.

Verifying the Routes on Device R3


On Device R3, check the 172.16. routes in the routing table.



The output shows that the regular community values remain attached to the routes, and the extended community values are added.