O'Reilly logo

JUNOS Cookbook by Aviva Garrett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

13.13. Adding a BGP Community to Routes

Problem

You want to add a BGP community to routes so you can apply common routing policy to the routes.

Solution

BGP communities are a way to group routes so you can apply the same policy to them. To use them in a routing policy, first define the community members and an AS path string:

	[edit policy-options]
	aviva@RouterF#  
set community customer members 65500:1234
	aviva@RouterF# set as-path AS65505-path "65505.*"

Then include the community in the routing policy:

	[edit policy-options policy-statement community-add]
	aviva@RouterF# set term match-route from protocol bgp
	aviva@RouterF# set term match-route from as-path AS65505-path
	aviva@RouterF# set then community add customer
	aviva@RouterF# set then accept

To have the policy take effect, apply it with an import statement to an EBGP group:

	[edit protocols bgp]
	aviva@RouterF# set group session-to-AS65505 import community-add

Discussion

BGP communities are a way to group routes so that the same routing policy can be applied to them. This recipe shows a simple application of BGP communities that adds the community 65500:1234 to all received BGP routes that have the AS number 65505 in their AS path.

Creating the routing policy is a two-step process. First, define the members in your community with the set community statement. Each member has a community identifier, which looks like AS-number:community-value. The AS-number portion of the identifier is the local AS number. The community-value is a number ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required