BGP Weight Attribute

Understanding BGP Weight Attribute – The Complete Guide for Network Engineers

The BGP weight attribute is a Cisco-proprietary value used to influence the best path selection process on a local router. It is a numeric value ranging from 0 to 65535, where paths with higher weight values are preferred. Importantly, this weight attribute is local to the router it is configured on and is not advertised or propagated to any BGP neighbors, making it a locally significant but powerful tool for path preference within a single router’s routing decision.

Introduction to BGP Weight Attribute

The weight attribute is unique because it applies only to the router where it is set—it does not get passed to other routers in the BGP network, unlike other attributes such as local preference or AS path. This means the weight is a local preference used to choose between multiple paths to the same destination on that router. By default, routes directly originated by the router receive a weight of 32768, while routes learned from neighbors have a default weight of 0. The higher the weight, the more preferred the path is during the best path selection process.

Key Characteristics of BGP Weight

  • Local significance: Only impacts the router where configured; does not propagate.
  • Value range: 0 to 65535.
  • Default values: 32768 for locally originated routes, 0 for routes learned from neighbors.
  • Not advertised: Weight is strictly for internal path preference management.
  • First in path selection: Weight is evaluated before other path attributes like local preference.
image

You can set the Weight attribute in different ways.

1. Manually on a Neighbor Basis

You can configure Weight directly under the neighbor statement:

R3(config)# router bgp 65500
R3(config-router)# neighbor 12.1.1.1  weight 50

This means all routes learned from neighbor 12.1.1.1 will be assigned a Weight of 50.

2. Using Route Maps

For more fine-tuned control, you can set Weight using a route-map:

R3(config)# route-map SET-WEIGHT permit 10
R3(config-route-map)# set weight 50  
R3(config)# router bgp 65500
R3(config-router)# neighbor 12.1.1.1 route-map SET-WEIGHT in  

Here, only the routes permitted by the route-map get a Weight of 50.

image

conf t
interface g1/0
no shutdown
ip address 13.1.1.1 255.255.255.0

interface loopback0
ip address 8.8.8.8 255.255.255.255

router bgp 100
neighbor 13.1.1.3 remote-as 65500
network 8.8.8.8 mask 255.255.255.255
exit

conf t
interface g2/0
no shutdown
ip address 23.1.1.2 255.255.255.0

interface loopback0
ip address 8.8.8.8 255.255.255.255

router bgp 200
neighbor 23.1.1.3 remote-as 65500
network 8.8.8.8 mask 255.255.255.255
exit

conf t
interface g1/0
no shutdown
ip address 13.1.1.3 255.255.255.0
interface g2/0
no shutdown
ip address 23.1.1.3 255.255.255.0

router bgp 65500
neighbor 13.1.1.1 remote-as 100
neighbor 13.1.1.2 weight 50
neighbor 23.1.1.2 remote-as 200
neighbor 23.1.1.2 weight 60
exit

  1. Configure IP addresses on interfaces (use configs above).
  2. Configure BGP on R1, R2 and R3
  3. Verify neighbor adjacency
image
  • Check the BGP table on R3 – In this case, the Weight attribute appears as 0, which indicates that the route to 8.8.8.8 was learned from router R1 and has been assigned the default Weight value of 0.
image
image
  • Verify R3’s routing table
image
  • Test connectivity
image
  • Change weights to validate behaviour:

Now we will change the weight attribute at R3 router as per below config and later we will validate how the routing table change and R3 will select the route which is having the hight weight value

image

Now, let’s check the BGP routing table on R3. You’ll notice that the router is preferring the route from R2 because it has a higher Weight value.

image
image
image

Advantages and Limitations

  • Advantages:
    • Immediate and strong influence on path selection.
    • Simple numeric scale easy to understand.
    • Useful for local traffic engineering and testing.
  • Weight is a local, Cisco-only number (0-65535) influencing best path.
  • Highest weight path wins immediately, evaluated before local preference.
  • Default weight is 32768 for locally originated routes; 0 for learned routes.
  • Not sent to other routers; only affects the local router’s choice.
  • Used mainly for local outbound path preference control.
  • Weight is checked before Local Preference in Cisco’s BGP best-path decision process.
  • You can use Weight for:
    • Preferring one ISP link over another.
    • Controlling outbound traffic flow.
    • Quick testing or temporary policy adjustments (since it’s local).

The BGP Weight attribute is often the first line of control for path selection in Cisco environments. While it’s not a standard attribute, it’s simple, powerful, and perfect for influencing traffic locally without affecting the rest of your network.

Leave a Comment