BGP · · 3 min read

Cisco BGP Weight Attribute: Local Path Preference

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.

Weight Basics

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

ScenarioUse WeightUse Local-Pref
AS-wide path preferenceYes — propagates via iBGP
Single-router overrideYes — local only
Override local-pref from iBGP peerYes — evaluated before local-pref
Multi-vendor environmentNo — Cisco onlyYes — 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

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

Key Takeaways

Read next

© 2025 Ping Labz. All rights reserved.