Previous | Table of Contents | Next |
The Local Preference Attribute
Setting the local preference also affects the BGP decision process. If multiple paths for the same prefix are available, the path with the larger local preference is preferred. Local preference is at the highest level of the BGP decision process (comes after the Cisco proprietary weight parameter); it is considered before the path length. A longer path with a higher local preference is preferred over a shorter path with a lower local preference. In the following example, still referring to figure 10-6, we will configure RTF to have a higher local preference for all BGP updates coming from RTD.
RTF configuration:
router bgp 3 no synchronization network 172.16.1.0 mask 255.255.255.0 network 172.16.10.0 mask 255.255.255.0 network 172.16.65.0 mask 255.255.255.192 network 172.16.220.0 mask 255.255.255.0 neighbor 172.16.2.254 remote-as 3 neighbor 172.16.2.254 next-hop-self neighbor 192.68.5.2 remote-as 2 neighbor 192.68.5.2 filter-list 10 out neighbor 192.68.5.2 route-map SETLOCAL in no auto-summary ip as-path access-list 10 permit ^$ route-map SETLOCAL permit 10 set local-preference 300
The route-map SETLOCAL will assign a local preference of 300 for all routes coming from RTD (note the keyword in). Note how BGP has decided that prefixes 192.68.10.0/24 and 192.68.11.0/24 are now reachable via next hop 192.68.5.2 having a local preference of 300.
RTF#sh ip bgp BGP table version is 20, local router ID is 192.68.5.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 172.16.1.0/24 0.0.0.0 0 32768 i * i 172.16.2.254 0 100 0 i *> 172.16.10.0/24 0.0.0.0 0 32768 i * i 172.16.2.254 20 100 0 i *> 172.16.65.0/26 0.0.0.0 0 32768 i * i 172.16.2.254 20 100 0 i *> 172.16.220.0/24 172.16.1.1 20 32768 i * i 172.16.2.254 0 100 0 i *> 192.68.10.0 192.68.5.2 0 300 0 2 i *> 192.68.11.0 192.68.5.2 300 0 2 1 i
Because the local preference attribute is carried inside the AS, RTF will pass the local preference value to RTA. This is illustrated in RTA's BGP table. Note how prefix 192.68.11.0/24 is preferred via IBGP with a local preference of 300, even though the AS_path via EBGP is shorter. Other prefixes learned via IBGP such as 172.16.10.0/24 have a default local preference of 100.
RTA#sh ip bgp BGP table version is 43, local router ID is 172.16.2.254 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path * i172.16.1.0/24 172.16.1.2 0 100 0 i *> 0.0.0.0 0 32768 i * i172.16.10.0/24 172.16.1.2 0 100 0 i *> 172.16.1.2 20 32768 i * i172.16.65.0/26 172.16.1.2 0 100 0 i *> 172.16.1.2 20 32768 i * i172.16.220.0/24 172.16.1.2 20 100 0 i *> 0.0.0.0 0 32768 i *>i192.68.10.0 172.16.1.2 0 300 0 2 i * 172.16.20.1 0 1 2 i *>i192.68.11.0 172.16.1.2 300 0 2 1 i * 172.16.20.1 0 0 1 i
Previous | Table of Contents | Next |