BGP Path Attributes – Weight
Weight attribute is a Cisco proprietary attribute that is the first step in the BGP Best Path selection algorithm. In Cisco devices, BGP firstly check the weight value and prefer the highest weight value. Then BGP Best Path selection continues with Local Preference and so on. If the device is not Cisco, weight is not important for you. You will start directly with Local Preference value to select the BGP Best Path in all other vendor products.
During Weight attribute configuration, different interfaces of the router are assigned different weight values. The interface with the highest Weight value is selected and the traffic goes through this interface. Weight value is local on a router that it is configured and it does not exchanged between routers.
The highest Weight value is selected always as BGP Best Path or Best Route, if there are multiple routes to the same destination.
Weight value can be between 0 and 65535. By default the learned routes has a weight value 0. This default value is 32768 for locally injected routes.
Weight attribute can be assigned in three ways:
• By neighbor command
• By AS-Path Access-Lists
• By Route Maps
Let’s give an example for each of these ways. As a reference topology, we will use the below basic topology:
By neighbour command, you can assign these values like below:
Here, the ip addresses is not showed in picture, because this is not our main concentrated point.
By doing this, you are saying to the RouterA that, Best BGP Path is through RouterD. “Go through Router D”.
You can also configure the same properties by using AS-Path Access-Lists. The AS-Path Access-Lists configuration of the same weight configuration is like below: