Day 16 — BGP AS_PATH: Loop Prevention, Path Length and Controlled Prepending

Learning objective

Read and interpret AS_PATH, explain its role in autonomous-system loop prevention and best-path selection, apply controlled prepending, and diagnose a policy that makes a normally preferred path unnecessarily long.


BGP AS_PATH: Loop Prevention, Path Length and Controlled Prepending
BGP AS_PATH: Loop Prevention, Path Length and Controlled Prepending



1. Opening — BGP remembers the autonomous systems a route crossed

Unlike an IGP metric, AS_PATH is not a measurement of latency, bandwidth or geographic distance. It is a record of autonomous-system path information carried with the route.

Each eBGP hop normally adds its AS number as the route crosses an AS boundary. When a BGP speaker sees its own AS in the received path, the ordinary loop-prevention behavior is to reject the route rather than accept a path that has already traversed the local AS.

Cisco's best-path algorithm also uses AS_PATH length: after earlier attributes such as Weight, LOCAL_PREF and local origination, a shorter AS path is normally preferred.

These two roles—loop prevention and path selection—must not be confused.


2. AS_PATH is not a latency metric

Suppose two candidate routes are:

Path A: 65010 65100
Path B: 65020 65030 65100

BGP sees Path A as shorter in AS sequence length. That does not prove Path A has lower latency or more available bandwidth. It simply crosses fewer AS_SEQUENCE entries for the comparison.

Policy may intentionally prefer the longer AS path through higher LOCAL_PREF, and that would be completely valid because LOCAL_PREF is evaluated earlier in Cisco's sequence.

Never explain BGP as “always choosing the shortest AS path.”


3. Loop prevention

RFC 4271's AS_PATH processing provides inter-AS loop detection. When a BGP speaker receives an UPDATE containing its own AS in the AS_PATH, normal processing prevents that route from being accepted as a loop-free external path.

There are specialized mechanisms such as allowas-in and migration-related local-AS features that alter default behavior in controlled designs. Those belong in later migration and advanced-policy posts.

For normal eBGP:

> Seeing your own AS in the path is a strong loop signal.


4. AS_SEQUENCE and modern AS_SET warning

The common path you read in operational tables is an ordered AS_SEQUENCE.

Older BGP aggregation designs could create AS_SET path segments. However, RFC 9774, published in May 2025, prohibits originating new AS_SET and AS_CONFED_SET segments. Day 11 already incorporated that current standards change.

Therefore this series will not recommend AS_SET-based aggregation as modern design practice.


5. Prepending

AS-path prepending intentionally adds repeated AS numbers so a path appears longer to remote BGP decision processes.

Example:

Normal:    65010 65100
Prepended: 65010 65010 65010 65100

Prepending is commonly used to influence inbound traffic by making one advertisement less attractive to external networks.

But it is a weak signal compared with higher-priority policy in the remote AS. A provider can use LOCAL_PREF to prefer the prepended route anyway.

Prepending therefore influences; it does not command.


6. Scenario — Summit Path-Length Shift

Illustrative lab — not a real incident.

Topology

                 Service S
                 AS65100
                 /      \
                /        \
          P1 AS65010    P2 AS65020
              |             |
              | eBGP        | eBGP
              +------ E -----+
                   AS65050

Service router S originates 192.0.2.128/25 and advertises it to both providers.

Enterprise E receives:

  • via P1: 65010 65100
  • via P2: 65020 65100

The paths have equal AS-path length before modification.

Controlled change

P1 prepends its own AS twice on the advertisement toward E.

Expected P1 path becomes conceptually:

65010 65010 65010 65100

P2 remains shorter and can become preferred if earlier attributes tie.


7. Prerequisites

  • Four routers.
  • eBGP S–P1, S–P2, P1–E and P2–E.
  • Documentation-safe point-to-point addressing.
  • All next hops reachable.
  • Equal Weight and LOCAL_PREF at E.

The topology is deliberately small; it models path policy rather than a real Internet transit business relationship.


8. Topic-specific configuration excerpt

Service S — AS65100

ip route 192.0.2.128 255.255.255.128 Null0
!
router bgp 65100
 bgp router-id 10.51.0.1
 neighbor 192.0.2.1 remote-as 65010
 neighbor 198.51.100.1 remote-as 65020
 address-family ipv4 unicast
  network 192.0.2.128 mask 255.255.255.128
  neighbor 192.0.2.1 activate
  neighbor 198.51.100.1 activate
 exit-address-family

P1 — AS65010

route-map PREPEND-TO-E permit 10
 set as-path prepend 65010 65010
!
router bgp 65010
 neighbor 192.0.2.2 remote-as 65100
 neighbor 203.0.113.2 remote-as 65050
 address-family ipv4 unicast
  neighbor 192.0.2.2 activate
  neighbor 203.0.113.2 activate
 exit-address-family

Do not apply PREPEND-TO-E yet in the baseline.

P2 — AS65020

router bgp 65020
 neighbor 198.51.100.2 remote-as 65100
 neighbor 203.0.113.6 remote-as 65050
 address-family ipv4 unicast
  neighbor 198.51.100.2 activate
  neighbor 203.0.113.6 activate
 exit-address-family

E — AS65050

router bgp 65050
 neighbor 203.0.113.1 remote-as 65010
 neighbor 203.0.113.5 remote-as 65020
 address-family ipv4 unicast
  neighbor 203.0.113.1 activate
  neighbor 203.0.113.5 activate
 exit-address-family

The lab package provides the full interface plan.


9. Verification before modification

At E:

show ip bgp 192.0.2.128
show ip bgp regexp _65100$
show ip route 192.0.2.128 255.255.255.128

At P1:

show ip bgp 192.0.2.128
show ip bgp neighbors 203.0.113.2 advertised-routes

Capture the original AS_PATH through each provider.

Because the two path lengths are equal, do not claim which path wins the remaining tie-breakers before observing the actual lab.


10. Controlled modification — prepend P1 toward E

On P1:

configure terminal
router bgp 65010
 address-family ipv4 unicast
  neighbor 203.0.113.2 route-map PREPEND-TO-E out
end

Use a safe outbound refresh so the changed advertisement is sent.

Expected result

At E, the route through P1 should show additional 65010 entries. If all earlier selection attributes tie, the route through P2 now has the shorter AS_PATH and should be preferred.


11. Fault injection

Illustrative lab — not a real incident.

Lab name

Summit Excessive Prepend

Fault

An operator intends to add two prepends but adds six repeated AS numbers instead.

route-map PREPEND-TO-E permit 10
 set as-path prepend 65010 65010 65010 65010 65010 65010

Expected impact

The P1 advertisement becomes much less attractive to networks that consider AS_PATH length at the relevant stage.

Important caveat

The change may have no effect in a remote AS that deliberately gives the P1 route higher LOCAL_PREF. That is not a BGP failure; it is remote policy winning earlier.


12. Troubleshooting sequence

  1. Confirm the exact prefix and both candidate paths.
  2. Verify next-hop reachability.
  3. Check Weight and LOCAL_PREF before blaming AS_PATH.
  4. Read the AS_PATH on the receiving router.
  5. Identify whether repeated ASNs are natural transit hops or intentional prepends.
  6. Inspect outbound route maps on the advertising edge.
  7. Confirm the route-map scope: neighbor, direction and address family.
  8. Compare intended versus actual number of prepends.
  9. Remove or reduce the smallest incorrect policy.
  10. Refresh safely and verify the path returns to the intended ranking.

13. Root cause and correction

Root cause

An outbound route map on P1 made its path substantially longer than intended.

Correction

Reduce the prepend count or remove the route map if no de-preference is required.

route-map PREPEND-TO-E permit 10
 set as-path prepend 65010 65010

Why it works

The receiving BGP speaker sees a shorter path through P1 than it saw during the fault, allowing the normal decision hierarchy to evaluate the revised path.


14. Post-fix verification

At E:

show ip bgp 192.0.2.128
show ip route 192.0.2.128 255.255.255.128

At P1:

show route-map PREPEND-TO-E
show ip bgp neighbors 203.0.113.2 advertised-routes

If the purpose is real inbound traffic engineering, supplement route-table verification with flow/telemetry evidence. A BGP best path does not alone prove how all remote networks will send traffic.


15. Rollback

router bgp 65010
 address-family ipv4 unicast
  no neighbor 203.0.113.2 route-map PREPEND-TO-E out

Preserve the route-map and before/after path evidence before rollback if an incident investigation is active.


16. Production lessons

Protocol lesson

AS_PATH provides autonomous-system path information and loop prevention; it is not a performance metric.

Policy lesson

Shortest AS_PATH matters only after earlier path-selection criteria tie.

Traffic-engineering lesson

Prepending is an influence mechanism for remote selection, not a guarantee.

Security lesson

Unexpected AS_PATH changes can indicate leaks, hijacks, misconfiguration or migration behavior. Compare against expected routing relationships.

Standards lesson

Do not design new aggregation around AS_SET/AS_CONFED_SET; RFC 9774 now prohibits their origination.


16A. Prepending strategy and its limits

A prepend count should be chosen from evidence, not folklore. “Prepend three times” is not a protocol rule. The useful count depends on competing paths and the remote networks whose decisions matter.

A disciplined process is:

  1. Measure the normal AS_PATHs seen from representative external vantage points.
  2. Identify which remote ASes actually send the traffic of interest.
  3. Check whether your provider offers BGP communities that change LOCAL_PREF inside the provider; those can be more predictable than blind prepending.
  4. Apply the minimum prepend needed to create the intended relative difference.
  5. Observe route collectors, provider looking glasses or telemetry where authorized.
  6. Roll back if the change shifts traffic farther than intended.

The same prepend can produce different results in different remote ASes because each AS owns its own policy.

Do not prepend somebody else's ASN casually

Operational policy normally prepends the local ASN to make the local advertisement less attractive. Adding arbitrary third-party ASNs can create misleading path information and trigger loop prevention or filtering. Specialized migration features can alter AS-path construction, but those require their own design treatment.

More prepends can reduce resilience

If an alternate path is made excessively unattractive, some remote networks may keep using another path even after conditions change, depending on their available routes and policy. Prepending should therefore be tested not only in the healthy state but also during primary-path failure and restoration.


17. Knowledge check

Q1

Why might a longer AS_PATH still be selected?

Answer: A higher-priority criterion such as Weight or LOCAL_PREF can prefer it before AS_PATH length is evaluated.

Q2

What is the basic loop-prevention signal in ordinary eBGP AS_PATH processing?

Answer: The receiving BGP speaker sees its own AS number already present in the AS_PATH and rejects the looping route under normal behavior.

Q3

Does prepending force every remote AS to avoid the prepended path?

Answer: No. Remote policy such as LOCAL_PREF can override the AS_PATH-length preference.


18. Sources

  1. RFC 4271 — *A Border Gateway Protocol 4 (BGP-4)* — AS_PATH attribute, loop prevention and Decision Process.
  2. Cisco — *IP Routing Configuration Guide, Cisco IOS XE 17.18.x: Configuring BGP* — shortest AS path in Cisco best-path selection.
  3. Cisco — *Connecting to a Service Provider Using External BGP, IOS XE 17.x* — AS-path policy examples.
  4. RFC 9774 — *Deprecation of AS_SET and AS_CONFED_SET in BGP* — current prohibition on originating those path segment types.

Accessed: 2026-08-11.


Day 14 — BGP LOCAL_PREF: Building an AS-Wide Outbound Exit Policy

Learning objective

Use LOCAL_PREF to create a consistent preferred exit throughout an autonomous system, verify that the attribute is propagated to iBGP peers but not ordinary eBGP peers, and correct a conflicting edge policy.


BGP LOCAL_PREF
BGP LOCAL_PREF



1. Opening — policy must travel farther than one router

Weight solved a local problem on Day 13. LOCAL_PREF solves a different problem: several routers inside one AS need to agree on the preferred outbound exit.

Consider an enterprise with two edge routers. Edge E1 connects to ISP-A and Edge E2 connects to ISP-B. A core router C1 learns both Internet paths through iBGP. The enterprise wants traffic to prefer E1 during normal operation but retain E2 as a backup.

A local-only Weight change on E1 cannot communicate that preference to C1. LOCAL_PREF can.

RFC 4271 defines LOCAL_PREF as a well-known discretionary attribute used inside an AS. Higher LOCAL_PREF is preferred. In ordinary eBGP operation, LOCAL_PREF is not sent to external peers; it is an internal policy signal.


2. What LOCAL_PREF represents

LOCAL_PREF answers an internal policy question:

> “Which exit does this AS prefer for this route?”

It does not tell a remote AS how to enter your network. It tells routers inside your AS how strongly they should prefer a path relative to another path.

Cisco IOS XE documentation uses a default local preference of 100 when no different policy is applied. Operators often use values such as 200 for primary, 150 for secondary and 100 for default, but those numbers are conventions—not protocol-mandated tiers.

The only protocol rule that matters for selection is that the higher LOCAL_PREF wins, assuming the paths are eligible and no earlier Cisco-specific Weight decision has already separated them.


3. Propagation boundary

RFC 4271 requires LOCAL_PREF to be included in UPDATEs to internal peers and prohibits including it in ordinary UPDATEs sent to external peers, except for the special case of BGP confederations.

Operationally:

ISP-A ---> E1 -- LOCAL_PREF 200 --> C1
ISP-B ---> E2 -- LOCAL_PREF 100 --> C1

C1 can make the same preferred-exit decision as the edge routers because the policy value travels through iBGP.

This is why LOCAL_PREF is the canonical BGP tool for outbound exit selection inside an AS.


4. Where to set LOCAL_PREF

The cleanest pattern is usually to classify the route at the ingress edge where it enters the AS.

For example:

route-map ISP-A-IN permit 10
 set local-preference 200
!
router bgp 65030
 address-family ipv4 unicast
  neighbor 192.0.2.1 route-map ISP-A-IN in

The route then carries LOCAL_PREF 200 when E1 advertises it to iBGP peers.

Cisco also provides bgp default local-preference to change the default local preference on a router, but broad defaults deserve caution because they can alter many routes at once.


5. Scenario — Meridian Preferred Exit

Illustrative lab 

Topology

BGP LOCAL_PREF: Building an AS-Wide Outbound Exit Policy
BGP LOCAL_PREF: Building an AS-Wide Outbound Exit Policy



 ISP-A R1                 ISP-B R2
 AS65010                  AS65020
    | eBGP                   | eBGP
    |                        |
 E1 ----------------------- E2
 AS65030        iBGP        AS65030
   \                         /
    \        iBGP           /
             C1
          AS65030

Use documentation-safe transit addressing:

  • R1–E1: 192.0.2.0/30
  • R2–E2: 198.51.100.0/30
  • E1–C1: 203.0.113.0/30
  • E2–C1: 203.0.113.4/30
  • E1–E2: 203.0.113.8/30

Both providers advertise lab prefix 192.0.2.128/25.

Objective

  • E1 sets LOCAL_PREF 200 on the ISP-A path.
  • E2 leaves the ISP-B path at 100.
  • Both edges use next-hop-self toward C1 for this foundation lab.
  • C1 prefers E1.
  • Removing E1's policy causes C1 to return to later tie-breakers.

6. Prerequisites

  • Five logical roles: R1, R2, E1, E2 and C1.
  • IOS XE-compatible lab nodes for enterprise BGP roles.
  • Full-mesh iBGP among E1, E2 and C1 for this small topology.
  • Reachable iBGP next hops.
  • Both provider paths otherwise constructed to be comparable.

Route reflectors are intentionally deferred to the iBGP-scaling module.


7. Topic-specific configuration excerpt

The complete interface underlay is stored in the companion lab files. The policy-relevant configuration is shown here.

E1

ip prefix-list LAB-SERVICE permit 192.0.2.128/25
!
route-map ISP-A-IN permit 10
 match ip address prefix-list LAB-SERVICE
 set local-preference 200
route-map ISP-A-IN permit 20
!
router bgp 65030
 neighbor 192.0.2.1 remote-as 65010
 neighbor 203.0.113.2 remote-as 65030
 neighbor 203.0.113.10 remote-as 65030
 address-family ipv4 unicast
  neighbor 192.0.2.1 activate
  neighbor 192.0.2.1 route-map ISP-A-IN in
  neighbor 203.0.113.2 activate
  neighbor 203.0.113.2 next-hop-self
  neighbor 203.0.113.10 activate
  neighbor 203.0.113.10 next-hop-self
 exit-address-family

E2

router bgp 65030
 neighbor 198.51.100.1 remote-as 65020
 neighbor 203.0.113.6 remote-as 65030
 neighbor 203.0.113.9 remote-as 65030
 address-family ipv4 unicast
  neighbor 198.51.100.1 activate
  neighbor 203.0.113.6 activate
  neighbor 203.0.113.6 next-hop-self
  neighbor 203.0.113.9 activate
  neighbor 203.0.113.9 next-hop-self
 exit-address-family

C1

router bgp 65030
 neighbor 203.0.113.1 remote-as 65030
 neighbor 203.0.113.5 remote-as 65030
 address-family ipv4 unicast
  neighbor 203.0.113.1 activate
  neighbor 203.0.113.5 activate
 exit-address-family

The exact interface mapping in the lab package must match these neighbor addresses before execution.


8. Verification before policy

On C1:

show ip bgp 192.0.2.128
show ip bgp summary
show ip route 203.0.113.1
show ip route 203.0.113.5

On E1 and E2:

show ip bgp 192.0.2.128
show ip bgp neighbors <internal-peer> advertised-routes

Record the baseline before setting LOCAL_PREF 200. Do not assume which equal path wins before policy; late tie-breakers can depend on IDs and arrival order.


9. Controlled modification

Apply the inbound route map on E1 and use a safe inbound refresh if needed.

Expected path logic:

ISP-A path enters E1
        |
set LOCAL_PREF 200
        |
iBGP advertisement to C1
        |
C1 compares 200 versus 100
        |
C1 prefers E1 exit

Verify on C1:

show ip bgp 192.0.2.128
show ip route 192.0.2.128 255.255.255.128

The path via E1 should display the higher LOCAL_PREF and become best if Weight is equal and both paths remain eligible.


10. Fault injection

Illustrative lab — not a real incident.

Lab name

Meridian Split Policy

Fault

E2 accidentally applies LOCAL_PREF 250 to the ISP-B path while E1 applies 200.

route-map ISP-B-IN permit 10
 set local-preference 250
!
router bgp 65030
 address-family ipv4 unicast
  neighbor 198.51.100.1 route-map ISP-B-IN in

Expected symptom

C1 prefers E2, even though documentation says ISP-A is primary.

Misleading symptom

Both edge sessions are healthy. There is no protocol failure. The problem is policy correctness.


11. Troubleshooting sequence

  1. Confirm the affected prefix and desired primary exit.
  2. Verify both eBGP sessions.
  3. Inspect C1's candidate paths and LOCAL_PREF values.
  4. Trace each LOCAL_PREF back to the ingress edge policy.
  5. Inspect inbound route maps and prefix-list matches.
  6. Check for bgp default local-preference on either edge.
  7. Check for Cisco Weight that could override the LOCAL_PREF decision locally.
  8. Confirm next-hop reachability and RIB installation.
  9. Correct the smallest wrong policy value or match condition.
  10. Refresh safely and verify stable convergence.

12. Root cause and correction

Root cause

The backup edge assigned a higher LOCAL_PREF than the designated primary edge.

Correction

Remove or lower the incorrect E2 policy so the intended ranking is restored—for example E1 = 200, E2 = 100.

Why it works

LOCAL_PREF is propagated inside the AS, so C1 and the edge routers can make a consistent outbound-exit decision from the same policy signal.


13. Post-fix verification

On C1:

show ip bgp 192.0.2.128
show ip route 192.0.2.128 255.255.255.128

On E1/E2:

show route-map
show running-config | section router bgp
show ip bgp neighbors <peer> routes

If a data-plane endpoint exists, verify traffic exits through E1 and that failure of E1 causes the tested prefix to use E2.


14. Rollback

On E1:

router bgp 65030
 address-family ipv4 unicast
  no neighbor 192.0.2.1 route-map ISP-A-IN in

If the route map is used elsewhere, do not delete it globally until references are checked.

Rollback should restore the baseline decision process, not necessarily force the path through a specific peer.


15. Production design considerations

Set policy at ingress

Classifying a route when it enters the AS makes intent easier to reason about than changing preference repeatedly downstream.

Use a documented preference scale

Values are arbitrary, but a documented internal convention reduces accidental inversions.

Do not confuse outbound and inbound engineering

LOCAL_PREF primarily influences which exit your AS uses. It does not directly force external networks to choose how they enter your AS.

Audit broad defaults

bgp default local-preference can be valid, but broad defaults have larger blast radius than selective route-map policy.

Watch interactions with security

RPKI or customer/peer classification policy may intentionally lower LOCAL_PREF for certain routes. A later broad route map must not accidentally undo those controls.


15A. What LOCAL_PREF does not solve

LOCAL_PREF is powerful precisely because it is scoped to routing policy inside the AS, but that means it does not solve every traffic-engineering problem.

It does not force inbound traffic

If AS65030 gives ISP-A a LOCAL_PREF of 200, that tells AS65030's own routers to leave through ISP-A. A remote network choosing how to reach AS65030 does not receive that LOCAL_PREF in normal eBGP and cannot use it directly. Inbound engineering requires different tools such as selective advertisement, more-specific prefixes, provider communities, MED in the appropriate relationship, or carefully designed AS-path prepending.

It does not repair an unreachable next hop

A path with LOCAL_PREF 200 is not useful if its next hop is inaccessible. Day 12 remains a prerequisite: path eligibility and recursive resolution come before assuming that a preference value will translate into forwarding.

It does not override Cisco Weight

On a Cisco router, a local Weight difference is evaluated before LOCAL_PREF. If one edge has an unexplained Weight override, the router can disagree with the AS-wide policy even though the LOCAL_PREF values are correct.

It should not become a dumping ground for every policy decision

A mature design often uses communities to classify route source or business relationship and then derives LOCAL_PREF from that classification. This separates route meaning from route preference and makes policy easier to audit. The community modules later in the series will build that pattern explicitly.


15B. Preference-scale design

There is no RFC-defined enterprise scale such as 100/200/300. Operators create their own. A useful scale leaves room between tiers so emergency or security policy can insert temporary values without renumbering everything.

For example, an organization might document:

50   = degraded / temporary fallback
100  = normal backup transit
150  = normal secondary transit
200  = primary transit
250  = customer or preferred private interconnect class

Those numbers are only an example. The engineering requirement is consistency: every ingress policy that assigns LOCAL_PREF must align with the same documented hierarchy, and security policy must not be accidentally overridden by a generic route map later in the chain.


16. Knowledge check

Q1

Why does C1 learn the preferred-exit policy when Weight would not provide it?

Answer: LOCAL_PREF is carried to iBGP peers inside the AS, while Weight is local to one Cisco router.

Q2

Does LOCAL_PREF normally cross an eBGP boundary?

Answer: No. RFC 4271 says it must not be included in ordinary UPDATEs sent to external peers, except in the special case of BGP confederations.

Q3

Which LOCAL_PREF is preferred: 80 or 200?

Answer: 200, because higher LOCAL_PREF is preferred.


17. Sources

  1. RFC 4271 — *A Border Gateway Protocol 4 (BGP-4)* — LOCAL_PREF definition and propagation rules.
  2. Cisco — *IP Routing Configuration Guide, Cisco IOS XE 17.18.x: Configuring BGP* — local preference in the Cisco best-path sequence and default 100 behavior.
  3. Cisco — *Cisco IOS IP Routing: BGP Command Reference* — bgp default local-preference.
  4. Cisco — *Cisco IOS IP Routing: Protocol-Independent Command Reference* — set local-preference.

Accessed: 2026-08-11.


Day 13 — Cisco BGP Weight: Local-Only Best-Path Policy Without AS-Wide Propagation

Learning objective

Use Cisco Weight to prefer one path on a single IOS XE router, prove that the decision remains local to that router, and distinguish Weight from standards-based attributes such as LOCAL_PREF.


Cisco BGP Weight: Local-Only Best-Path Policy Without AS-Wide Propagation
Cisco BGP Weight: Local-Only Best-Path Policy Without AS-Wide Propagation



1. Opening — a powerful knob with a deliberately small scope

An enterprise edge router receives the same destination from two external peers. Both routes are valid. Both have reachable next hops. Their standard BGP attributes are otherwise equal enough that the router reaches late tie-breakers.

The operator wants only this router to prefer ISP-A. Other routers in the autonomous system must not inherit that preference.

Cisco Weight is designed for exactly that kind of local decision.

Weight is evaluated before LOCAL_PREF in Cisco's best-path sequence. The higher value wins. The important operational boundary is that Weight is local to the Cisco router: it is not a BGP path attribute defined by RFC 4271 and it is not advertised to BGP peers.

That makes Weight useful—and dangerous. It can create a preference that is invisible to the rest of the AS unless engineers deliberately inspect the router where it was applied.


2. Standards behavior versus Cisco behavior

RFC 4271 defines the standard BGP path attributes used by interoperable BGP speakers. Weight is not among them.

Cisco IOS and IOS XE add Weight as a local selection value. Cisco documentation places it at the beginning of the Cisco best-path algorithm: among otherwise eligible paths, the path with the highest Weight is preferred before the algorithm evaluates LOCAL_PREF and later attributes.

Two consequences follow:

  1. A Weight change can override a LOCAL_PREF difference on the same router.
  2. The Weight change does not travel in an UPDATE to another router.

Do not describe Weight as a transitive, non-transitive, well-known or optional BGP attribute. Those classifications apply to BGP path attributes; Weight is a Cisco-local selection property.


3. Common sources of Weight

Cisco IOS XE can assign Weight in more than one way.

Neighbor-level Weight

A neighbor-level setting applies a local Weight to routes learned from that peer:

neighbor 192.0.2.1 weight 250

This is simple but broad: every applicable route from the neighbor receives the configured value.

Route-map set weight

A route map can set Weight selectively based on prefix, AS path, community or another supported match:

route-map PREFER-SERVICE permit 10
 match ip address prefix-list SERVICE
 set weight 300

Cisco documentation notes that a Weight assigned by set weight can override Weight assigned with the neighbor-level command for matching routes.

Locally originated routes

Cisco commonly displays Weight 32768 for locally originated BGP routes. Received routes normally show Weight 0 unless policy changes it. Day 15 will isolate the separate “locally originated” best-path step rather than relying only on the default Weight difference.


4. Scope comparison: Weight versus LOCAL_PREF

| Property | Weight | LOCAL_PREF |
|---|---|---|
| Standard BGP attribute | No | Yes |
| Cisco-local selection value | Yes | No |
| Advertised to iBGP peers | No | Yes, within the AS |
| Advertised to ordinary eBGP peers | No | No |
| Higher value preferred | Yes | Yes |
| Best use | One-router preference | AS-wide exit policy |

If several routers must agree on the preferred exit, LOCAL_PREF is normally the more appropriate mechanism. If only one Cisco router should prefer a path, Weight can be intentionally narrow.


5. Scenario — Harbor Edge Local Preference

Illustrative lab — not a real incident.

Topology


Cisco BGP Weight: Local-Only Best-Path Policy Without AS-Wide Propagation
Cisco BGP Weight: Local-Only Best-Path Policy Without AS-Wide Propagation


        ISP-A R1                    ISP-B R2
         AS65010                     AS65020
     192.0.2.1/30              198.51.100.1/30
            \                      /
             \ eBGP          eBGP /
              \                  /
               EDGE-R3 AS65030
       192.0.2.2/30   198.51.100.2/30
                       |
                203.0.113.0/24
              learned from both peers

Both providers advertise 203.0.113.0/24. In the closed lab, both paths are deliberately constructed with equal higher-priority standard attributes so the Weight change is easy to observe.

Objective

  • Establish both eBGP sessions.
  • Verify both paths are eligible.
  • Apply Weight 250 to routes from ISP-A.
  • Confirm R3 prefers ISP-A locally.
  • Confirm no BGP UPDATE contains “Weight”.
  • Remove the setting and verify the original decision process returns.

6. Prerequisites

  • Three IOS XE-capable nodes.
  • IOS XE 17.18.x documentation baseline.
  • Direct eBGP from R3 to R1 and R2.
  • Both provider next hops reachable.
  • Console or out-of-band management.
  • A lab-only prefix, 203.0.113.0/24, originated by each provider for controlled comparison.

The dual origination is intentionally artificial for attribute training. Do not model real prefix ownership from it.


7. Baseline configuration

R1 — AS65010

hostname R1
interface GigabitEthernet0/0
 ip address 192.0.2.1 255.255.255.252
 no shutdown
!
ip route 203.0.113.0 255.255.255.0 Null0
!
router bgp 65010
 bgp router-id 10.10.10.1
 neighbor 192.0.2.2 remote-as 65030
 address-family ipv4 unicast
  network 203.0.113.0 mask 255.255.255.0
  neighbor 192.0.2.2 activate
 exit-address-family

R2 — AS65020

hostname R2
interface GigabitEthernet0/0
 ip address 198.51.100.1 255.255.255.252
 no shutdown
!
ip route 203.0.113.0 255.255.255.0 Null0
!
router bgp 65020
 bgp router-id 10.20.20.2
 neighbor 198.51.100.2 remote-as 65030
 address-family ipv4 unicast
  network 203.0.113.0 mask 255.255.255.0
  neighbor 198.51.100.2 activate
 exit-address-family

R3 — AS65030

hostname R3
interface GigabitEthernet0/0
 ip address 192.0.2.2 255.255.255.252
 no shutdown
interface GigabitEthernet0/1
 ip address 198.51.100.2 255.255.255.252
 no shutdown
!
router bgp 65030
 bgp router-id 10.30.30.3
 neighbor 192.0.2.1 remote-as 65010
 neighbor 198.51.100.1 remote-as 65020
 address-family ipv4 unicast
  neighbor 192.0.2.1 activate
  neighbor 198.51.100.1 activate
 exit-address-family

8. Verification before modification

On R3:

show ip bgp summary
show ip bgp 203.0.113.0
show ip route 203.0.113.0
show ip route 192.0.2.1
show ip route 198.51.100.1

Confirm:

  • both sessions are Established;
  • both paths to the prefix exist;
  • both next hops resolve;
  • received Weight is the unmodified default for both paths;
  • whichever path is best before the experiment is recorded as baseline evidence.

Do not invent which peer wins the late tie-breakers. The selected image and exact router IDs can influence the baseline result.


9. Controlled modification — prefer ISP-A locally

On R3:

configure terminal
router bgp 65030
 address-family ipv4 unicast
  neighbor 192.0.2.1 weight 250
 end

Use an inbound soft refresh or appropriate safe reprocessing method if the selected image requires routes to be re-evaluated for the new neighbor Weight.

Then verify:

show ip bgp 203.0.113.0
show ip route 203.0.113.0

Expected result

The path learned from 192.0.2.1 should display Weight 250 and become preferred if it remains otherwise eligible.

The peer does not receive an UPDATE containing Weight because Weight is not transmitted as a BGP path attribute.


10. Fault injection

Illustrative lab — not a real incident.

Lab name

Harbor Hidden Weight Override

Fault

An engineer applies Weight 400 to ISP-B while an existing AS-wide LOCAL_PREF policy intends ISP-A to be preferred.

router bgp 65030
 address-family ipv4 unicast
  neighbor 198.51.100.1 weight 400

Expected symptoms

  • R3 chooses ISP-B locally.
  • Other routers in AS65030 do not learn “Weight 400”.
  • A troubleshooting engineer who checks only route policy on another router may see no reason for R3's decision.

Lesson

A local implementation knob can override a standards-based policy on one router without creating an obvious AS-wide policy artifact.


11. Step-by-step troubleshooting

  1. Confirm the affected prefix.
  2. Verify both BGP paths are valid and next hops reachable.
  3. Inspect the full BGP path detail, including Weight and LOCAL_PREF.
  4. Determine whether Weight came from a neighbor command or route map.
  5. Check route-map precedence and matches.
  6. Compare R3's decision with another router in the AS.
  7. Remember that packet captures of BGP UPDATE messages will not show Weight.
  8. Identify whether the intended policy is router-local or AS-wide.
  9. Remove the smallest incorrect Weight policy.
  10. Re-evaluate the route and verify forwarding.

12. Root cause and correction

Root cause

The router-local Weight value took precedence over later selection attributes.

Correction

Remove or narrow the Weight policy if the intent is not local to that router. If the intended decision must be shared throughout the AS, implement an appropriately designed LOCAL_PREF policy instead.

Why the correction works

It removes the earlier Cisco-local selection override, allowing the path to be compared using the intended standard attributes and later tie-breakers.


13. Post-fix verification

show ip bgp 203.0.113.0
show running-config | section router bgp
show route-map
show ip route 203.0.113.0

Record:

  • Weight on each path;
  • selected best path;
  • next-hop resolution;
  • route installed in the RIB;
  • any change in traffic path if a forwarding endpoint is added.

14. Rollback

router bgp 65030
 address-family ipv4 unicast
  no neighbor 192.0.2.1 weight 250
  no neighbor 198.51.100.1 weight 400

If Weight was set by route map, rollback the route-map clause rather than only removing a neighbor command.

Preserve before/after show ip bgp evidence because the local-only nature of Weight can otherwise make the original cause hard to reconstruct.


15. Production lessons

Design lesson

Use Weight only when router-local policy is actually desired.

Operations lesson

A distributed troubleshooting workflow must include local path-selection state; an AS-wide policy review alone can miss Weight.

Change-management lesson

Because Weight is evaluated early, a small configuration change can redirect large traffic volumes immediately on that router.

Portability lesson

Weight is Cisco-specific. Designs intended to remain vendor-neutral should prefer standards-based policy mechanisms when possible.

Security lesson

Unexpected local preference overrides can defeat carefully designed containment or preferred-exit policy. Treat path-selection changes as high-impact routing changes.


16. Knowledge check

Q1

Why does another iBGP router not see the Weight value configured on R3?

Answer: Weight is a Cisco-local selection property, not a BGP path attribute carried in UPDATE messages.

Q2

Which path wins if one path has Weight 300 and another has higher LOCAL_PREF but Weight 0, assuming both are eligible?

Answer: On Cisco's documented selection order, the path with Weight 300 is evaluated as better before LOCAL_PREF is considered.

Q3

When is LOCAL_PREF usually a better tool than Weight?

Answer: When the preferred exit should be communicated consistently to other BGP speakers inside the same AS.


17. Sources

  1. RFC 4271 — *A Border Gateway Protocol 4 (BGP-4)* — standard BGP path attributes and Decision Process.
  2. Cisco — *IP Routing Configuration Guide, Cisco IOS XE 17.18.x: Configuring BGP* — Cisco path-selection ordering.
  3. Cisco — *Connecting to a Service Provider Using External BGP, IOS XE 17.x* — configuring neighbor Weight and policy examples.
  4. Cisco — *Cisco IOS IP Routing: BGP Command Reference* — neighbor weight syntax and behavior.

Accessed: 2026-08-11.


Featured Post

Day 41 — BGP Confederations: Sub-AS Design, External View and Migration

1. Opening Confederations are another way to scale BGP inside a large administrative domain. They divide the domain into member autonomous systems while presenting a single confederation identifier to external peers. They are powerful, but their operational model is more complex than simply 'using private ASNs inside.' The engineering goal is not to memorize another BGP command. It is to understand what information each speaker is allowed to propagate, what path information can be hidden, and what failure domain is created by the chosen control-plane architecture . 2. Concept and standards behavior RFC 5065 defines AS_CONFED_SEQUENCE and AS_CONFED_SET and how member-AS relationships are represented. Confederation external sessions have eBGP-like properties inside the confederation, while the confederation is presented externally as one AS. Modern guidance must also account for the fact that RFC 9774 prohibits new origination of AS_SET/AS_CONFED_SET in ordinary aggregation c...