Sunday, October 28, 2012

BGP-Changing weight attribute (cisco specific)


In this lab I will demonstrate how to change the weight of a neighbor peer to get the results I want. R4 is advertising its lo 4.4.4.4 and R1 know how to get it two different ways, R2 and R3. I want R1 to choose R3.

No routes are chosen as best because both are inaccessible.

R1#show ip bgp
BGP table version is 1, 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
* i4.4.4.4/32       10.1.1.4                 0    100      0 4 i
* i                 10.1.1.4                 0    100      0 4 i

First I notice that I need the next-hop-self command on R2 and R3 because in BGP the next hop router doesn't change when advising into an different AS.

R2(config-router)#neighbor 172.12.123.1 next-hop-self

R3(config-router)#neighbor 172.12.123.1 next-hop-self

R1#show ip bgp
BGP table version is 2, 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
* i4.4.4.4/32       172.12.123.3             0    100      0 4 i
*>i                 172.12.123.2             0    100      0 4 i

I need to clear the BGP table so that I can force the changes to appear.

R1#show ip bgp 4.4.4.4
BGP routing table entry for 4.4.4.4/32, version 2
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Flag: 0x820
  Not advertised to any peer
  4
    172.12.123.3 from 172.12.123.3 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, internal
  4
    172.12.123.2 from 172.12.123.2 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, internal, best

Now that both routes accessible, I will change the weight with the neighbor weight command.

R1(config)#router bgp 123
R1(config-router)#neighbor 172.12.123.3 weight 200

R1#show ip bgp
BGP table version is 2, 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
* i4.4.4.4/32       172.12.123.3             0    100      0 4 i
*>i                 172.12.123.2             0    100      0 4 i
R1#clear ip bgp * soft

R1#show ip bgp
BGP table version is 3, 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
*>i4.4.4.4/32       172.12.123.3             0    100    200 4 i
* i                 172.12.123.2             0    100      0 4 i

The weight now shows 200 for R3's route.

No comments:

Post a Comment