BGP Weight attribute fundamentals, review of iBGP vs eBGP behaviors, and explanation of configuring Weights!

BGP_Weight_Top

Time for some weight fundamentals to throw out quick, as I am running out of steam, but my goal is to finish the BGP Weight section!

So about those fundamentals:

  • The attribute is Cisco Proprietary, not on the list of well known or optional attributes (I imagine because of being Cisco Proprietary)
  • Weight is locally significant only to the local router, this attribute is never advertised to another BGP Speaker whether iBGP or eBGP
  • Default weight has two different values, for a route originating on the local router it is 32768, and for all other BGP Peers it is 0
  • It is, of course, the highest determining Best Path factor in the Path Selection process

Note this topology is not a full mesh, as R1 was not issued with the BGP neighbor command to R4, so we have iBGP on the NBMA and R4 is off in its own AS 4 with eBGP Peerings to both R2 and R3.

Also, the only advertised route at this time is the Lo4 on R4 of 4.4.4.4/32.

First lets check out R4 to ensure everything is good to go on there:

R4#sh ip bgp
BGP table version is 2, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
              r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter
Origin codes: i – IGP, e – EGP, ? – incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 4.4.4.4/32         0.0.0.0                         0                    32768  i
R4#

So we can see the default weight, and default next hop of 0.0.0.0 meaning the route is local to this router. Now let’s check to make sure Peerings to R2 and R3 are running:

R4#sh ip bgp summ
BGP router identifier 4.4.4.4, local AS number 4
BGP table version is 2, main routing table version 2
1 network entries using 136 bytes of memory
1 path entries using 56 bytes of memory
1/1 BGP path/bestpath attribute entries using 128 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 320 total bytes of memory
BGP activity 1/0 prefixes, 1/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
172.12.23.2     4          123      22      24        2    0    0 00:18:14        0
172.12.23.3     4          123      22      26        2    0    0 00:18:15        0
R4#

It does appear to be good to go, so I’ll jump to both R2 and R3 quick to make sure they can also see the route advertisement from R4:

R2#sh ip bgp
BGP table version is 2, local router ID is 2.2.2.2
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
*> 4.4.4.4/32       172.12.23.4              0                                  0 4 i
R2#
ASR#3
[Resuming connection 3 to r3 … ]

R3#sh ip bgp
BGP table version is 2, local router ID is 3.3.3.3
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
*> 4.4.4.4/32       172.12.23.4              0                                  0 4 i
R3#

That is looking good as well, how about we forget this whole exam thing and just award me my CCNP? No? Fine. Lets take a gander at R1 and see what how its looking in this scenario:

R1#sh 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       172.12.23.4              0           100                0 4 i
* i                         172.12.23.4              0           100                0 4 i
R1#sh ip bgp 4.4.4.4
BGP routing table entry for 4.4.4.4/32, version 0
Paths: (2 available, no best path)
  Not advertised to any peer
  4
    172.12.23.4 (inaccessible) from 172.12.123.3 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, internal
  4
    172.12.23.4 (inaccessible) from 172.12.123.2 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, internal
R1#

A couple of things to note here, we obviously have no best path *> in our ip bgp table, the behavior of an iBGP advertising a route from a remote AS to another iBGP Speaker is apparent by the Next Hop of 172.12.23.4, and when looking at the extended ip bgp route command it shows inaccessible because R1 does not have a route to get to that network because BGP is not an IGP.

So this poses a question, what could be done to remedy this issue from configuring another router other than R1?

The answer = “neighbor … next-hop-self” command on R2 and R3! (I actually completely forgot about that, excellent review here!!)

R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#router bgp 123
R2(config-router)#neighbor 172.12.123.1 next-hop-self
R2(config-router)#
ASR#3
[Resuming connection 3 to r3 … ]

R3#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R3(config)#router bgp 123
R3(config-router)#neighbor 172.12.123.1 next-hop-self
R3(config-router)#^Z
R3#
*Mar  2 17:17:58.423: %SYS-5-CONFIG_I: Configured from console by console
R3#
ASR#1
[Resuming connection 1 to r1 … ]

R1#sh 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#
R1#sh 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
R1#

Once again I believe I am putting my foot in my mouth by saying RID is almost never the tie breaker, because once again in this situation, the best path was chosen by RID as all other attributes are equal (for now).

*** One vital twist on the command “clear ip bgp * soft out” can be issued on R1 if you don’t see the Next Hops changing, which is “clear ip bgp * soft in” to refresh incoming routes***

I didn’t need this command as R1 updated properly because I issued “clear ip bgp * soft out” on both R2 and R3, however you can issue “out” on the remote BGP Peer or “in” on the local BGP Speaker to refresh route advertisements for Best Path selection.

So now that everything is all fine and good in our network, lets look at adjust the Weight attribute for some Best Path manipulation, shall we?

Again, a very important note, changing the weight is locally significant to the local router only, not to iBGP Peers as well like we saw with Local Preference.

Now to adjust weights, as seen in previous output from the very end of my last post, you will need to use the neighbor command to assign them weights on the local router to adjust Path Selection as needed.

Another important detail about changing weights locally, is all routes advertised from the neighbor specified in the command will then have that weight attribute added to the routes that BGP Peer advertises to the local router.

So one more look at the current ip bgp table:

R1#sh 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#

Now to demonstrate not only how to change the weights, but to use the new twist on our clear ip bgp command to change the table up:

R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#router bgp 123
R1(config-router)#neighbor 172.12.123.3 weight 200
R1(config-router)#^Z
R1#
*Mar 31 13:12:18.789: %SYS-5-CONFIG_I: Configured from console by console
R1#sh 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 in
R1#sh 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
R1#

As seen the Best Path has changed, as well as the weight attribute from that Next Hop, and it worked exactly as it should!

An interesting note is running “sh ip bgp 4.4.4.4” :

R1#sh ip bgp 4.4.4.4
BGP routing table entry for 4.4.4.4/32, version 3
Paths: (2 available, best #1, table Default-IP-Routing-Table)
  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, weight 200, valid, internal, best
  4
    172.12.123.2 from 172.12.123.2 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, internal
R1#

Weight is now included in the extended command attributes for the Best Path, and that is the only time you will see a weight there, is when you change it.

I will work with weights a bit more, but now we are introducing R5 back into the mix, so I will whip up a new quick diagram and continue my ramblings on the next post shortly!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s