BGP · · 3 min read

Cisco BGP Weight Attribute: Local Path Preference

Weight is the first step of Cisco BGP best-path selection, Cisco-proprietary, never advertised, and local to the router. The most targeted BGP traffic engineering tool when you need one router to override AS-wide policy.

Cisco BGP Weight Attribute: Local Path Preference - PingLabz BGP article title card

Weight is the first attribute evaluated in Cisco's BGP best path selection algorithm - before local preference, before AS-path length, before everything. It's Cisco-proprietary, never advertised to any peer, and only affects the local router. This makes it the most targeted BGP traffic engineering tool: when you need one specific router to override the AS-wide local-pref decision, weight is your tool.

New to BGP? Start with the full BGP guide, then come back here for the deep dive.

Weight Basics

  • Range: 0 to 65535
  • Default: 32768 for locally originated routes, 0 for all learned routes
  • Higher wins: The path with the highest weight is selected at step 1
  • Scope: Local to the router only - never sent to any peer (iBGP or eBGP)
  • Cisco-only: Not part of the BGP standard (RFC 4271). Other vendors don't have this attribute.

Step 1 is worth dwelling on. Weight is evaluated before anything else, so a weight set on one router quietly settles the decision without local preference, AS-path or MED getting a vote at all, and the full decision order with live output shows how far down the list the evaluation normally has to travel.

Configuration Methods

Method 1: Per-Neighbor Weight

Set weight for all routes from a specific neighbor:

R1-HQ(config)# router bgp 65001
R1-HQ(config-router)# neighbor 172.16.0.2 weight 200

All routes from ISP-A get weight 200. Routes from ISP-B (default weight 0) lose at step 1. This is the simplest approach when you want all traffic from one router to prefer a specific ISP.

Method 2: Route Map (Selective Weight)

Set weight for specific prefixes using a route-map:

ip prefix-list HIGH-PRIORITY seq 10 permit 100.64.0.0/18
!
route-map SET-WEIGHT permit 10
 match ip address prefix-list HIGH-PRIORITY
 set weight 300
!
route-map SET-WEIGHT permit 20
! Everything else keeps default weight 0
!
router bgp 65001
 neighbor 172.16.0.2 route-map SET-WEIGHT in

When to Use Weight vs Local-Pref

AS-wide path preference
Use Weight
Use Local-Pref
Yes - propagates via iBGP
Single-router override
Use WeightYes - local only
Use Local-Pref
Override local-pref from iBGP peer
Use Weight
Yes - evaluated before local-pref
Use Local-Pref
Multi-vendor environment
Use WeightNo - Cisco only
Use Local-Pref
Yes - standard attribute

A common scenario: your network-wide policy (via local-pref) says "prefer ISP-A for everything." But one specific branch router is physically closer to ISP-B and should use ISP-B for latency-sensitive traffic. Set weight on that router to override the AS-wide local-pref decision without changing it for everyone else.

Verification

R1-HQ# show ip bgp 100.64.0.0/18
BGP routing table entry for 100.64.0.0/18, version 26
Paths: (2 available, best #1, table default)
  65010
    172.16.0.2 from 172.16.0.2 (203.0.113.1)
      Origin IGP, metric 0, localpref 100, weight 200, valid, external, best
  65020 65010
    172.16.0.6 from 172.16.0.6 (198.51.100.1)
      Origin IGP, metric 0, localpref 100, weight 0, valid, external

Path via ISP-A wins with weight 200 vs 0 - decided at step 1, before local-pref is even evaluated.

R1-HQ# show ip bgp neighbors 172.16.0.2 | include weight
  Default weight 200

Weight and Route Reflectors

Since weight is never advertised, route reflectors don't propagate it. If R1-HQ sets weight 200 for ISP-A routes, R2-HQ (learning the same routes via iBGP from R1-HQ) will NOT see weight 200 - it sees weight 0 (the default for learned routes). This is expected and desirable - weight is intentionally per-router.

Troubleshooting

Weight set but path not changing
Cause
Both paths have the same weight (e.g., both from eBGP peers with default weight 0)
Fix
Verify weight values with show ip bgp [prefix]. Ensure the weight is set on the correct neighbor or via route-map.
Weight affecting wrong prefixes
Cause
Per-neighbor weight applies to ALL routes from that neighbor
Fix
Use a route-map for selective weight instead of per-neighbor weight.
Weight not overriding iBGP path
Cause
Weight is 0 for iBGP-learned routes by default - but locally originated routes have weight 32768
Fix
If you need an iBGP-learned route to win over a locally originated one, set weight higher than 32768 via route-map.

Key Takeaways

  • Weight is Cisco-proprietary, evaluated at step 1 (before local-pref), and only affects the local router.
  • Higher weight wins. Default is 32768 for local routes, 0 for learned routes.
  • Use weight for per-router overrides when you can't or don't want to change the AS-wide local-pref policy.
  • Weight is never advertised - iBGP peers, eBGP peers, and route reflectors don't see or propagate it.
  • In multi-vendor environments, avoid weight - use local-pref (the standard equivalent) instead.

Read next

Terminal card showing a repeating CDP native VLAN mismatch log naming Ethernet0/0 native VLAN 1 against SW2 Ethernet0/0 native VLAN 99
VLANs ·

Native VLAN Mismatch: Read the CDP Log, Fix the Trunk

%CDP-4-NATIVE_VLAN_MISMATCH hands you both interfaces and both native VLANs in one line. The real damage is underneath it: untagged frames get re-homed at the trunk boundary and two VLANs quietly become one. Captured live on IOS XE 17.18.2 in CML.