How to Configure BGP Weight Attribute

Hello Akhil

You are correct that the weight attribute will affect the choice of path for outgoing traffic from the router on which it is configured. However, we must keep in mind that there is a distinction between incoming and outgoing traffic, and incoming and outgoing BGP updates, and I believe that this is where the confusion lies.

Now there are a couple of ways of configuring the weight attribute. The first is to assign a particular weight to a neighbor using a BGP command like this:

R1(config-router)#neighbor weight 500

This will cause all prefixes learned from the neighbor to be assigned a weight of 500. In other words, all incoming BGP updates from this neighbor will have their prefixes assigned a weight of 500. The result is that traffic destined to those prefixes (outgoing) will choose this route over another with a lower weight.

The other way to assign weight is to do so to a specific prefix using a route map on incoming BGP updates, something like this:

R1(config-router)#neighbor route-map SETWEIGHT in

where SETWEIGHT is a route-map. (See the lesson for more details). Now this route map is applied in an inward direction, but only in relation to the BGP updates. So this will be applied to prefixes of incoming BGP updates from this particular neighbor. However, it is the routing of the outgoing traffic that will be affected by these changes.

I hope this has been helpful!