Changing a Routes Routing Information

Changing a Route s Routing Information

Problem

You want to enforce your company's BGP peering relationships and control the traffic you receive from BGP peers by modifying the BGP LOCAL_PREF attribute and associating a community with certain BGP routes.

Solution

Another function of routing policy is to modify the routing information associated with BGP routes. First, match the routes to be affected:

	[edit policy-options policy-statement from-my-customers  term 1]
	aviva@router1# set from neighbor 10.0.31.2/32 

Use the then clause to modify the route's routing information:

	[edit policy-options policy-statement from-my-customers  term 1 ]
	aviva@router1# set then local-preference 300 
	aviva@router1# set then community set 65500:12345 
	aviva@router1# set then accept 

Finally, apply the policy to a BGP group:

	[edit protocols bgp]
	aviva@router1# set group external-group import from-my-customers

 

Discussion

For BGP routes, routing policy allows you to modify the BGP routing information associated with each route, including the BGP local preference, community, and origin attributes, and the AS paths in each route. You typically do this to manage customer traffic and peering arrangements with other ISPs. Table 9-4 lists the actions you can include in a policy to change a route's routing information. Most of these actions are specific to BGP.

Table 9-4. Actions that change routing information in matching routes

Action term

Description

as-path-prepend path

Add AS numbers to the beginning of the BGP AS path.

as-path-expand last-as count number

Add the last AS number to the BGP AS path the specified number of times before adding the local AS number.

community + names

community add names

Add BGP community names.

communitynames

community delete names

Delete BGP community names.

community = names

community setnames

Set the specific BGP community name.

damping name

Configure BGP route flap damping.

external type metric

External metric for exported OSPF routes.

local-preference value

Set the value of the BGP LOCAL_PREF attribute.

local-preference add number

local-preference subtractnumber

Increment or decrement the BGP LOCAL_PREF value.

metric value

meTRic2 value

Set the metric value. For BGP, metric is MED and metric2 is the IGP

metric igp value

metric minimum-igp value

Change the MED by the specified value for EBGP routes being exported.

origin value

Set the BGP ORIGIN attribute.

preference value

Set the preference value.

tag value

tag2 value

Set the tag and tag2 values in OSPF external LSAs.

tag add number

tag subtract number

tag2 add number

tag2 subtract number

Increment or decrement the OSPF tag or tag2 value.

This recipe changes two attributes in a BGP route, the local preference and community. The first command in the then clause sets the LOCAL_PREF attribute to 300. The second command changes the community string in the route to 65500:12345. The policy affects all routes received from the BGP neighbor at 10.0.31.2/32 (configured with the set from neighbor command). The last command in the recipe applies the policy to the BGP group external.


Router Configuration and File Management

Basic Router Security and Access Control

IPSec

SNMP

Logging

NTP

Router Interfaces

IP Routing

Routing Policy and Firewall Filters

RIP

IS-IS

OSPF

BGP

MPLS

VPNs

IP Multicast

show all menu





JUNOS Cookbook
Junos Cookbook (Cookbooks (OReilly))
ISBN: 0596100140
EAN: 2147483647
Year: 2007
Pages: 290
Authors: Aviva Garrett
Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net