Related Documentation
- ACX Series
- Example: Configuring Communities in a Routing Policy
- Example: Defining a Routing Policy That Removes BGP Communities
- Example: Defining a Routing Policy Based on the Number of BGP Communities
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- M Series
- Example: Configuring Communities in a Routing Policy
- Example: Defining a Routing Policy That Removes BGP Communities
- Example: Defining a Routing Policy Based on the Number of BGP Communities
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- MX Series
- Example: Configuring Communities in a Routing Policy
- Example: Defining a Routing Policy That Removes BGP Communities
- Example: Defining a Routing Policy Based on the Number of BGP Communities
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- PTX Series
- Example: Configuring Communities in a Routing Policy
- Example: Defining a Routing Policy That Removes BGP Communities
- Example: Defining a Routing Policy Based on the Number of BGP Communities
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- QFX Series
- Example: Configuring Communities in a Routing Policy
- Example: Defining a Routing Policy That Removes BGP Communities
- Example: Defining a Routing Policy Based on the Number of BGP Communities
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- SRX Series
- Example: Configuring Communities in a Routing Policy
- Example: Defining a Routing Policy That Removes BGP Communities
- Example: Defining a Routing Policy Based on the Number of BGP Communities
- T Series
- Example: Configuring Communities in a Routing Policy
- Example: Defining a Routing Policy That Removes BGP Communities
- Example: Defining a Routing Policy Based on the Number of BGP Communities
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
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.
Requirements
No special configuration beyond device initialization is required before configuring this example.
Overview
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.
Topology
Figure 1 shows the sample network.
Figure 1: Topology for Extended BGP Communities

CLI Quick Configuration shows the configuration for all of the devices in Figure 1.
The section Step-by-Step Procedure describes the steps on Device R3.
Configuration
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 Using the CLI Editor in Configuration Mode in the CLI User Guide.
To configure Device R3:
- Configure the interfaces.[edit interfaces]user@R3# set fe-1/2/3 unit 0 family inet address 10.0.0.13/30
user@R3# set lo0 unit 0 family inet address 192.168.0.3/32 - Configure the EBGP connection to Device R1.[edit protocols bgp group to-R1]user@R3# set type externaluser@R3# set import set-ext-commsuser@R3# set peer-as 64510user@R3# set neighbor 10.0.0.14
- 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.
[edit policy-options policy-statement set-ext-comms]user@R3# set term route-1 from route-filter 172.16.1.0/24 exactuser@R3# set term route-1 then community add target-asuser@R3# set term route-1 then accept
user@R3# set term route-2 from route-filter 172.16.2.0/24 exactuser@R3# set term route-2 then community add target-ipuser@R3# set term route-2 then accept
user@R3# set term route-3 from route-filter 172.16.3.0/24 exactuser@R3# set term route-3 then community add origin-asuser@R3# set term route-3 then accept
user@R3# set term route-4 from route-filter 172.16.4.0/24 exactuser@R3# set term route-4 then community add origin-ipuser@R3# set term route-4 then accept
[edit policy-options]user@R3# set community origin-as members origin:64511:3user@R3# set community origin-ip members origin:172.16.7.7:4user@R3# set community target-as members target:64511:1user@R3# set community target-ip members target:172.16.7.7:2 - Configure the autonomous system (AS) number and router
ID.[edit routing-options]user@R3# set router-id 192.168.0.3user@R3# set autonomous-system 64511
Results
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.
Verification
Confirm that the configuration is working properly.
Verifying the Routes on Device R1
Purpose
On Device R1, check the 172.16. routes in the routing table.
Action
user@R1> show route protocol static match-prefix
172.16.* detail
inet.0: 15 destinations, 15 routes (15 active, 0 holddown, 0 hidden)
172.16.1.0/24 (1 entry, 1 announced)
*Static Preference: 5
Next hop type: Router, Next hop index: 835
Address: 0x9260250
Next-hop reference count: 19
Next hop: 10.0.0.2 via fe-1/2/0.0, selected
State: <Active Int Ext>
Local AS: 64510
Age: 2:06:08
Task: RT
Announcement bits (2): 2-KRT 3-BGP_RT_Background
AS path: I
Communities: 64510:1
172.16.2.0/24 (1 entry, 1 announced)
*Static Preference: 5
Next hop type: Router, Next hop index: 835
Address: 0x9260250
Next-hop reference count: 19
Next hop: 10.0.0.2 via fe-1/2/0.0, selected
State: <Active Int Ext>
Local AS: 64510
Age: 2:06:08
Task: RT
Announcement bits (2): 2-KRT 3-BGP_RT_Background
AS path: I
Communities: 64510:2
172.16.3.0/24 (1 entry, 1 announced)
*Static Preference: 5
Next hop type: Router, Next hop index: 835
Address: 0x9260250
Next-hop reference count: 19
Next hop: 10.0.0.2 via fe-1/2/0.0, selected
State: <Active Int Ext>
Local AS: 64510
Age: 2:06:08
Task: RT
Announcement bits (2): 2-KRT 3-BGP_RT_Background
AS path: I
Communities: 64510:3
172.16.4.0/24 (1 entry, 1 announced)
*Static Preference: 5
Next hop type: Router, Next hop index: 835
Address: 0x9260250
Next-hop reference count: 19
Next hop: 10.0.0.2 via fe-1/2/0.0, selected
State: <Active Int Ext>
Local AS: 64510
Age: 2:06:08
Task: RT
Announcement bits (2): 2-KRT 3-BGP_RT_Background
AS path: I
Communities: 64510:4Meaning
The output shows that the regular community values are attached to the routes.
![]() | Note: The communities are attached to static routes, thus demonstrating that communities can be attached to non-BGP routes. |
Verifying the Routes on Device R3
Purpose
On Device R3, check the 172.16. routes in the routing table.
Action
user@R3> show route protocol bgp match-prefix
172.16.* detailbetsy@tp5# run show route protocol bgp match-prefix 172.16.* detail logical-system R3
inet.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden)
172.16.1.0/24 (1 entry, 1 announced)
*BGP Preference: 170/-101
Next hop type: Router, Next hop index: 611
Address: 0x9260130
Next-hop reference count: 8
Source: 10.0.0.14
Next hop: 10.0.0.14 via fe-1/2/3.0, selected
State: <Active Ext>
Local AS: 64511 Peer AS: 64510
Age: 1:57:27
Task: BGP_64510.10.0.0.14+54618
Announcement bits (1): 0-KRT
AS path: 64510 I
Communities: 64510:1 target:64511:1
Accepted
Localpref: 100
Router ID: 192.168.0.1
172.16.2.0/24 (1 entry, 1 announced)
*BGP Preference: 170/-101
Next hop type: Router, Next hop index: 611
Address: 0x9260130
Next-hop reference count: 8
Source: 10.0.0.14
Next hop: 10.0.0.14 via fe-1/2/3.0, selected
State: <Active Ext>
Local AS: 64511 Peer AS: 64510
Age: 1:57:27
Task: BGP_64510.10.0.0.14+54618
Announcement bits (1): 0-KRT
AS path: 64510 I
Communities: 64510:2 target:172.16.7.7:2
Accepted
Localpref: 100
Router ID: 192.168.0.1
172.16.3.0/24 (1 entry, 1 announced)
*BGP Preference: 170/-101
Next hop type: Router, Next hop index: 611
Address: 0x9260130
Next-hop reference count: 8
Source: 10.0.0.14
Next hop: 10.0.0.14 via fe-1/2/3.0, selected
State: <Active Ext>
Local AS: 64511 Peer AS: 64510
Age: 1:57:27
Task: BGP_64510.10.0.0.14+54618
Announcement bits (1): 0-KRT
AS path: 64510 I
Communities: 64510:3 origin:64511:3
Accepted
Localpref: 100
Router ID: 192.168.0.1
172.16.4.0/24 (1 entry, 1 announced)
*BGP Preference: 170/-101
Next hop type: Router, Next hop index: 611
Address: 0x9260130
Next-hop reference count: 8
Source: 10.0.0.14
Next hop: 10.0.0.14 via fe-1/2/3.0, selected
State: <Active Ext>
Local AS: 64511 Peer AS: 64510
Age: 1:57:27
Task: BGP_64510.10.0.0.14+54618
Announcement bits (1): 0-KRT
AS path: 64510 I
Communities: 64510:4 origin:172.16.7.7:4
Accepted
Localpref: 100
Router ID: 192.168.0.1Meaning
The output shows that the regular community values remain attached to the routes, and the extended community values are added.
Related Documentation
- ACX Series
- Example: Configuring Communities in a Routing Policy
- Example: Defining a Routing Policy That Removes BGP Communities
- Example: Defining a Routing Policy Based on the Number of BGP Communities
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- M Series
- Example: Configuring Communities in a Routing Policy
- Example: Defining a Routing Policy That Removes BGP Communities
- Example: Defining a Routing Policy Based on the Number of BGP Communities
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- MX Series
- Example: Configuring Communities in a Routing Policy
- Example: Defining a Routing Policy That Removes BGP Communities
- Example: Defining a Routing Policy Based on the Number of BGP Communities
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- PTX Series
- Example: Configuring Communities in a Routing Policy
- Example: Defining a Routing Policy That Removes BGP Communities
- Example: Defining a Routing Policy Based on the Number of BGP Communities
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- QFX Series
- Example: Configuring Communities in a Routing Policy
- Example: Defining a Routing Policy That Removes BGP Communities
- Example: Defining a Routing Policy Based on the Number of BGP Communities
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- SRX Series
- Example: Configuring Communities in a Routing Policy
- Example: Defining a Routing Policy That Removes BGP Communities
- Example: Defining a Routing Policy Based on the Number of BGP Communities
- T Series
- Example: Configuring Communities in a Routing Policy
- Example: Defining a Routing Policy That Removes BGP Communities
- Example: Defining a Routing Policy Based on the Number of BGP Communities
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
