Related Documentation
- ACX Series
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- Understanding External BGP Peering Sessions
- BGP Configuration Overview
- J Series
- Understanding External BGP Peering Sessions
- BGP Configuration Overview
- M Series
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- Understanding External BGP Peering Sessions
- BGP Configuration Overview
- MX Series
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- Understanding External BGP Peering Sessions
- BGP Configuration Overview
- PTX Series
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- QFX Series
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- SRX Series
- Understanding External BGP Peering Sessions
- BGP Configuration Overview
- T Series
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
Example: Defining a Routing Policy That Removes BGP Communities
This example shows how to create a policy that accepts BGP routes, but removes BGP communities from the routes.
Requirements
No special configuration beyond device initialization is required before you configure this example.
Overview
This example shows two routing devices with an external BGP (EBGP) connection between them. Device R2 uses the BGP session to send two static routes to Device R1. On Device R1, an import policy specifies that all BGP communities must be removed from the routes.
By default, when communities are configured on EBGP peers, they are sent and accepted. To suppress the acceptance of communities received from a neighbor, you can remove all communities or a specified set of communities. When the result of a policy is an empty set of communities, the community attribute is not included. To remove all communities, first define a wildcard set of communities (here, the community is named wild):
Then, in the routing policy statement, specify the community delete action:
To suppress a particular community from any autonomous system (AS), define the community as community wild members "*:community-value".
Topology
Figure 1 shows the sample network.
Figure 1: BGP Policy That Removes Communities

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
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 R1:
- Configure the interfaces.[edit interfaces]user@R1# set fe-1/1/0 unit 0 description to-R2user@R1# set fe-1/1/0 unit 0 family inet address 10.0.0.1/30
user@R1# set lo0 unit 0 family inet address 192.168.0.1/32 - Configure BGP.
Apply the import policy to the BGP peering session with Device R2.
[edit protocols bgp group external-peers]user@R1# set type externaluser@R1# set peer-as 2user@R1# set neighbor 10.0.0.2 import remove-communities - Configure the routing policy that deletes communities.[edit policy-options policy-statement remove-communities]user@R1# set term 1 from protocol bgpuser@R1# set term 1 then community delete wilduser@R1# set term 1 then acceptuser@R1# set term 2 then reject
- Configure the autonomous system (AS) number and the router
ID.[edit routing-options ]user@R1# set router-id 192.168.0.1user@R1# set autonomous-system 1
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 R2:
- Configure the interfaces.[edit interfaces]user@R2# set fe-1/1/0 unit 0 description to-R1user@R2# set fe-1/1/0 unit 0 family inet address 10.0.0.2/30
user@R2# set lo0 unit 0 family inet address 192.168.0.2/32 - Configure the router ID and the autonomous system (AS)
number.[edit routing-options]user@R2# set router-id 192.168.0.3user@R2# set autonomous-system 2
- Configure BGP.[edit protocols bgp group external-peers]user@R2# set type externaluser@R2# set peer-as 1user@R2# set neighbor 10.0.0.1
- Configure multiple communities, or configure a single
community with multiple members.[edit policy-options community 1]user@R2# set members 2:1user@R2# set members 2:2user@R2# set members 2:3user@R2# set members 2:4user@R2# set members 2:5user@R2# set members 2:6user@R2# set members 2:7user@R2# set members 2:8user@R2# set members 2:9user@R2# set members 2:10
- Configure the static routes.[edit routing-options static]user@R2# set route 10.2.0.0/16 rejectuser@R2# set route 10.2.0.0/16 installuser@R2# set route 10.3.0.0/16 rejectuser@R2# set route 10.3.0.0/16 install
- Configure a routing policy that advertises static routes
into BGP and adds the BGP community to the routes.[edit policy-options policy-statement statics]user@R2# set from protocol staticuser@R2# set then community add 1user@R2# set then accept
- Apply the export policy.[edit protocols bgp group external-peers]user@R2# set export statics
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.
Device R1
Device R2
If you are done configuring the devices, enter commit from configuration mode.
Verification
Confirm that the configuration is working properly.
Verifying the BGP Routes
Purpose
Make sure that the routing table on Device R1 does not contain BGP communities.
Action
- On Device R1, run the show route protocols bgp extensive command.
user@R1> show route protocols bgp extensiveinet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) 10.2.0.0/16 (1 entry, 1 announced) TSI: KRT in-kernel 10.2.0.0/16 -> {10.0.0.2} *BGP Preference: 170/-101 Next hop type: Router, Next hop index: 671 Address: 0x9458270 Next-hop reference count: 4 Source: 10.0.0.2 Next hop: 10.0.0.2 via lt-1/1/0.5, selected Session Id: 0x100001 State: <Active Ext> Local AS: 1 Peer AS: 2 Age: 20:39:01 Validation State: unverified Task: BGP_2.10.0.0.2+179 Announcement bits (1): 0-KRT AS path: 2 I Accepted Localpref: 100 Router ID: 192.168.0.3 10.3.0.0/16 (1 entry, 1 announced) TSI: KRT in-kernel 10.3.0.0/16 -> {10.0.0.2} *BGP Preference: 170/-101 Next hop type: Router, Next hop index: 671 Address: 0x9458270 Next-hop reference count: 4 Source: 10.0.0.2 Next hop: 10.0.0.2 via lt-1/1/0.5, selected Session Id: 0x100001 State: <Active Ext> Local AS: 1 Peer AS: 2 Age: 20:39:01 Validation State: unverified Task: BGP_2.10.0.0.2+179 Announcement bits (1): 0-KRT AS path: 2 I Accepted Localpref: 100 Router ID: 192.168.0.3 - On Device R1, deactivate the community remove configuration in the import policy.[edit policy-options policy-statement remove-communities term 1]user@R1# deactivate then community delete wilduser@R1# commit
- On Device R1, run the show route protocols bgp extensive command to view the advertised communities.
user@R1> show route protocols bgp extensiveinet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) 10.2.0.0/16 (1 entry, 1 announced) TSI: KRT in-kernel 10.2.0.0/16 -> {10.0.0.2} *BGP Preference: 170/-101 Next hop type: Router, Next hop index: 671 Address: 0x9458270 Next-hop reference count: 4 Source: 10.0.0.2 Next hop: 10.0.0.2 via lt-1/1/0.5, selected Session Id: 0x100001 State: <Active Ext> Local AS: 1 Peer AS: 2 Age: 20:40:53 Validation State: unverified Task: BGP_2.10.0.0.2+179 Announcement bits (1): 0-KRT AS path: 2 I Communities: 2:1 2:2 2:3 2:4 2:5 2:6 2:7 2:8 2:9 2:10 Accepted Localpref: 100 Router ID: 192.168.0.3 10.3.0.0/16 (1 entry, 1 announced) TSI: KRT in-kernel 10.3.0.0/16 -> {10.0.0.2} *BGP Preference: 170/-101 Next hop type: Router, Next hop index: 671 Address: 0x9458270 Next-hop reference count: 4 Source: 10.0.0.2 Next hop: 10.0.0.2 via lt-1/1/0.5, selected Session Id: 0x100001 State: <Active Ext> Local AS: 1 Peer AS: 2 Age: 20:40:53 Validation State: unverified Task: BGP_2.10.0.0.2+179 Announcement bits (1): 0-KRT AS path: 2 I Communities: 2:1 2:2 2:3 2:4 2:5 2:6 2:7 2:8 2:9 2:10 Accepted Localpref: 100 Router ID: 192.168.0.3
Meaning
The output shows that in Device R1’s routing table, the communities are suppressed in the BGP routes sent from Device R2. When the community remove setting in Device R1’s import policy is deactivated, the communities are no longer suppressed.
Related Documentation
- ACX Series
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- Understanding External BGP Peering Sessions
- BGP Configuration Overview
- J Series
- Understanding External BGP Peering Sessions
- BGP Configuration Overview
- M Series
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- Understanding External BGP Peering Sessions
- BGP Configuration Overview
- MX Series
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- Understanding External BGP Peering Sessions
- BGP Configuration Overview
- PTX Series
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- QFX Series
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS
- SRX Series
- Understanding External BGP Peering Sessions
- BGP Configuration Overview
- T Series
- Example: Redistributing BGP Routes with a Specific Community Tag into IS-IS