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
- 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.
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 200All 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 inWhen to Use Weight vs Local-Pref
| Scenario | Use Weight | Use Local-Pref |
|---|---|---|
| AS-wide path preference | Yes — propagates via iBGP | |
| Single-router override | Yes — local only | |
| Override local-pref from iBGP peer | Yes — evaluated before local-pref | |
| Multi-vendor environment | No — Cisco only | 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, externalPath 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 200Weight 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
| Symptom | Cause | Fix |
|---|---|---|
| Weight set but path not changing | Both 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 prefixes | Per-neighbor weight applies to ALL routes from that neighbor | Use a route-map for selective weight instead of per-neighbor weight. |
| Weight not overriding iBGP path | Weight is 0 for iBGP-learned routes by default — but locally originated routes have weight 32768 | 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.