Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Example: Configuring 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 CommunitiesBGP 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

Procedure

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 Junos OS CLI User Guide.

To configure Device R1:

  1. Configure the interfaces.

  2. Configure BGP.

    Apply the import policy to the BGP peering session with Device R2.

  3. Configure the routing policy that deletes communities.

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

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 Junos OS CLI User Guide.

To configure Device R2:

  1. Configure the interfaces.

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

  3. Configure BGP.

  4. Configure multiple communities, or configure a single community with multiple members.

  5. Configure the static routes.

  6. Configure a routing policy that advertises static routes into BGP and adds the BGP community to the routes.

  7. Apply the export policy.

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

  1. On Device R1, run the show route protocols bgp extensive command.

  2. On Device R1, deactivate the community remove configuration in the import policy.

  3. On Device R1, run the show route protocols bgp extensive command to view the advertised communities.

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.