BGP attributes: Weight

weight1

Facts about BGP weight attribute

  1. Cisco proprietary. Only available for Cisco routers, this attribute is not included in BGP update message.
  2. Because it is not included in update message, this attribute is only locally significant to one router.
  3. Because it is locally significant and only the configured router knows the weight, it is only viable for a Cisco router with more than one link peering to different BGP neighbors.
  4. This attribute is used to influence OUTBOUND traffic from the configured Cisco router. Higher weight is preferred.
  5. Weight attribute is the first attribute for Cisco router to “consider” for best BGP paths.
  6. Weight is applied to the inbound BGP routing updates in order to influence the OUTBOUND traffic.

Original BGP before weight is configured


R1#sh ip bgp | b Net
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 0.0.0.0 0 32768 i
* 22.22.22.0/24 192.168.13.3 0 2 i
*> 192.168.12.2 0 0 2 i
* 33.33.33.0/24 192.168.13.3 0 0 2 i
*> 192.168.12.2 0 2 i
*> 192.168.12.0/27 0.0.0.0 0 32768 i
*> 192.168.13.0/27 0.0.0.0 0 32768 i
R1#

weight2.png

So to reach 22.22.22.0/24 and 33.33.33.0/24 R1 will use R2, it is sensible for R1 to reach 22.22.22.0/24 via R2 since this prefix is a directly connected network for R2.

33.33.33.0/24 however is best reach via R3; this prefix is a directly connected network of R3.

Influence outbound traffic using weight on a neighbor


R1(config)#router bgp 1
R1(config-router)#neighbor 192.168.13.3 weight 500

So what happens?

weight3.png

-_-” duh…. this is not what I want… I want 22.22.22.0/24 via R2 and 33.33.33.0/24 via R3. So applying weight on neighbors is not viable in this requirement.

Use route-map for more granularity on selecting outbound path with weight


R1(config)#access-list 33 permit 33.33.33.0 0.0.0.255
R1(config)#route-map R1->33 permit 10
R1(config-route-map)#match ip address 33
R1(config-route-map)#set weight 500
R1(config-route-map)#route-map R1->33 permit 20
R1(config-route-map)#set weight 0
R1(config-route-map)#router bgp 1
R1(config-router)#neighbor 192.168.13.3 route-map R3->33 in

weight4.png

Using route-map is more granular, base on prefix i can choose which path to reach by using route-map with weight attribute.

Advertisement

2 thoughts on “BGP attributes: Weight

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