BGP Weight Attribute is used in Cisco routers. In this post, with the below topology, we will look at why the BGP weight attribute is used, why it BGP weight shouldn't be used, advantages and disadvantages of the BGP weight attribute.
Cisco BGP Weight AttributeLet's first define what is BGP Weight attribute. BGP selects the best path based on the BGP path attributes. Weight is considered a very important tie-breaker in BGP's best-path selection. When there are two paths to any BGP destination prefix, the BGP Weight attribute is compared before BGP Local Preference and many other BGP Path attributes. Since this is not BGP's best path selection post, and assuming you already know the process, please note, Weight attribute is compared before even BGP Local Preference. But, let's have a look at the below topology to understand it better.
In the above topology, we want to use the left path for the prefixes in AS1, thus we have a higher BGP Local preference value. As the BGP Local preference value is exchanged internally between all IBGP neighbors, both left and right routers in AS65000, use the left exit point, which is Local Pref 100 to reach the prefixes in AS1.
Because on the other link BGP Local preference value is lower, 50. Why in the BGP Weight post, I am explaining BGP Local preference you might be asking. Because with that explanation, you will understand the reason for the BGP Weight attribute better. In the above topology, let's say we set the local preference value higher on the left link for all the prefixes in AS1, thus left link is used for those prefixes.So, if traffic arrives at a right router, it will send the traffic to the left router for the left router's uplink to be used.
But let's say, for the specific prefix, 188.8.131.52/24 subnet, we want to use the right router's uplink if the traffic arrives at the right router.This is done with the BGP Weight attribute. So, the left router for all the prefixes continues to use its uplink, including 192.168.0.0/24, but the right router, only for the 192.168.0.0/24 uses its own uplink, but the rest of the prefixes traffic is still sent to the left router. Because the BGP Weight attribute is local to the router, which means, it is not exchanged between the routers in the IBGP network, the BGP policy with the BGP Weight attribute just stays locally on the router.
BGP Weight Attribute might create a Routing Loop!With the BGP Weight attribute if you push the traffic to be sent towards the neighbor and if the neighbor with the Weight or another policy sends the traffic towards you, it created a permanent Routing loop. So be careful. You may have heard Micro loop if you have been following our blog posts but note that there can't be a micro loop with the distance vector protocols such as EIGRP and BGP.
Last but not least, as you can understand, BGP Weight attribute can be used for the Output path maniplautaion, also known as BGP Outbound Traffic Engineering.