Local Preference Attribute
Local preference is an indication to the AS about which path is preferred to exit the AS in order to reach a certain network. A path with a higher local preference is more preferred. The default value for local preference is 100.
Unlike the weight attribute which is only relevant to the local router, local preference is an attribute that is exchanged among routers in the same AS.
Local preference is set via the bgp default local−preference value> command or with route−maps as will be demonstrated in the following example:
The bgp default local−preference command will set the local preference on the updates out of the router going to peers in the same AS. In the above diagram, AS256 is receiving updates about 170.10.0.0 from two different sides of the organization. Local preference will help us determine which way to exit AS256 in order to reach that network. Let us assume that RTD is the preferred exit point. The following configuration will set the local preference for updates coming from AS300 to 200 and those coming from AS100 to 150.
RTC#
router bgp 256
neighbor 1.1.1.1 remote−as 100
neighbor 128.213.11.2 remote−as 256
bgp default local−preference 150
RTD#
router bgp 256
neighbor 3.3.3.4 remote−as 300
neighbor 128.213.11.1 remote−as 256
bgp default local−preference 200
In the above configuration RTC will set the local preference of all updates to 150. The same RTD
will set the local preference of all updates to 200. Since local preference is exchanged within AS256, both RTC and RTD will realize that network 170.10.0.0 has a higher local preference when coming from AS300 rather than when coming from AS100. All traffic in AS256 addressed to that network will be sent to RTD as an exit point.
More flexibility is provided by using route maps. In the above example, all updates received by RTD will be tagged with local preference 200 when they reach RTD. This means that updates coming from AS34 will also be tagged with the local preference of 200. This might not be needed. This is why we can use route maps to specify what specific updates need to be tagged with a specific local preference as shown below:
RTD#
router bgp 256
neighbor 3.3.3.4 remote−as 300
neighbor 3.3.3.4 route−map setlocalin in
neighbor 128.213.11.1 remote−as 256
....
ip as−path access−list 7 permit ^300$
...
route−map setlocalin permit 10
match as−path 7
set local−preference 400
route−map setlocalin permit 20
set local−preference 150
With this configuration, any update coming from AS300 will be set with a local preference of 200. Any other updates such as those coming from AS34 will be set with a value of 150.
1 Comment:
Wonderful explanation of the classful summarization and the network statement. You made the life of at least one network engineer easier
Post a Comment