Content

| 9.6 |  | BGP Attributes |
| 9.6.10 |  | Manipulating Local Preference |

In Figure , AS 256 receives route updates for network 170.10.0.0 from AS 100 and AS 300. The following 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, set the Local Preference attribute on RTC and RTD as follows:

> 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

The configuration from RTC causes it to set the Local Preference of all updates from AS 100 to 150. The configuration from RTD 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, 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. This includes 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.

Notice that the configuration shown in the 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 ten (10) of the route map, SETLOCALIN. Instance 20 of the route map accepts all other routes.

| Lab Activity e-Lab Activity: Manipulating Local Preference This lab uses the BGP default local-preference command.

| Web Links Configuring BGP http://www.cisco.com/univercd/cc/td/doc/product/ software/ios122/122cgcr/fipr_c/ipcprt2/1cfbgp.htm