In Figure ,
AS 256 receives route updates for network 170.10.0.0 from AS 100 and
AS 300. There are two ways to set the Local Preference attribute on
the routers in AS 256:
- Use the bgp
default local-preference
command
- Use a route map to set local
preference
Using the bgp
default local-preference command,
you can set the Local Preference attribute on RTC and RTD:
RTC(config)#router bgp 256
RTC(config-router)#neighbor 1.1.1.1 remote-as 100
RTC(config-router)#neighbor 128.213.11.2 remote-as 256
RTC(config-router)#bgp default local-preference 150
RTD(config)#router bgp 256
RTD(config-router)#neighbor 3.3.3.4 remote-as 300
RTD(config-router)#neighbor 128.213.11.1 remote-as 256
RTD(config-router)#bgp default local-preference 200
RTC's configuration causes it to set
the Local Preference of all updates from AS 100 to 150, and RTD's
configuration causes it to set the Local Preference for all updates
from AS 300 to 200. Because Local Preference is exchanged within the
AS, both RTC and RTD determine that updates regarding network
170.10.0.0 have a higher Local Preference when they come from AS 300
than when they come from AS 100. As a result, all traffic in AS 256
destined for network 170.10.0.0 is sent RTD.
As an alternate configuration, you
can use a route map. Route maps provide more flexibility than the bgp
default local-preference
configuration command. When the bgp
default local-preference
command is used on RTD, the Local Preference attribute of all
updates received by RTD will be set to 200, including updates from
AS 34. The example configuration in Figure
uses a route map to
set the Local Preference attribute on RTD specifically for updates
regarding AS 300.
Note that the configuration shown in
Figure
uses the ip as-path
access-list command, which
matches the regular expression ^300$.
Essentially, this statement matches any routes that include AS 300
in their AS_Path attribute.
With the configuration, the Local
Preference attribute of any update coming from AS 300 is set to 200
by instance 10 of the route map, SETLOCALIN. Instance 20 of the
route map accepts all other routes.
|