Sunday, October 28, 2012

BGP- Chaning Local Pref with Route Map




Now we want R1 to use R2 for 172.12.34.0 and R3 for 210.1.1.0. A route map can be used conditionally to achieve this.


R2(config)#access-list 27 permit 172.12.34.0 0.0.0.255
R2(config)#route-map R1TOR3 permit 10
R2(config-route-map)#match ip address 27
R2(config-route-map)#set local-preference 200
R2(config-route-map)#exit
R2(config)#route-map R1TOR3 permit 20
R2(config-route-map)#set local-preference 100
R2(config-route-map)#router bgp 12
R2(config-router)#neighbor 4.4.4.4 route-map R1TOR3 in


R1#show ip bgp
BGP table version is 10, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
* i172.12.34.0/24   2.2.2.2                  0    100      0 34 i
*>                  3.3.3.3                  0             0 34 i
* i210.1.1.0        2.2.2.2                  0    100      0 34 i
*>                  3.3.3.3                  0             0 34 i


It appears my route map didn't work but BGP doesn't update unless there is a network change. Clearing all bgp routes with a soft command allows BGP to update without breaking the peers relationships.


R2#clear ip bgp * soft

R1#show ip bgp
BGP table version is 11, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i172.12.34.0/24   2.2.2.2                  0    200      0 34 i
*                   3.3.3.3                  0             0 34 i
* i210.1.1.0        2.2.2.2                  0    100      0 34 i
*>                  3.3.3.3                  0             0 34 i
R1#

Now I have routes destined for 172.12.34.0 going through R2 and routes destined for 219.1.1.0 going through R3 using nothing but a route map setting local prf. 




No comments:

Post a Comment