28.06.2014 Views

Discussion

Discussion

Discussion

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

13.5 Adjusting Local Preference Values<br />

Problem<br />

You want to change the value of the BGP local preference attribute to control which<br />

routes the router uses.<br />

Solution<br />

There are two ways to change the local preference value. The first method changes<br />

the value for all routes distributed into IBGP from the router:<br />

[edit protocols bgp]<br />

aviva@RouterF# set group internal-within-AS65500 local-preference 140<br />

The second method allows you to change the preference of specific routes:<br />

[edit policy-options policy-statement set-local-pref]<br />

aviva@RouterF# set from route-filter 192.168.14.1/32 exact<br />

aviva@RouterF# set then local-preference 140<br />

aviva@RouterF# set then accept<br />

[edit protocols bgp group session-to-AS65505]<br />

aviva@RouterF# set import set-local-pref<br />

<strong>Discussion</strong><br />

When IBGP routers exchange prefix information, one of the attributes associated<br />

with each prefix is its local preference (LOCAL_PREF) value. This attribute is not<br />

advertised to EBGP peers. IBGP routers use the local preference value as a metric to<br />

decide which routes should exit the AS, choosing the route with the highest local<br />

preference value. The default local preference value is 100. BGP includes the local<br />

preference value only when advertising prefixes to IBGP peers. It is not advertised to<br />

EBGP peers.<br />

When the router is determining the active route to a destination (see the Introduction<br />

to Chapter 8), one of the first things it considers is the BGP local preference, so<br />

changing the local preference is a useful way to manipulate route selection. By selecting<br />

from multiple routes to a destination, the local preference is the first BGP path<br />

attribute checked, even before the AS path length, the origin, and the MED.<br />

Don’t confuse the BGP local preference with the JUNOS software routing-protocol<br />

preference (see Table 8-2). The JUNOS routing preference is local to each router,<br />

and the software uses it to choose the active route when there are a number of paths<br />

to the same prefix. The BGP local preference is used only by BGP, and only by IBGP<br />

routers within an AS. Also, the choice is between two different types of preference<br />

values that are the reverse of each other. For the JUNOS routing-protocol preference,<br />

the route with the lowest value is chosen, but with the BGP local preference,<br />

the route with the highest value is chosen.<br />

440 | Chapter 13: BGP<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!