Network Bulls
www.networkbulls.com
Best Institute for CCNA CCNP CCSP CCIP CCIE Training in India
M-44, Old Dlf, Sector-14 Gurgaon, Haryana, India
Call: +91-9654672192
This section examines three different features that can influence the outbound routes
from an Enterprise: Weight, the Local_Pref PA, and AS_Path length. The topics are listed
in the order used by the BGP best path algorithm (Steps 1, 2, and 4). It also introduces the
concept of a Routing Table Manager (RTM) function on a router.
Influencing BGP Weight
A Cisco router can use the BGP Weight, on that single router, to influence that one
router’s choice of outbound route. To do so, when a router receives a BGP Update, that
router can set the Weight either selectively, per route, using a route map, or for all routes
learned from a single neighbor. The router’s best path algorithm then examines the Weight
of competing routes, choosing the route with the bigger Weight.
The Cisco-proprietary Weight settings configured on a single router can influence only
that one router because the Weight cannot be communicated to other neighboring BGP
routers. So, to use the Weight, a router must be configured to examine incoming Updates
to set the Weight. The Weight cannot simply be learned in a received Update because that
Update message does not support a field in which to communicate the Weight setting.
Table 15-4 summarizes some of the key facts about BGP administrative Weight. Following
the table, the text first explains a sample internetwork and its existing configuration, a
configuration that begins with configurations that do not set any values that influence the
choice of best paths. The next section shows how to set the Weight using the neighbor
route-map in command, which allows a router to set different Weights for different routes.
The second example shows how to set the Weight for all routes learned from a neighbor,
using the neighbor weight command.
Key
Topic
Table 15-4 Key Features of Administrative Weight
Feature Description
Is it a PA? No; Cisco proprietary feature
www.CareerCert.info
Chapter 15: BGP Path Control 501
Note: For those of you memorizing using the N WLLA OMNI mnemonic, Weight is the
W in WLLA.
Sample Internetwork Used in the Weight Examples
Figure 15-3 shows a sample Internetwork used to demonstrate setting the Weight. The figure
shows a single Enterprise and a single Enterprise router. The following design requirements
have already been met by the configuration in Router E1 and in the ISP routers:
■ E1 and I1-1 uses loopback IP addresses (11.11.11.11 and 1.1.1.1) for their neighborship.
■ E1 and I3-1 use interface IP addresses for their neighborship.
■ None of the routers have attempted to change any settings that can impact the choice
of best path.
Next, to have some routes to manipulate with the upcoming examples, the ISP routers
each advertise BGP routes for the same five prefixes. Figure 15-4 shows five such prefixes
that both ISPs advertise to E1.
Just to get a little deeper understanding of the best path algorithm before getting into the
Weight configuration, consider the original configuration state of the sample internetwork,
with no attempt to influence E1’s choice of best path. The best path for four of the
five prefixes will be obvious. Prefixes 181.0.0.0/8 and 182.0.0.0/8 have a shorter AS_Path
through ISP1, and 184.0.0.0/8 and 185.0.0.08 have a shorter AS_Path through ISP3. Only
183.0.0.0/8 is in question because its AS_Path length for the competing routes is equal.
Example 15-1 shows the output of the show ip bgp 176.0.0.0/4 longer-prefixes command,
which lists all five of the BGP prefixes listed in Figure 15-4, confirming the results.
(Prefix 176.0.0.0/4 implies a range of values whose first octets are in the range 176 through
191, which includes the routes listed in Example 15-1.)
First, consider the best path algorithm on Router E1 for 181.0.0.0/8. E1 knows two BGP
routes for 181.0.0.0/8, as expected. The one listed as the best path has 1.1.1.1 (I1-1) as
Next_Hop. The following list outlines the best path logic:
Step 0. The Next_Hop of each is reachable. (Otherwise the neighbors would not be up.)
Step 1. The Weight ties (both 0).
Step 2. The Local_Pref ties (unset, so no value is listed; defaults to 100).
Step 3. Neither route is locally injected; both are learned using BGP, so neither is better
at this step.
Step 4. AS_Path length is shorter for the route through I1-1 (1.1.1.1).
Next, consider the example of the route to 183.0.0.0/8. E1 currently lists the path through
I1-1 (1.1.1.1) as best, but the best path decision actually falls all the way to Step 9. For completeness’
sake, E1’s best path logic runs as follows:
Step 0. The Next_Hop of each is reachable (otherwise the neighbors would not be up)
Step 1. The Weight ties (both 0).
Step 2. The Local_Pref ties (unset, defaults to 100).
Step 3. Neither route is locally injected.
Step 4. AS_Path length is 4 in both cases.
Step 5. Both Origin codes are i.
Step 6. MED, listed under the Metric column, ties (0).
Step 7. Neighbor type for each neighbor is eBGP.
Example 15-1 BGP Configuration on E1: Neighborships Configured
www.CareerCert.info
504 CCNP ROUTE 642-902 Official Certification Guide
Step 8. IGP metric does not apply, because neither uses IGP routes. (The routes from
E1 to 1.1.1.1 are static routes.)
Step 9. The route learned from 1.1.1.1 is the oldest route.
Although you may believe the claims at Step 9, the output in Example 15-1 does not explicitly
state that fact. However, when IOS lists output in the variations of the show ip bgp
command, the oldest route for each prefix is listed last, and the newest (most recently
learned) is listed first. Example 15-2 confirms this logic, and confirming how Step 9 works
in this case. Example 15-2 clears peer 1.1.1.1 (I1-1), making E1’s route through 192.168.1.2
(I3-1) become the oldest known route for 183.0.0.0/8:
Example 15-2 Clearing Neighbors to Force a New Route
E1# clear ip bgp 1.1.1.1
E1#
*Aug 24 11:30:41.775: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Down User reset
*Aug 24 11:30:43.231: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Up
E1# show ip bgp 176.0.0.0/4 longer-prefixes
BGP table version is 47, local router ID is 128.107.9.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 181.0.0.0/8 1.1.1.1 0 0 1 1811 i
* 192.168.1.2 0 0 3 2 50 51 52 1811 i
*> 182.0.0.0/8 1.1.1.1 0 0 1 2 1822 i
* 192.168.1.2 0 0 3 2 50 51 1822 i
* 183.0.0.0/8 1.1.1.1 0 0 1 2 50 1833 i
*> 192.168.1.2 0 0 3 2 50 1833 i
* 184.0.0.0/8 1.1.1.1 0 0 1 2 50 51 1844 i
*> 192.168.1.2 0 0 3 2 1844 i
* 185.0.0.0/8 1.1.1.1 0 0 1 2 50 51 52 1855 i
*> 192.168.1.2 0 0 3 1855 i
After the hard reset of peer 1.1.1.1, E1’s oldest-known route for 183.0.0.0/8 is the route
through 192.168.1.2, listed second (last). That E1 now chooses this route as best is another
confirmation that E1’s best path decision fell to Step 9.
Setting the BGP Administrative Weight Using a Route Map
The neighbor neighbor-ip route-map in BGP subcommand tells a router to apply the
route map to all BGP Updates received from the listed neighbor. Such route maps always
attempt to filter routes. The router allows routes first matched in a permit clause and filters
(discards) routes first matched with a deny clause.
BGP route maps can also be used to change the PAs of routes by using the set command.
For example, a router could use a neighbor 1.1.1.1 route-map fred in command. The route
www.CareerCert.info
Chapter 15: BGP Path Control 505
map could contain permit clauses that cause some routes to not be filtered. In those same
route map clauses, the inclusion of commands such as set weight 100 and set local-preference
200 can be used to set items such as the Weight or Local_Pref of a route. (Although
you can configure a set command in a route map deny clause, the set has no effect
because the deny clause filters the route.)
Example 15-3 shows a sample configuration that sets the Weight for prefix 181.0.0.0/8 as
learned from I3-1 (neighbor ID 192.168.1.2). As shown in Examples 15-1, E1’s original best
route for this prefix is through I1-1 (1.1.1.1), due to the shorter AS_Path length at Step 4 of
the best path algorithm. By setting the Weight higher on the route learned from I3-1, E1
now chooses the route through I3-1.
Example 15-3 Setting the Weight to 50 for 181/8, as Learned from I3-1
E1# conf t
Enter configuration commands, one per line. End with CNTL/Z.
E1(config)# ip prefix-list match-181 permit 181.0.0.0/8
E1(config)# route-map set-weight-50 permit 10
E1(config-route-map)# match ip address prefix-list match-181
E1(config-route-map)# set weight 50
E1(config-route-map)# route-map set-weight-50 permit 20
E1(config-route-map)# router bgp 11
E1(config-router)# neighbor 192.168.1.2 route-map set-weight-50 in
E1(config-router)# ^Z
E1#
E1# clear ip bgp 192.168.1.2 soft
E1# show ip bgp 176.0.0.0/4 longer-prefixes
BGP table version is 48, local router ID is 128.107.9.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
* 181.0.0.0/8 1.1.1.1 0 0 1 1811 i
*> 192.168.1.2 0 50 3 2 50 51 52 1811 i
*> 182.0.0.0/8 1.1.1.1 0 0 1 2 1822 i
* 192.168.1.2 0 0 3 2 50 51 1822 i
* 183.0.0.0/8 1.1.1.1 0 0 1 2 50 1833 i
*> 192.168.1.2 0 0 3 2 50 1833 i
* 184.0.0.0/8 1.1.1.1 0 0 1 2 50 51 1844 i
*> 192.168.1.2 0 0 3 2 1844 i
* 185.0.0.0/8 1.1.1.1 0 0 1 2 50 51 52 1855 i
*> 192.168.1.2 0 0 3 1855 i
! The next command lists the pre-route-map received Update
E1# show ip bgp neigh 192.168.1.2 received-routes | include 181
* 181.0.0.0/8 192.168.1.2 0 0 3 2 50 51 52 1811 i
www.CareerCert.info
506 CCNP ROUTE 642-902 Official Certification Guide
! The next command shows the post-route-map received Update
E1# show ip bgp neigh 192.168.1.2 routes | incl 181
*> 181.0.0.0/8 192.168.1.2 0 50 3 2 50 51 52 1811 i
The configuration uses a single-line IP prefix list that matches exactly prefix 181.0.0.0/8,
and a 2-clause route map. The first route-map clause, a permit clause, matches 181.0.0.0/8.
The permit action allows the route through the filter. The set weight 50 command then
sets the weight.
The second route-map clause, also with a permit action, matches the rest of the prefixes
in the Update because there is no match command. The permit action allows these routes
through the filter. Without clause 20, this route map would have matched all other routes
with the route map’s implied deny clause at the end of every route map, filtering all other
routes learned from 192.168.1.2 except 181.0.0.0/8.
The configuration also includes a neighbor 192.168.1.2 route-map set-weight-50 in command
to enable the route map for incoming updates from Router I3-1. The example also
shows that the neighbor must be cleared, in this case with a soft reset of the clear ip bgp
192.168.1.2 soft command because the route map logic takes effect.
Examining the results of this change, note that E1 now thinks the better route is through
I3-1 (192.168.1.2). The output lists the new weight of 50, with the route through I1-1
(1.1.1.1) using the default weight of 0. With weight, bigger is better.
Finally, the last two commands in the example show the pre-route-map received update
(with the received-routes option) and the post-route-map results of the received update
(with the routes option). The received Update does not include Weight because it is
Cisco-proprietary, so E1 initially assigned the Weight to its default value (0). After applying
the route map, E1 now lists a Weight of 50.
Setting Weight Using the neighbor weight Command
Alternatively, the weight can be set for all routes learned from a neighbor using the
neighbor weight command. Example 15-4 shows this configuration added to E1, setting
the Weight for all routes learned from I1-1 (1.1.1.1) to 60. As a result, E1’s route for
181.0.0.0/8 switches back to using the route through 1.1.1.1 (I1-1).
Example 15-4 Setting the Weight to 60 for All Routes Learned from I1-1
E1# conf t
Enter configuration commands, one per line. End with CNTL/Z.
E1(config)# router bgp 11
E1(config-router)# neighbor 1.1.1.1 weight 60
E1(config-router)#^Z
E1# clear ip bgp 1.1.1.1 soft
www.CareerCert.info
Chapter 15: BGP Path Control 507
E1# show ip bgp 176.0.0.0/4 longer-prefixes
BGP table version is 54, local router ID is 128.107.9.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 181.0.0.0/8 1.1.1.1 0 60 1 1811 i
* 192.168.1.2 0 50 3 2 50 51 52 1811 i
*> 182.0.0.0/8 1.1.1.1 0 60 1 2 1822 i
* 192.168.1.2 0 0 3 2 50 51 1822 i
*> 183.0.0.0/8 1.1.1.1 0 60 1 2 50 1833 i
* 192.168.1.2 0 0 3 2 50 1833 i
*> 184.0.0.0/8 1.1.1.1 0 60 1 2 50 51 1844 i
* 192.168.1.2 0 0 3 2 1844 i
*> 185.0.0.0/8 1.1.1.1 0 60 1 2 50 51 52 1855 i
* 192.168.1.2 0 0 3 1855 i
The neighbor weight command does not use an in or out direction because Weight can
only be set on input. The configuration results in all routes learned from 1.1.1.1 (I1-1) having
a Weight of 60, as noted in the Weight column of the show ip bgp output.
Setting the Local Preference
The BGP Local Preference (Local_Pref) PA gives the routers inside a single AS a value that
they can set per-route, advertise to all iBGP routers inside the AS, so that all routers in the
AS agree about which router is the best exit point for packets destined for that prefix. By
design, the Local_Pref can be set by routers as they receive eBGP routes by using an inbound
route map. The routers then advertise the Local_Pref in iBGP updates. As a result,
all the routers in the same AS can then make the same choice of which route is best, agreeing
as to which router to use to exit the AS for each prefix.
As with the discussion of Weight, this section begins with a description of a sample scenario.
Following that, a sample Local_Pref configuration is shown, using a route-map to
set Local_Pref for routes advertised into an Enterprise. Table 15-5 summarizes some of
the key features of Local_Pref as demonstrated in the upcoming pages.
Table 15-5 Key Features of Local_Pref
Feature Description
PA? Yes
Purpose Identifies the best exit point from the AS to reach a given prefix
Scope Throughout the AS in which it was set; not advertised to eBGP peers
Range 0 through 4,294,967,295 (232 – 1)
Which is best? Higher values are better
Key
Topic
www.CareerCert.info
508 CCNP ROUTE 642-902 Official Certification Guide
Note: For those of you memorizing using the N WLLA OMNI mnemonic, Local_Pref is
the first L in WLLA.
Sample Internetwork Used in the Local_Pref and AS_Path Length Examples
Figure 15-5 shows a sample Internetwork used to demonstrate setting both Local_Pref,
and later, AS_Path Length. The figure shows a single Enterprise with two Internet-connected
routers. A full iBGP mesh exists with these two routers plus two routers internal to
the Enterprise. Two eBGP neighborships exist, one with ISP1, and one with ISP3. (Note in
particular that unlike Figure 15-3, E1 does not have a neighborship with router I3-1 in this
case.) The following design requirements have already been met by the initial configuration
in all routers shown in the figure:
■ E1 and I1-1 uses loopback IP addresses (11.11.11.11 and 1.1.1.1) for their neighborship.
■ E2 and I3-1 use interface IP addresses for their neighborship.
■ None of the routers have attempted to change any settings that can impact the choice
of best path, and Weight settings in the previous examples have been removed.
iBGP
Mesh
ASN 3 ISP3
ASN 1 ISP1
I3-1
E1 I1-1
E2
eBGP
192.168.1.5
Core1
Core2
10.100.1.3
10.100.1.4 10.100.1.2
10.100.1.1
192.168.1.6
11.11.11.11 1.1.1.1
eBGP
Figure 15-5 Sample Internetwork for BGP Local_Pref and AS_Path Length Examples
Default 100
Changing the
default
Using the bgp default local-preference <0-4294967295> BGP subcommand
Configuration Via neighbor route-map command; in option is required for updates
from an eBGP peer
www.CareerCert.info
Chapter 15: BGP Path Control 509
As with the Weight example, both ISPs advertise the same five prefixes, with different
AS_Paths so that the routers have some prefixes to manipulate. Figure 15-6 shows five
such prefixes that both ISPs advertise to E1 and E2. Note that this example network uses
the same five prefixes, prefix lengths, and As_Path values as the previous Weight examples
in this chapter.
Before showing the example of how to set the Local_Pref and how it impacts the routes, it
is helpful to look at the best BGP routes on the Enterprise routers before any PAs have
been changed. Example 15-6 shows the relevant BGP table entries on E1, E2, and Core1
with no attempt to influence E1’s choice of best path. The best path for four of the five
prefixes will be obvious, but the output listed in the commands requires some review. Prefixes
181.0.0.0/8 and 182.0.0.0/8 have a shorter AS_Path through ISP1, so E1 and E2 will
agree that E1’s path, through ISP1, is best. Similarly, 184.0.0.0/8 and 185.0.0.08 have a
shorter AS_Path through ISP3, so both E1 and E2 agree that E2’s path is best for these
prefixes. Again, 183.0.0.0/8 ties on AS_Path length.
Example 15-5 BGP Tables on E1, E2, and Core1, with No Changes to Settings That Affect
Best Path
! First, on router E1
E1# show ip bgp 176.0.0.0/4 longer-prefixes
BGP table version is 15, local router ID is 128.107.9.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
Best BGP
Routes:
181,182 : I1-1
183 : I1-1
184,185 : E2
Best BGP
Routes:
181,182 : E1
183 : I3-1
184,185 : I3-1
I1-1
510 CCNP ROUTE 642-902 Official Certification Guide
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 181.0.0.0/8 1.1.1.1 0 0 1 1811 i
*> 182.0.0.0/8 1.1.1.1 0 0 1 2 1822 i
* i183.0.0.0/8 10.100.1.2 0 100 0 3 2 50 1833 i
*> 1.1.1.1 0 0 1 2 50 1833 i
*>i184.0.0.0/8 10.100.1.2 0 100 0 3 2 1844 i
* 1.1.1.1 0 0 1 2 50 51 1844 i
*>i185.0.0.0/8 10.100.1.2 0 100 0 3 1855 i
* 1.1.1.1 0 0 1 2 50 51 52 1855 i
! Next, on router E2
E2# show ip bgp 176.0.0.0/4 longer-prefixes
! legend omitted for brevity
Network Next Hop Metric LocPrf Weight Path
*>i181.0.0.0/8 10.100.1.1 0 100 0 1 1811 i
* 192.168.1.6 0 0 3 2 50 51 52 1811 i
*>i182.0.0.0/8 10.100.1.1 0 100 0 1 2 1822 i
* 192.168.1.6 0 0 3 2 50 51 1822 i
* i183.0.0.0/8 10.100.1.1 0 100 0 1 2 50 1833 i
*> 192.168.1.6 0 0 3 2 50 1833 i
*> 184.0.0.0/8 192.168.1.6 0 0 3 2 1844 i
*> 185.0.0.0/8 192.168.1.6 0 0 3 1855 i
! Next, on router Core1
Core1# show ip bgp 176.0.0.0/4 longer-prefixes
! legend omitted for brevity
Network Next Hop Metric LocPrf Weight Path
*>i181.0.0.0/8 10.100.1.1 0 100 0 1 1811 i
*>i182.0.0.0/8 10.100.1.1 0 100 0 1 2 1822 i
*>i183.0.0.0/8 10.100.1.1 0 100 0 1 2 50 1833 i
* i 10.100.1.2 0 100 0 3 2 50 1833 i
*>i184.0.0.0/8 10.100.1.2 0 100 0 3 2 1844 i
*>i185.0.0.0/8 10.100.1.2 0 100 0 3 1855 i
First, pay close attention to the LocPrf column of output in the example. This column lists
the Local_Pref settings of each route. Some list a (default) value of 100, and some list
nothing. As it turns out, because Updates received from eBGP peers do not include the
Local_Pref PA, IOS lists a null value for Local_Pref for eBGP-learned routes by default.
However, Updates from iBGP peers do include the Local_Pref. Because this network does
not have any configuration that attempts to set Local_Pref yet, the routers advertise their
default Local_Pref value of 100 over the iBGP connections.
www.CareerCert.info
Chapter 15: BGP Path Control 511
Also note that when comparing the output on both E1 and E2, the output lists a single
eBGP route, but not the alternative iBGP route through the other Internet-connected
router in the Enterprise. For example, E2 lists a single route for 184.0.0.0/8 and 185.0.0.0/8,
through I3-1 (192.168.1.6). The reason that E2 does not list an alternative route through E1
is that E1’s best route for these prefixes, as seen near the top of the example, is E1’s iBGPlearned
route through E2 (10.100.1.2). BGP does not allow a router to advertise iBGPlearned
routes to iBGP peers, so E1 will not advertise routes for 184.0.0.0/8 or 185.0.0.0/8
to router E2.
Finally, For prefix 183.0.0.0/8, both E1 and E2 tie on the As_Path length. In this case, all
best path choices tie until Step 7, which prefers eBGP routes over iBGP routes. E1 prefers
its eBGP route for 183.0.0.0/8 through ISP1’s Router I1-1, and E2 prefers its eBGP route
through ISP3’s Router I3-1.
Setting the BGP Local_Pref Using a Route Map
To set the Local_Pref, a router can use the neighbor neighbor-ip route-map in BGP subcommand.
Typically, a router uses this command with the inbound direction for routes received
from eBGP peers. Then, with no additional configuration required, the router then
advertises the Local_Pref to any iBGP peers.
To show the Local_Pref configuration and results, start with the sample network shown in
the previous section. The configuration will now be changed to set the Local_Pref for two
different prefixes for Updates received on E1 from I1-1, as shown in Figure 15-7. Note that
the figure reinforces the idea that BGP does not include the Local_Pref PA in eBGP Updates
but will in iBGP Updates.
The figure shows a series of steps, as follows:
Step 1. I1-1 and I3-1 advertise the prefixes into the Enterprise but with no Local_Pref
set because the connections are eBGP peers.
Key
Topic
Set 184.0.0.0/8 Local_Pref = 50
Set 185.0.0.0/8 Local_Pref = 150
E1 I1-1
E2 I3-1
iBGP Updates with
Local_Pref Set
184/8, 185/8
No Local_Pref
184/8, 185/8
No Local_Pref
1
2
3
4
1
184.0.0.0/8: My Local_Pref = 100 is Better
185.0.0.0/8: E1’s Local_Pref = 150 is Better
Figure 15-7 Example Local_Pref Settings for the Upcoming Example
www.CareerCert.info
512 CCNP ROUTE 642-902 Official Certification Guide
Step 2. E1 sets the Local_Pref for routes learned from I1-1: 184.0.0.0/8 (50) and
185.0.0.0/8 (150).
Step 3. E1 includes the Local_Pref settings in its iBGP Updates to Core1, Core2, and E2.
Step 4. E2 realizes that E1’s route for 185.0.0.0/8, Local_Pref 150, is better than E2’s
eBGP route for this prefix, which E2 assigned default Local_Pref 100. Conversely,
E1’s advertised route for 184.0.0.0/8, Local_Pref 50, is worse than E2’s
eBGP route for that same prefix, with assigned default Local_Pref 100.
Example 15-6 shows the configuration on router E1 to assign the Local_Pref values shown
in Figure 15-7. The example also shows the results on E1 and E2. Note that the configuration
differs only slightly as compared with the configuration for administrative Weight as
shown in Example 15-3, the only substantive difference being the set local-preference
route map command rather than the set weight command.
Example 15-6 Configuring Local_Pref on Router E1 (Step 2 per Figure 15-7)
E1# show running-config
! only pertinent portions shown
ip prefix-list match-184 seq 5 permit 184.0.0.0/8
!
ip prefix-list match-185 seq 5 permit 185.0.0.0/8
!
route-map set-LP-150 permit 10
match ip address prefix-list match-185
set local-preference 150
!
route-map set-LP-150 permit 15
match ip address prefix-list match-184
set local-preference 50
!
route-map set-LP-150 permit 20
!
router bgp 11
neighbor 1.1.1.1 route-map set-LP-150 in
! The clearing of BGP neighbor I1-1 is done next, but not shown.
! Next, E1’s Updated BGP Table
E1# show ip bgp 176.0.0.0/4 longer-prefixes
BGP table version is 29, local router ID is 128.107.9.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 181.0.0.0/8 1.1.1.1 0 0 1 1811 i
*> 182.0.0.0/8 1.1.1.1 0 0 1 2 1822 i
www.CareerCert.info
Chapter 15: BGP Path Control 513
* i183.0.0.0/8 10.100.1.2 0 100 0 3 2 50 1833 i
*> 1.1.1.1 0 0 1 2 50 1833 i
*>i184.0.0.0/8 10.100.1.2 0 100 0 3 2 1844 i
* 1.1.1.1 0 50 0 1 2 50 51 1844 i
*> 185.0.0.0/8 1.1.1.1 0 150 0 1 2 50 51 52 1855 i
E1# show ip bgp 185.0.0.0/8
BGP routing table entry for 185.0.0.0/8, version 7
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Advertised to update-groups:
1
1 2 50 51 52 1855, (received & used)
1.1.1.1 from 1.1.1.1 (1.1.1.1)
Origin IGP, metric 0, localpref 150, valid, external, best
! The next output occurs on router E2
E2# show ip bgp 185.0.0.0/8 longer-prefixes
! heading lines omitted
Network Next Hop Metric LocPrf Weight Path
*>i185.0.0.0/8 10.100.1.1 0 150 0 1 2 50 51 52 1855 i
* 192.168.1.6 0 0 3 1855 i
Example 15-6’s output shows E1’s BGP table entries, now with updated Local_Pref values
as compared with Example 15-5. E1 now uses its eBGP route, Next_Hop 1.1.1.1, for prefix
185.0.0.0/8 because of the higher Local_Pref.
The end of the example shows E2 with two possible routes for 185.0.0.0/8. The following
list outlines E2’s BGP best path logic in this case:
Step 0. The two routes both have reachable Next_Hop IP addresses.
Step 1. Both have Weight 0 (tie).
Step 2. The iBGP route through 10.100.1.1 (E1) has a bigger (better) Local_Pref (150
versus 100) that the route through 192.168.1.6 (I3-1), so it is the better route.
Also, note that both the show ip bgp longer-prefixes command’s briefer output, and the
show ip bgp 185.0.0.0/8 commands more verbose output, both identify the Local_Pref
value. However, the longer command output does not list the Weight value.
IP Routes Based on BGP Best Paths
Some of the complexity related to BGP occurs around the BGP functions created by BGP
PAs, including their use by the best path algorithm. When the BGP best path algorithm
has gotten through this complexity and chosen a best route for a prefix, the router then
tries to add that route to the IP routing table. However, rather than add the BGP route to
www.CareerCert.info
514 CCNP ROUTE 642-902 Official Certification Guide
the IP routing table directly, BGP actually gives that best BGP route to another process for
consideration: The IOS Routing Table Manager (RTM).
The IOS RTM chooses the best route among many competing sources. For example,
routes may be learned by an IGP, BGP, or even as connected or static routes. IOS collects
the best such route for each prefix and feeds those into the RTM function. The RTM then
chooses the best route. Figure 15-8 shows the general idea:
Among its tasks, RTM uses the concept of Administrative Distance (AD) to choose the
best route among these different sources. Table 15-6 repeats the list of default AD values
as shown earlier in Table 10-6 from Chapter 10, “Advanced IGP Redistribution,” but with
highlights for the two BGP-related default values:
For the most part, an Enterprise router should not see cases in which a prefix learned with
BGP has also been learned as a connected or IGP-learned route. (Conversely, these issues
Connected
Routes
Routing
Table
Manager
(RTM)
BGP
Routes
IGP
Routes
IP
Routing
Table
Routing
Information
Base
(RIB)
Best
Only
Best
Only
Figure 15-8 Routing Table Manager Concept
Table 15-6 Default Administrative Distances
Route Type Administrative Distance
Connected 0
Static 1
EIGRP summary route 5
eBGP 20
EIGRP (internal) 90
www.CareerCert.info
Chapter 15: BGP Path Control 515
occur more often when implementing MPLS VPNs with BGP/IGP redistribution.) However,
it can happen, and when it does, the show ip bgp rib-failures command can be helpful.
This command lists routes for which BGP has chosen the route as best, but the RTM
function has not placed the route into the Routing Information Base (RIB), which is simply
another name for the IP routing table.
Example of a BGP RIB Failure
To show an example of a RIB failure, imagine that an Enterprise engineer needed to do
some testing, so the engineer just picked an IP address range to use. The engineer tries to
avoid problems by not using network 10.0.0.0, which is used throughout the Enterprise. So
rather than choosing another private network, the engineer then chooses public range
185.0.0.0/8. After changing the lab configuration a few hundred times, a route for
185.0.0.0/8 leaks into the OSPF topology database.
Keep in mind that at the end of the previous example, E1 had chosen its eBGP route for
185.0.0.0/8 as its best route, and E2 had chosen its iBGP route as its best route for
185.0.0.0/8. Example 15-7 shows the results, based on RTM’s comparisons of the AD values.
Example 15-7 Example with the RTM and RIB Failures
! First, E1’s IP Routing table for 185.0.0.0/8
E1# show ip route 185.0.0.0 255.0.0.0 longer-prefixes
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Table 15-6 Default Administrative Distances
Route Type Administrative Distance
IGRP 100
OSPF 110
IS-IS 115
RIP 120
On-Demand Routing (ODR) 160
EIGRP (external) 170
iBGP 200
Unreachable 255
www.CareerCert.info
516 CCNP ROUTE 642-902 Official Certification Guide
Gateway of last resort is 1.1.1.1 to network 0.0.0.0
B 185.0.0.0/8 [20/0] via 1.1.1.1, 00:25:11
! Next, E2’s IP Routing table
E2# show ip route 185.0.0.0 255.0.0.0 longer-prefixes
! Legend omitted for brevity
Gateway of last resort is 192.168.1.6 to network 0.0.0.0
O 185.0.0.0/8 [110/2] via 10.1.1.77, 00:15:44, FastEthernet0/0
E2# show ip bgp rib-failure
Network Next Hop RIB-failure RIB-NH Matches
185.0.0.0/8 10.100.1.1 Higher admin distance n/a
The first command shows that E1, with an eBGP route, actually adds its route to the IP
routing table. The route lists a code of B, meaning BGP. The output lists the eBGP default
AD of 20, which is a better default AD than OSPF’s 110. RTM added this BGP route to the
IP routing table on E1 because of eBGP’s better AD.
E2 currently lists its iBGP route through E1 as its current best BGP route for 185.0.0.0/8
because of the higher Local_Pref configured in Example 15-6. However, after giving this
route to the RTM, RTM instead choose the lower-AD OSPF route (AD 110) rather than
the higher-AD iBGP route (AD 200).
Finally, the show ip bgp rib-failure command lists one line for each best BGP route that
the RTM does not place into the IP routing table. In this case, this command on Router E2
lists the route for 185.0.0.0/8, with the reason listed.
BGP and the maximum-paths Command
Like the IGP protocols, BGP supports the maximum-paths number-of-paths subcommand,
but BGP uses significantly different logic than the IGPs. Unlike the IGP routing
protocols, BGP truly needs to pick one route, and only one route, as the best path for a
given prefix/length. In effect, the BGP best path algorithm already breaks the ties for
“best” route for each prefix, so from BGP’s perspective, one route for each prefix is always
best.
BGP does allow multiple BGP routes for a prefix to be considered to tie, at least for the
purpose of adding multiple routes to the IP routing table. The conditions are as follows:
If the BGP best path algorithm does not choose a best path by Step 8 (per the numbering
in this book), the routes which still tie for being best path through Step 8 will
be allowed into the IP routing table, up to the number defined by the BGP
maximum-paths number-of-paths router subcommand.
The section “Overview of the BGP Best Path Algorithm” earlier in this chapter lists the
best path steps, including the tiebreaker steps that allow routes to be considered by the
maximum-paths command.
www.CareerCert.info
Chapter 15: BGP Path Control 517
Increasing the Length of the AS_Path Using AS_Path Prepend
Step 4 of the BGP best path algorithm examines the length of the AS_Path PA. The length
of the AS_Path may appear to be obvious: Just add the number of ASNs listed in the
AS_Path. However, some BGP features outside the scope of this book actually impact the
AS_Path length calculation as well. However, for the purposes of this book, AS_Path
length is simply the number of ASNs listed in the AS_Path.
The AS_Path prepend tool gives engineers a means to increase the length of an AS_Path by
adding ASNs to the AS_Path, while not impacting the loop prevention role of the AS_Path
PA. By increasing the length of an AS_Path, a route is less likely to become the best route.
By adding ASNs that already exist inside a particular route’s AS_Path, the feature does not
inadvertently prevent a route from being ignored due to AS_Path loop prevention.
For example, using the design shown most recently in Figures 15-5, 15-6, and 15-7, imagine
that the Enterprise considers ISP1 to be the better ISP, but they do not want to send all
traffic through ISP1. So, the Enterprise network engineers could make the following type
of implementation choice:
Make the AS_Paths received from ISP3 be 2 ASNs longer.
By making such a choice, when an AS_Path through ISP1 is better, or when it’s a tie on
AS_Path between ISP1 and ISP3, or when the AS_Path through ISP1 is even slightly
longer than through ISP3, the routers can still choose their routes through ISP1. Only
when the AS_Path (before prepending) is at least 2 ASNs shorter through ISP3 can the
ISP3 path be chosen.
Note: For those of you memorizing using the N WLLA OMNI mnemonic, AS_Path
Length is the A in WLLA.
Figure 15-9 shows the mechanics of how an Enterprise route would prepend the AS_Path
for routes received by Router E2 from ISP3, namely Router I3-1. Looking specifically at
the route for 185.0.0.0/8, in this case, I3-1 has not changed the AS_Path and advertised the
route with AS_Path (3, 1855). At Step 2, Router E2 prepends ASN 3–twice–making the
AS_Path length 4. At Step 3, E2 advertises the route to its iBGP peers–peers that may now
prefer to the other route for this prefix through Router E1.
The configuration itself requires only a little additional work compared to the other examples.
As shown in Figure 15-9, Router E1 could use an inbound route map, using the set
as-path prepend 3 3 command to add the two ASNs. (The router sending the Update,
ISP3’s Router I3-1 in this case, could instead use an outbound route map.) Example 15-8
shows the configuration on E2 to add the ASNs at ingress into E2. (Note that all configuration
for changing the Weight and Local_Pref, and the extra OSPF route for 185.0.0.0/8
shown in Example 15-6, have been removed before gathering the output in this example.)
No comments:
Post a Comment