Introduction
In the previous posts, I’ve covered Local Preference for AS-wide outbound traffic control and MED for influencing inbound traffic from neighbors. Both attributes affect routing decisions across multiple routers – Local Preference coordinates exit point selection throughout your entire AS, while MED suggests entry points to neighboring ASes.
But what if you need to make a routing decision that affects only one specific router without changing anyone else’s behavior?
That’s where Weight comes in. It’s Cisco’s proprietary attribute that sits at the very top of the BGP best-path algorithm, overriding even Local Preference. Weight is completely local to a single router – it’s never advertised to any neighbor, iBGP or eBGP. This makes it perfect for router-specific policy without the coordination overhead.
Understanding Weight
What is Weight?
Weight is a BGP path attribute with these characteristics:
- Cisco proprietary: Not part of the BGP standard, only exists on Cisco routers
- Numeric value: Range 0-65535. Higher values are preferred.
- Default: 0 for learned routes, 32768 for locally originated routes
- Scope: Single router only – never leaves the local router
- Direction: Controls outbound traffic (like Local Preference)
- Propagation: None – Weight is not sent to any neighbor
Why Weight Matters
Weight fills a specific niche in BGP traffic engineering:
- Exception handling: One router needs different routing from the rest of the AS
- Testing: Try out routing changes on one router before deploying AS-wide
- Troubleshooting: Quickly override normal path selection for diagnosis
- Router-specific requirements: Hardware, capacity, or policy reasons for local-only preference
Weight is your “nuclear option” for path selection – it wins against everything else. Use it sparingly and document carefully, because it creates invisible routing exceptions that can confuse troubleshooting.
BGP Best Path Selection with Weight
Weight is evaluated first in the BGP best-path algorithm:
- Weight (highest wins) ← Evaluated first, overrides everything
- Local Preference (highest wins)
- Locally originated routes
- AS-Path length (shortest wins)
- Origin type
- MED (lowest wins)
- eBGP over iBGP
- IGP metric to next-hop
- …additional tie-breakers
Since Weight is at step 1, it overrides:
- Local Preference (step 2)
- AS-Path length (step 4)
- MED (step 6)
- Everything else
This makes Weight incredibly powerful – and potentially dangerous if misused.
Default Weight Values
Understanding the default Weight assignments is critical:
Locally originated routes (network statement, redistribution):
Weight = 32768
Routes learned from any BGP neighbor (iBGP or eBGP):
Weight = 0
This default ensures that locally originated routes are always preferred over learned routes, which is usually the desired behavior.
Lab Topology
Same topology from the previous BGP attributes posts:
- AS 2000: R7, R8, R9 (iBGP mesh)
- R7 has Local Preference 200 set on routes from AS 1000 (from previous posts)
- R8 has eBGP connection to R4 (AS 1000)
- R9 has eBGP connection to R11 (AS 110)
The scenario: R8 receives routes from two sources:
- Via iBGP from R7 (with Local Preference 200)
- Via eBGP directly from R4 (with default Local Preference/Weight)
By default, R8 prefers routes via R7 due to the higher Local Preference. But what if R8 needs to make a different decision without affecting R7 or R9’s routing?
Initial State: The Local Preference Dominates
Before any Weight configuration, let’s see R8’s BGP table:
R8#sh ip bgp
Network Next Hop Metric LocPrf Weight Path
*>i 1.0.0.0 10.7.7.7 0 200 0 1000 12 i
* 192.1.48.4 0 1000 12 i
*>i 2.0.0.0 10.7.7.7 0 200 0 1000 12 i
* 192.1.48.4 0 1000 12 i
*>i 3.0.0.0 10.7.7.7 0 200 0 1000 i
* 192.1.48.4 0 1000 i
*>i 4.0.0.0 10.7.7.7 0 200 0 1000 i
* 192.1.48.4 0 0 1000 i
*> 8.0.0.0 0.0.0.0 0 32768 i
Key observations:
External networks (1.0.0.0, 2.0.0.0, 3.0.0.0, 4.0.0.0):
- Two paths: via 10.7.7.7 (R7, iBGP) and via 192.1.48.4 (R4, eBGP)
- Path via R7 has Local Preference 200
- Path via R4 has default Local Preference (blank in eBGP, effectively 100 after iBGP processing)
- Best path
>: via R7 due to higher Local Preference - Weight: 0 for both paths (default for learned routes)
Local network (8.0.0.0):
- Single path: 0.0.0.0 (locally originated via network statement)
- Weight: 32768 (default for locally originated routes)
- This is why local routes are always preferred
R8 is currently following the AS-wide policy: exit via R7 for all external destinations. But R8 has a direct link to R4 that’s sitting unused as a backup.
Example: Router-Specific Path Preference
Requirement
AS 2000 wants to use the link between R4 and R8 for all traffic locally generated on R8. This should NOT affect routing for the rest of the AS.
Translation:
- R8 should prefer its direct eBGP connection to R4 (Weight=80) over the iBGP routes from R7 (Local Preference=200)
- R7 and R9 should continue using R7’s connection (unaffected by R8’s Weight setting)
This is a perfect Weight scenario: override the AS-wide Local Preference policy on one router only.
Configuration
On R8, set Weight on routes received from R4:
route-map SET-ATT permit 10
set weight 80
router bgp 2000
neighbor 192.1.48.4 route-map SET-ATT in
Breaking it down:
- Route-map
SET-ATTsets Weight to 80 - Applied inbound on the eBGP neighbor 192.1.48.4 (R4)
- Weight of 80 > Weight of 0 (the default for routes from R7)
Critical: Weight must be set inbound on the neighbor session, similar to Local Preference. This sets the Weight before best-path selection runs.
Why Weight=80? Any value greater than 0 will work, since:
- Routes from R4 will have Weight=80
- Routes from R7 via iBGP still have Weight=0 (unchanged)
- Weight comparison happens before Local Preference, so Weight=80 beats LP=200
Results After Configuration
R8’s BGP table now shows:
R8#sh ip bgp
Network Next Hop Metric LocPrf Weight Path
* i 1.0.0.0 10.7.7.7 0 200 0 1000 12 i
*> 192.1.48.4 80 1000 12 i
* i 2.0.0.0 10.7.7.7 0 200 0 1000 12 i
*> 192.1.48.4 80 1000 12 i
* i 3.0.0.0 10.7.7.7 0 200 0 1000 i
*> 192.1.48.4 80 1000 i
* i 4.0.0.0 10.7.7.7 0 200 0 1000 i
*> 192.1.48.4 0 80 1000 i
* i 5.0.0.0 10.7.7.7 0 200 0 1000 i
*> 192.1.48.4 80 1000 i
* i 6.0.0.0 10.7.7.7 0 200 0 1000 ?
*> 192.1.48.4 80 1000 ?
*>i 7.0.0.0 10.7.7.7 0 100 0 i
*> 8.0.0.0 0.0.0.0 0 32768 i
*>i 9.0.0.0 10.9.9.9 0 100 0 i
The dramatic changes:
External networks now show:
- Weight=80 on paths via 192.1.48.4 (R4)
- Weight=0 (unchanged) on paths via 10.7.7.7 (R7)
- Best path
>moved from R7 to R4 for all external routes!
Even though routes via R7 still have Local Preference=200, they’re no longer best because Weight=80 (from R4) beats Weight=0 (from R7). Weight is evaluated first in the best-path algorithm, so it overrides Local Preference completely.
Internal AS 2000 networks (7.0.0.0, 9.0.0.0):
- No change – these come from iBGP only, no Weight set
- R8’s own network (8.0.0.0) still has Weight=32768
Weight Does Not Propagate
This is the critical difference between Weight and Local Preference. Check R9’s BGP table:
R9#sh ip bgp
Network Next Hop Metric LocPrf Weight Path
* i 1.0.0.0 10.8.8.8 0 100 0 1000 12 i
*>i 10.7.7.7 0 200 0 1000 12 i
* i 2.0.0.0 10.8.8.8 0 100 0 1000 12 i
*>i 10.7.7.7 0 200 0 1000 12 i
* i 3.0.0.0 10.8.8.8 0 100 0 1000 i
*>i 10.7.7.7 0 200 0 1000 i
* i 4.0.0.0 10.8.8.8 0 100 0 1000 i
*>i 10.7.7.7 0 200 0 1000 i
* i 5.0.0.0 10.8.8.8 0 100 0 1000 i
*>i 10.7.7.7 0 200 0 1000 i
* i 6.0.0.0 10.8.8.8 0 100 0 1000 ?
*>i 10.7.7.7 0 200 0 1000 ?
R9’s routing is completely unchanged:
- Best paths still via 10.7.7.7 (R7) with Local Preference 200
- No Weight values visible in routes learned from R8 (via 10.8.8.8)
- R9 never saw R8’s Weight=80 configuration
This is the key: Weight is never advertised in BGP updates. When R8 advertises routes to R9 via iBGP, the Weight attribute is stripped. R9 only sees the Local Preference (which came from R7 originally).
Traffic Flow Result
After this configuration:
R8:
- Sends traffic to AS 1000 via its direct link to R4 (192.1.48.4)
- Overrides the AS-wide Local Preference policy locally
R7 and R9:
- Continue using R7’s link to R4 (via 192.1.47.4)
- Follow the AS-wide Local Preference 200 policy
- Completely unaware of R8’s Weight configuration
This creates router-specific routing – R8 behaves differently from the rest of the AS, but only R8 knows about it.