Wednesday, July 14, 2010

BSCI - Configure Local Preference

Local Prefence is used by iBGP peers to determine the Best Path out of the AS for a given route.

Set to 100 by default, the highest Local Preference wins.

You can either set the Local Preference on given router or for a specific route.

For a router do:
R1(config)#router bgp 100
R1(config-router)#bgp default local-preference [value]
        where [value] = a figure from 0 - 4294967295

All routes that R1 receives from an eBGP will have the local preference set to [value] when advertised to iBGP neighbors.

To set the local preference for a given route you use an ACL, define a  route map matching the ACL and then setting the Local Preference, fianlly apply the route-map to the necessary neighbor statements:
R2(config)#access-list 44 permit 10.10.10.0 0.0.0.255
!
R2(config)#route-map Local_Pref permit 10
R2(config-route-map)#match ip address 44
R2(config-route-map)#set Local_Preference 300
!
R2(config)#route-map Local_Pref permit 20
!
R2(config)#router bgp 200
R2(config-router)#neighbor 192.168.200.1 remote-map Local_Pref in
!

In the example above, route-map Local_Pref is configure to match networks permitted in ACL 44.

The route-map sets the Local Preference to 300 for the 10.10.10.0/24 networks. The second statement (permit 20) catches all other networks not covered in the (Permit 10) statement and as there are no match/set parameters these routes are processed as usual.

The route map is assigned to Neighbor 192.168.200.1 inbound. When R2 receives updates from 192.168.200.1 it assigns the local preference routes to 10.10.10.0/24.

Use #sh ip bgp to verify this.

If you have other routers with paths to 10.10.10.0/24 but you want to use R2 specifically for this route you define your route-map as above but set the Local Preference to one BELOW that of R2 - Remember HIGHEST LOCAL PREFERENCE WINS!

As a result when the route to 10.10.10.0/24 is advertised to other iBGP peers they select the path to R2 as the Best Path.

No comments:

Post a Comment