Showing posts with label BGP. Show all posts
Showing posts with label BGP. Show all posts

Friday, 31 July 2026

BGP Timers on a VRF in ACI Multi-Site — Why NDO Can't Do It and What Cisco TAC Confirmed

 If you've gone looking for a VRF-level BGP Timer Policy in Nexus Dashboard Orchestrator and come up empty, you're not missing a menu — it genuinely isn't there yet. Here's what we found while troubleshooting this on a live Multi-Site fabric with a mix of stretched and local VRFs, the workaround Cisco TAC confirmed as supported, and exactly how to verify the new timers actually took effect instead of just assuming they did.

  • The gap: NDO does not expose a BGP Timer Policy at the VRF level for ACI Multi-Site — only at the L3Out node level (via L3Out Node Routing Policy → BGP Node Settings).
  • The workaround: Create and apply the BGP Timer Policy directly on APIC, per site, against the target VRF (local or stretched). Cisco TAC confirmed this is the correct and supported method.
  • The catch: BGP timers are negotiated during the initial handshake. Changing the policy alone does nothing to an already-established session — you need a hard reset of the BGP session for the new keepalive/hold values to take effect.
  • Don't trust the config alone. "Configured" timers and "negotiated" (active) timers are two different things in show bgp output — always verify the negotiated value after the reset, not just the configuration.

The Problem: No VRF-Level BGP Timer Option in NDO

In a single-site APIC deployment, applying a custom BGP Timer Policy to a VRF is straightforward — it's a native object under Tenant → Networking → VRF → BGP Context Per Address Family. In Multi-Site environments managed through NDO, that granularity isn't there. NDO's L3Out configuration model lets you attach a BGP Node Routing Policy (with its own keepalive/hold timers) to a node group inside an L3Out template — but there's no equivalent construct for applying timers at the VRF level, independent of a specific L3Out's node groups.

For environments running mixed local and stretched VRFs across sites, that's a real gap: you may want consistent BGP timer behavior tied to the VRF itself, not scattered across every L3Out node group that happens to reference it.

What We Asked Cisco TAC

Rather than guess, we opened a case and asked directly. Here's the exchange, included for anyone hitting the same wall:

Our question:

We need to deploy BGP timers on a VRF within our ACI Multi-Site fabric. Our environment contains both stretched and local VRFs. We do not see an option in NDO to apply BGP timers at the VRF level. Therefore, we are planning to use the following approach: 1) Create a BGP Timer Policy on the APIC. 2) Apply the BGP Timer Policy to the target VRF (local or stretched) via APIC only. Could you please confirm whether the above procedure is the correct and supported method for configuring BGP timers in an ACI Multi-Site environment? Additionally, after applying the policy, we do not see the updated timer values reflected on the BGP neighbour sessions. Is a BGP session reset (hard reset) required for the new timer values to take effect, or are there any additional steps that need to be performed?

Cisco's response:

Configuration Method: Your proposed approach is correct. As NDO does not currently support configuring BGP Timer Policies at the VRF level, applying these policies directly via the APIC on each respective site is the standard and supported method. 

Session Reset: Yes, a BGP session reset (hard reset) is required for the new timer values to take effect. Because these timers are negotiated during the initial BGP handshake, the existing sessions must be torn down and re-established to renegotiate the new keepalive and hold-down values with the neighbor.

Two things worth underlining from that response: this is a per-site, APIC-side configuration — NDO is not the tool for VRF-level BGP timers today — and a hard reset is mandatory, not optional, for the values to actually apply.

Step-by-Step: Applying the BGP Timer Policy to a VRF via APIC

  1. Log into the APIC GUI for the site containing the target VRF (do this per site for stretched VRFs — there's no single-pane push for this from NDO).
  2. Navigate to Tenants → <tenant> → Networking → VRFs → <vrf-name>.
  3. Under the VRF, go to the BGP Context Per Address Family (create one for each address family in use — IPv4 and/or IPv6).
  4. Set the BGP Timers field to a custom BGP Timer Policy, or create a new one:
    • Go to Tenants → <tenant> → Policies → Protocol → BGP → BGP Timers, right-click and Create BGP Timers Policy.
    • Set Keepalive Interval (sec) and Hold Interval (sec) to your target values (keep the standard 1:3 ratio — e.g., 4/12 or 10/30 — most implementations expect hold time to be roughly 3x keepalive).
  5. Apply the policy to the VRF's BGP Context Per Address Family and submit.
  6. Repeat per site for any stretched VRF — this is not propagated automatically across the Multi-Site domain since it's an APIC-local object, not an NDO-managed one.
  7. Confirm the object landed correctly:
   GET https://<apic>/api/node/mo/uni/tn-<tenant>/ctx-<vrf>/bgpCtxAfP-ipv4-ucast.json

Check for the tnBgpTimersPolName attribute pointing to your new policy.

Why the Timers Won't Show Up Until You Reset the Session

This trips people up every time: BGP keepalive and hold timers are exchanged in the OPEN message during session establishment — they're not a live, continuously-enforced parameter that updates on the fly. Changing the policy updates the configuration, but an already-established session keeps running on whatever timers it originally negotiated until it's torn down and rebuilt.

That means after step 7 above, show bgp will show your configured timers, but the negotiated/active timers on any existing session will still be the old values — until you force a reset.

Verifying the Change Actually Took Effect

Don't just trust the APIC MO or the CLI's "configured" line — verify the negotiated value, which is what's actually governing the session.

1. Check the configured value on the border leaf:

show bgp <afi> unicast neighbors <peer-ip> vrf <tenant>:<vrf-name>

Look for: Configured hold time is 12, keepalive interval is 4 seconds

2. Check the negotiated (active) value in the same output: Look for: Hold time is X, keepalive interval is Y seconds If X/Y still show the old defaults, the session hasn't renegotiated — move to step 3.

3. Force the hard reset:

clear bgp <afi> unicast <peer-ip> vrf <tenant>:<vrf-name>

A soft clear will not renegotiate timers — timers only get exchanged at session establishment, so this has to be a hard clear.

4. Re-check the negotiated value after the reset:

show bgp <afi> unicast neighbors <peer-ip> vrf <tenant>:<vrf-name>

The negotiated value will be the lower of what each side offers — if your peer's own BGP timer configuration is set higher (or lower) than yours, that governs the final negotiated result, not your configured value alone.

5. Confirm real-world keepalive cadence:

show bgp <afi> unicast neighbors <peer-ip> vrf <tenant>:<vrf-name> | include "Last read"

Run this two or three times a few seconds apart — "Last read" should reset roughly every N seconds, matching your new keepalive interval.

6. Watch for flapping after the change, especially with aggressive timers like 4/12:

show bgp <afi> unicast neighbors <peer-ip> vrf <tenant>:<vrf-name> | include "Last reset"
show logging logfile | include BGP

A Word of Caution on Aggressive Timers

Tighter timers (like 4-second keepalive / 12-second hold) improve failure-detection speed, but they raise the risk of false-positive flaps on links with variable latency, high CPU load on the peer device, or congested control-plane paths. Before rolling this out broadly across a Multi-Site fabric, test it on a single non-critical VRF/L3Out first and monitor for a few days.

FAQ

Does NDO support VRF-level BGP timers at all? Not currently. The only BGP timer construct exposed in NDO is at the L3Out node group level (L3Out Node Routing Policy → BGP Node Settings). VRF-level BGP Timer Policies must be applied directly on APIC, per Cisco TAC's confirmation.

Will this survive an NDO template push or resync? Since the VRF-level BGP Timers Policy is applied directly on APIC and not modeled in the NDO template, it should not be overwritten by a standard template redeploy — but any workflow that deletes and recreates the VRF from NDO would remove it. Treat it as an out-of-band configuration and document it clearly for your team.

Do I need to reset the session on both sides of the peering, or just my side? Just your side's session needs a hard clear to force renegotiation — BGP will tear down and rebuild the full session, which inherently re-triggers the handshake and timer exchange on both ends.

What's a safe keepalive/hold ratio to use? Cisco and most vendors expect hold time to be roughly 3x keepalive (e.g., 4/12, 10/30, 20/60). Going below that ratio, or setting a very low hold time on a link with real latency or jitter, increases false-positive flap risk.

Is this the same procedure for a stretched VRF across multiple sites? Yes, but it must be repeated per site — this is an APIC-local object, and NDO doesn't propagate it across the Multi-Site domain automatically. For a stretched VRF, log into each site's APIC and apply the same BGP Timer Policy independently.

Related Reading on Networklearner


Author note: 

Need help with Cisco ACI, Nexus, data center networking, or network automation?
I am a CCIE Data Center engineer with 18+ years of enterprise networking experience.
Contact me for consulting, troubleshooting, design reviews, and project support.

Thursday, 23 July 2026

Why BGP Maximum-Paths Wasn't the Problem: Fixing Uneven Port-Channel Traffic on Cisco Nexus and IOS

 If you've ever pulled up interface counters and seen one port-channel member carrying 70–80% of the traffic while its bundle-mate sits nearly idle, your first instinct is probably the same one we had: "BGP load balancing must be broken."

It usually isn't. Here's the case we worked through, why BGP was innocent from the start, and the actual fix.

TL;DR

  • Symptom: One port-channel member interface was carrying the majority of traffic; the other was underutilized.
  • First suspect: BGP maximum-paths — already configured correctly, and confirmed working via ECMP.
  • Real cause: The port-channel load-balancing algorithm (src-dst-ip enhanced) was hashing large, persistent flows onto the same physical link every time.
  • Fix: Move to src-dst-mixed-ip-port (or the NX-OS equivalent src-dst ip-l4port) to add Layer 4 entropy to the hash.
  • Caveat: If the imbalance is caused by a single "elephant flow," even L4 hashing won't split it — that needs a different tool entirely.

The Symptom

The environment was already running router bgp with maximum-paths 8 configured, so multiple equal-cost paths were expected to be installed and used. But interface counters told a different story — one member of the port-channel was consistently running hot while the other stayed quiet, day after day, regardless of overall traffic volume.

Router# show interface port-channel 10 | include rate
  5 minute input rate 812000000 bits/sec, 95000 packets/sec
  5 minute output rate 790000000 bits/sec, 92000 packets/sec

Router# show interface gigabitethernet 1/1 | include rate
  5 minute input rate 780000000 bits/sec, 91000 packets/sec

Router# show interface gigabitethernet 1/2 | include rate
  5 minute input rate 32000000 bits/sec, 4000 packets/sec

That's roughly a 96/4 split across two members of the same bundle — not something you'd expect from a healthy port-channel.

Ruling Out BGP First

Before touching anything on the switching side, we confirmed the routing layer was actually doing its job.

Router# show ip bgp summary
Router# show ip route 10.20.30.0
Routing entry for 10.20.30.0/24
  Known via "bgp 65001", distance 20, metric 0
  Routing Descriptor Blocks:
  * 192.168.1.1, from 192.168.1.1
      192.168.1.2, from 192.168.1.2

Two next-hops installed for the same prefix, exactly as maximum-paths 8 should produce when the paths are equal-cost. BGP ECMP was functioning correctly — routing decisions were being made across multiple paths, so it made no sense to keep chasing BGP config as the root cause.

That's the key thing to internalize: BGP ECMP and port-channel load balancing are two completely separate mechanisms operating at two different layers.

LayerMechanismDecides
Layer 3 (Routing)BGP maximum-paths / ECMPWhich path (next-hop) traffic takes
Layer 2 (Switching)Port-channel hash algorithmWhich physical member link within a bundle carries a given flow

Even with BGP perfectly distributing traffic across paths, each of those paths might egress through a port-channel — and it's entirely possible for the hashing algorithm on that port-channel to funnel most flows onto one member link regardless of what BGP is doing upstream.

Checking the Current Hashing Algorithm

Next step: find out what hash algorithm the port-channel was actually using.

On IOS / IOS-XE:

Router# show etherchannel load-balance
EtherChannel Load-Balancing Configuration:
        src-dst-ip

On Nexus (NX-OS):

Switch# show port-channel load-balance
Port Channel Load-Balancing Configuration:
System: src-dst ip

Both confirmed the same thing: the algorithm was using only Layer 3 information — source and destination IP address — to compute the hash and select a member link.

Why src-dst-ip Pins Big Flows to One Link

The hash is deterministic. Given the same source IP and destination IP, the algorithm produces the same result every single time, which means every packet in that flow is sent down the same physical link.

That's fine when you have many different flows between many different IP pairs — the hash spreads them out reasonably well. It falls apart when a small number of flows dominate the traffic, which is exactly what a database replication stream, a backup job, or a storage sync between two fixed IPs looks like: same source, same destination, forever — one hash result, one link, permanently.

This isn't a bug. Cisco's port-channel load balancing is intentionally flow-based, not packet-based, specifically to avoid packet reordering within a TCP session. The trade-off is that a big, long-lived flow can dominate a single member link even when the bundle as a whole has spare capacity.

The Fix: Add Layer 4 to the Hash

Switching from src-dst-ip to src-dst-mixed-ip-port pulls TCP/UDP source and destination port numbers into the hash calculation alongside the IP addresses.

IOS / IOS-XE:

Router(config)# port-channel load-balance src-dst-mixed-ip-port

NX-OS (Nexus):

Switch(config)# port-channel load-balance src-dst ip-l4port

Some Nexus platforms go a step further and support VLAN as an additional hash input for even more entropy:

Switch(config)# port-channel load-balance src-dst ip-l4port-vlan

With source/destination ports added, two different application sessions between the same pair of servers (say, a web server and a database server running several concurrent connections) will now very likely produce different hash results — and land on different physical links — instead of all piling onto whichever link the IP-only hash happened to pick.

In environments with many concurrent sessions between the same endpoints (application servers, load balancers, hypervisor clusters), this alone often meaningfully improves the balance.

Before You Make the Change

A few things worth knowing before you touch a production bundle:

  • It's generally non-disruptive on most Cisco platforms — you don't need to shut the port-channel.
  • Every existing flow gets re-hashed immediately. Expect a brief window of packet reordering as flows redistribute across members. It's usually transparent to TCP, but schedule the change for a maintenance window or low-traffic period if the environment is sensitive (VoIP, storage replication, etc.).
  • This is still flow-based hashing, just with more inputs. A single elephant flow — one enormous, sustained stream between one IP:port pair — will still be pinned to one physical link even after adding L4 information. Layer 4 hashing splits up multiple flows between the same hosts; it does not split a single flow.

If It's an Elephant Flow, Hashing Alone Won't Fix It

If, after the change, one link is still running noticeably hotter than the others, don't keep tweaking the hash algorithm — look for a dominant flow instead:

Router# show interface port-channel 10 | include rate
Switch# show flow monitor <name> cache

or pull top talkers from NetFlow/sFlow/telemetry. If you find one flow consuming most of the bandwidth, your real options are traffic engineering (splitting the application across multiple sessions/IPs if possible), platform-specific dynamic load balancing features (several Nexus platforms support Dynamic Load Balancing, which rebalances flows based on real-time link utilization rather than a static hash), or simply accepting that a single-flow workload isn't a great fit for port-channel-based scaling in the first place.

Verification Checklist

After changing the algorithm, give it a few hours under real traffic and check:

  • Port-channel member interface utilization (show interface … | include rate on each member)
  • Top bandwidth-consuming flows (NetFlow/sFlow/telemetry)
  • Interface error/discard counters (rule out anything unrelated masquerading as imbalance)
  • Application-level traffic distribution if you have flow visibility tools

If the split moves from something like 96/4 toward 55/45 or 60/40, the change did its job. If it barely moves, you're very likely looking at an elephant-flow scenario rather than a hashing-algorithm problem.

FAQ

Does changing the port-channel load-balancing algorithm cause an outage? No — on most Cisco IOS, IOS-XE, and NX-OS platforms this is a non-disruptive change. Existing flows get re-hashed and may briefly reorder, but the port-channel itself stays up.

Will src-dst-mixed-ip-port always produce perfectly even traffic distribution? No. It improves distribution when multiple flows exist between the same endpoints, but a single very large flow will still be pinned to one member link, since hashing is flow-based, not packet-based.

How do I check the current load-balancing algorithm on a Nexus switch? show port-channel load-balance on NX-OS. On IOS/IOS-XE, use show etherchannel load-balance.

Is BGP maximum-paths related to port-channel hashing at all? No — they operate at different layers. maximum-paths controls how many equal-cost paths BGP installs at Layer 3. Port-channel hashing controls which physical member link, at Layer 2, carries a given flow once it's already been routed onto that path.

What's the best load-balancing algorithm for Cisco port-channels in general? There isn't a universal "best" — it depends on traffic patterns. src-dst-mixed-ip-port (or NX-OS's ip-l4port) is a strong general-purpose default for environments with many concurrent sessions between the same hosts, since it adds the most useful entropy without added complexity.

Conclusion

BGP maximum-paths was never the issue in this case — it was correctly installing and using multiple equal-cost paths exactly as designed. The imbalance lived one layer down, in the port-channel's src-dst-ip hashing algorithm, which pins any given source/destination IP pair to a single physical link. Moving to src-dst-mixed-ip-port added Layer 4 awareness to the hash and meaningfully improved distribution — with the caveat that a genuine elephant flow needs a different fix entirely.

The broader lesson: when you see uneven link utilization on a bundle, don't assume the routing protocol is at fault. Check where the imbalance actually lives — Layer 3 path selection or Layer 2 hash distribution — before you start changing BGP configuration that may already be working exactly as intended.


Related Articles

If this was useful, these go deeper on the BGP and Cisco fundamentals that sit underneath this issue:

Why BGP Maximum-Paths Wasn't the Problem: Understanding Port-Channel Load Balancing and Traffic Imbalance

Recently, we investigated a case where traffic utilization across port-channel member interfaces was significantly unbalanced. One of the links was carrying the majority of the traffic while the other link remained underutilized. Since the environment was already configured with BGP maximum-paths 8, the initial assumption was that BGP load balancing might not be functioning correctly.

After reviewing the configuration, we confirmed that BGP ECMP was operating as expected and that multiple equal-cost paths were available. This shifted our focus from the routing layer to the port-channel load-balancing mechanism.

Why BGP Was Not the Problem

The configuration already included BGP maximum-paths 8, which allows the router to install and use multiple equal-cost paths. This means the network was capable of leveraging several routes simultaneously, eliminating BGP as the primary suspect.

It is important to understand that BGP ECMP and port-channel load balancing serve different purposes. BGP decides which routing path should be used, while the port-channel hashing algorithm determines which physical member link will carry the traffic.

Even when ECMP is working perfectly, traffic can still become concentrated on a single port-channel member if the hashing algorithm maps large flows to the same interface.

Current Hashing Algorithm Analysis

The port-channel was configured with the src-dst-ip enhanced load-balancing algorithm.

This algorithm uses only the source and destination IP addresses to calculate the hash. If a traffic flow continuously uses the same source and destination IP addresses, all packets belonging to that flow will be forwarded through the same member interface.

For example, a database replication stream between two servers will always generate the same hash result. As a result, the entire flow remains pinned to a single physical link regardless of how much unused bandwidth exists on other members of the port-channel.

This behavior is normal because Cisco port-channel load balancing is flow-based rather than packet-based. The objective is to avoid packet reordering and maintain application performance.

Considering src-dst-mixed-ip-port

To improve traffic distribution, we evaluated changing the load-balancing algorithm from src-dst-ip enhanced to src-dst-mixed-ip-port.

Unlike the current configuration, this method includes both Layer 3 and Layer 4 information in the hash calculation. In addition to source and destination IP addresses, it also considers source and destination TCP or UDP port numbers.

This creates a larger number of unique hash combinations and increases the likelihood that different application sessions between the same endpoints will be distributed across multiple member links.

In environments where users, applications, or servers establish numerous simultaneous connections, this approach often results in significantly improved bandwidth utilization across the port-channel.

Important Considerations Before Making the Change

Changing the load-balancing algorithm is generally considered a non-disruptive operation on most Cisco platforms. However, all existing traffic flows will be immediately re-hashed.

As traffic gets redistributed across available links, there may be a brief period of packet reordering. While this is typically minor and transparent to most applications, implementing the change during a maintenance window or low-utilization period is recommended.

Another important consideration is that even with Layer 4 information included, the load-balancing mechanism remains flow-based. If the imbalance is caused by a single high-bandwidth elephant flow, the entire flow will still be assigned to one member link.

In such cases, changing the hashing algorithm may provide only limited improvement.

Recommended Validation After the Change

After implementing the new load-balancing method, monitor interface utilization and traffic patterns for several hours.

Review the following:

Port-channel member utilization

Top bandwidth-consuming flows

NetFlow or telemetry statistics

Application traffic distribution

Interface counters

If traffic becomes more evenly balanced across the member interfaces, the change has achieved its objective. If the imbalance continues, further investigation should focus on identifying large elephant flows or application-specific traffic patterns.

Conclusion

Based on our analysis, BGP maximum-paths was not contributing to the bandwidth imbalance. The routing layer was functioning correctly and supporting multiple equal-cost paths as designed.

The more likely cause was the src-dst-ip enhanced hashing algorithm, which uses only Layer 3 information and can result in traffic concentration when a small number of large flows dominate bandwidth consumption.

Moving to src-dst-mixed-ip-port is a logical and widely adopted optimization because it introduces Layer 4 awareness into the hashing calculation and generally improves traffic distribution when multiple flows exist between the same source and destination hosts.

While it may not solve scenarios involving a single elephant flow, it represents the most appropriate next step before exploring more advanced traffic-engineering options

Saturday, 26 July 2025

Overview of BGP Aggregation

BGP route aggregation is a powerful feature that helps reduce the size of routing tables by summarizing multiple specific routes into a single, broader route. This is especially useful in large-scale networks where route optimization and scalability are critical.

In Cisco IOS, the aggregate-address command provides flexible options to control how and when summary routes are advertised. Whether you're looking to advertise only the summary, retain specific routes, or apply custom attributes, this command gives you granular control over BGP route announcements.

By default, when you use the aggregate-address command, the router advertises both the aggregate route and the more specific routes that fall under it

Let’s dive in and understand how each option can be used to fine-tune your BGP advertisements.

  1. as-set

  • Purpose: Includes the AS numbers of the contributing routes in the AS path of the aggregate.
  • Use Case: When you want to preserve AS path information for loop prevention or policy decisions.
  • Effect: The aggregate route will have an AS_SET attribute, which is a list of AS numbers from the contributing routes.

2. summary-only

  • Purpose: Suppresses the advertisement of the more specific routes.
  • Use Case: When you want to advertise only the summarized route and hide the specifics.
  • Effect: Only the aggregate route is advertised; specific routes are not sent to BGP peers.

3. suppress-map <map-name>

  • Purpose: Selectively suppress specific routes from being advertised.
  • Use Case: When you want to suppress some specific prefixes but still advertise others along with the aggregate.
  • Effect: Routes matching the route-map are suppressed; others are advertised.

4. advertise-map <map-name>

  • Purpose: Controls which specific routes are used to generate the aggregate.
  • Use Case: When you want the aggregate to be created only if certain routes exist.
  • Effect: Aggregate is advertised only if routes matching the map are present in the BGP table.

5. attribute-map <map-name>

  • Purpose: Applies specific BGP attributes to the aggregate route.
  • Use Case: When you want to set attributes like MED, community, or local preference on the aggregate.
  • Effect: The aggregate route inherits attributes defined in the route-map.

 


Wednesday, 17 June 2020

BGP: x.x.x.x Active open failed - no route to peer, open active delayed 9216ms (35000ms max, 60% jitter)


BGP: x.x.x.x Active open failed - no route to peer, open active delayed 9216ms (35000ms max, 60% jitter)


I was working on an issue and got above logs while doing the debug of BGP on the cisco router.

Below are the two thing which we need to test to resolve such issues.

1. Specific route for the BGP neighbor IP address. BGP neighborship is dependent on it and default route won't work.

2. Ebgp multihop. Make sure to configure the eBGP multihop command while making the ebgp neighborship on the indirectly connected routers.

Saturday, 13 May 2017

BGP - Path Selection Criteria


Below is the BGP path selection criteria.

1.       Highest Weight
2.       Highest local preference
3.       Locally generated routes
4.       Shortest AS Path
5.      Origin Code
6.    Lowest MED
7.       eBGP over iBGP
8.       Lowest IGP metric to the BGP next hop.
9.       Oldest Route in case of ebgp
10.   BGP router with the lowest router ID.
11.   Minimum cluster id
12.   Lowest neighbor address.

Sunday, 7 May 2017

Weight attribute - BGP

Below are the characteristics of weight:-

1.       Manipulate Outgoing traffic
2.       Cisco Proprietary
3.       Only applicable when two exit points are on single router.
4.       Never advertise out from router and will remain local to router.
5.       Higher is preferred
6.       Range is 0 – 65535.
7.       When using Route-map to manipulate weight then it cannot be applied in Outgoing direction as shown below. It has to be in inbound direction.
          
            R1(config-router)#neighbor 13.13.13.3 route-map SET_WEIGHT out
                % "SET_WEIGHT" used as BGP outbound route-map, set weight not supported


In below configuration example, R1 is having two paths to reach to 20.1.1.x subnet and best path is from R2 i.e. 12.12.12.2. We want to change the outgoing traffic from R1 to R3 by increasing the weight of R3 neighbor but remember it will not manipulate the incoming traffic. It will change the outgoing traffic directions only,



Weight will change the path for 20.1.1.x from R2 to R3.


R1:-

interface Loopback0
 ip address 1.1.1.1 255.255.255.255

interface FastEthernet0/0
 description " Connected to R2"
 ip address 12.12.12.1 255.255.255.0
no shut

interface FastEthernet0/1
 description " Connected to R3"
 ip address 13.13.13.1 255.255.255.0
 no shut

interface FastEthernet2/0
 description " Connected to PC1"
 ip address 10.1.1.1 255.255.255.0
no shut

router bgp 1
 no synchronization
 bgp log-neighbor-changes
 network 10.1.1.0 mask 255.255.255.0
 neighbor 12.12.12.2 remote-as 1

 neighbor 13.13.13.3 remote-as 1

Without Weight configured.

R1#sh ip bgp
BGP table version is 3, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, x best-external
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 10.1.1.0/24      0.0.0.0                  0         32768 i
* i20.1.1.0/24      13.13.13.3               0    100      0 2 i

*>i                 12.12.12.2               0    100      0 2 I  \\Route Via R2 is preferred without weight


With Weight configured.

Weight can be set using any of the below methods:-

Option A:-

router bgp 1
neighbor 13.13.13.3 weight 100

OR

Option B:-  It is more flexible as in here we can apply weight on specific routes as well by calling an Prefix-list or access-list that matches the routes under Route map.

router bgp 1
neighbor 13.13.13.3 route-map SET_WEIGHT in

route-map  SET_WEIGHT
set weight 100

R1#sh ip bgp
BGP table version is 4, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, x best-external
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 10.1.1.0/24      0.0.0.0                  0         32768 i
*>i20.1.1.0/24      13.13.13.3               0    100    100 2 I   \\Above configured weight has changed the path


* i                 12.12.12.2               0    100      0 2 i

R2:-

interface Loopback0
 ip address 2.2.2.2 255.255.255.255

interface FastEthernet0/0
 description " Connected to R1"
 ip address 12.12.12.2 255.255.255.0
no shut

interface FastEthernet1/0
 description " Connected to R5"
 ip address 25.25.25.2 255.255.255.0
 no shut

router bgp 1
 no synchronization
 bgp router-id 2.2.2.2
 bgp log-neighbor-changes
 neighbor 12.12.12.1 remote-as 1
 neighbor 12.12.12.1 next-hop-self
 neighbor 25.25.25.5 remote-as 2

R3:-

interface Loopback0
 ip address 3.3.3.3 255.255.255.255

interface FastEthernet0/1
description " Connected to R1"
 ip address 13.13.13.3 255.255.255.0
no shut

interface FastEthernet1/0
description " Connected to R4"
 ip address 34.34.34.3 255.255.255.0
no shut

router bgp 1
 no synchronization
 bgp router-id 3.3.3.3
 bgp log-neighbor-changes
 neighbor 13.13.13.1 remote-as 1
 neighbor 13.13.13.1 next-hop-self
 neighbor 34.34.34.4 remote-as 2
 no auto-summary
!

R4:-

interface FastEthernet0/1
description " Connected to R6"
 ip address 46.46.46.4 255.255.255.0
no shut

interface FastEthernet1/0
description " Connected to R3"
 ip address 34.34.34.4 255.255.255.0
no shut

router bgp 2
 no synchronization
 bgp log-neighbor-changes
 neighbor 34.34.34.3 remote-as 1
 neighbor 46.46.46.6 remote-as 2
 neighbor 46.46.46.6 next-hop-self
 no auto-summary
!
R5:-

interface Loopback0
 ip address 5.5.5.5 255.255.255.255

interface FastEthernet0/0
description " Connected to R6"
 ip address 56.56.56.5 255.255.255.0
no shut

interface FastEthernet1/0
description " Connected to R2"
 ip address 25.25.25.5 255.255.255.0
no shut

router bgp 2
 no synchronization
 bgp log-neighbor-changes
 neighbor 25.25.25.2 remote-as 1
 neighbor 56.56.56.6 remote-as 2
 neighbor 56.56.56.6 next-hop-self
 no auto-summary


R6:-

interface Loopback0
 ip address 6.6.6.6 255.255.255.255

interface FastEthernet0/0
description " Connected to R5"
 ip address 56.56.56.6 255.255.255.0
no shut

interface FastEthernet0/1
description " Connected to R4"
 ip address 46.46.46.6 255.255.255.0
no shut

interface FastEthernet2/0
description " Connected to PC2"
 ip address 20.1.1.1 255.255.255.0
 no shut

router bgp 2
 no synchronization
 bgp log-neighbor-changes
 network 20.1.1.0 mask 255.255.255.0
 neighbor 46.46.46.4 remote-as 2
 neighbor 56.56.56.5 remote-as 2
 no auto-summary

PC1:-

PC1> show ip

NAME        : PC1[1]
IP/MASK     : 10.1.1.10/24
GATEWAY     : 10.1.1.1
DNS         :
MAC         : 00:50:79:66:68:00
LPORT       : 10003
RHOST:PORT  : 127.0.0.1:10002
MTU:        : 1500

PC2:-
PC2> show ip

NAME        : PC2[1]
IP/MASK     : 20.1.1.10/24
GATEWAY     : 20.1.1.1
DNS         :
MAC         : 00:50:79:66:68:00
LPORT       : 10003
RHOST:PORT  : 127.0.0.1:10002
MTU:        : 1500


Verification:-

R2:-

R2#sh ip bgp summ
BGP router identifier 2.2.2.2, local AS number 1
BGP table version is 3, main routing table version 3
2 network entries using 256 bytes of memory
2 path entries using 104 bytes of memory
2/2 BGP path/bestpath attribute entries using 248 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 632 total bytes of memory
BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
12.12.12.1      4            1     316     317        3    0    0 04:41:15        1
25.25.25.5      4            2     312     313        3    0    0 04:41:10        1

R2#sh ip bgp
BGP table version is 3, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, x best-external
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i10.1.1.0/24      12.12.12.1               0    100      0 i
*> 20.1.1.0/24      25.25.25.5                             0 2 i


R3:-

R3#sh ip bgp summ
BGP router identifier 3.3.3.3, local AS number 1
BGP table version is 3, main routing table version 3
2 network entries using 256 bytes of memory
2 path entries using 104 bytes of memory
2/2 BGP path/bestpath attribute entries using 248 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 632 total bytes of memory
BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
13.13.13.1      4            1     318     314        3    0    0 04:41:25        1
34.34.34.4      4            2     312     316        3    0    0 04:41:21        1

R3#sh ip bgp
BGP table version is 3, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, x best-external
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i10.1.1.0/24      13.13.13.1               0    100      0 i
*> 20.1.1.0/24      34.34.34.4                             0 2 i


R4:-

R4#sh ip bgp summ
BGP router identifier 4.4.4.4, local AS number 2
BGP table version is 4, main routing table version 4
2 network entries using 256 bytes of memory
2 path entries using 104 bytes of memory
2/2 BGP path/bestpath attribute entries using 248 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 632 total bytes of memory
BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
34.34.34.3      4            1     323     319        4    0    0 04:47:19        1
46.46.46.6      4            2     321     320        4    0    0 04:47:20        1

R4#sh ip bgp
BGP table version is 4, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, x best-external
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 10.1.1.0/24      34.34.34.3                             0 1 i
*>i20.1.1.0/24      46.46.46.6               0    100      0 i
R4#

R5:-

R5#sh ip bgp summ
BGP router identifier 5.5.5.5, local AS number 2
BGP table version is 3, main routing table version 3
2 network entries using 256 bytes of memory
2 path entries using 104 bytes of memory
2/2 BGP path/bestpath attribute entries using 248 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 632 total bytes of memory
BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
25.25.25.2      4            1     321     320        3    0    0 04:47:42        1
56.56.56.6      4            2     319     320        3    0    0 04:47:43        1

R5#sh ip bgp
BGP table version is 3, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, x best-external
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 10.1.1.0/24      25.25.25.2                             0 1 i
*>i20.1.1.0/24      56.56.56.6               0    100      0 i
R5#
R6:-

R6#sh ip bgp summ
BGP router identifier 6.6.6.6, local AS number 2
BGP table version is 4, main routing table version 4
2 network entries using 256 bytes of memory
3 path entries using 156 bytes of memory
2/2 BGP path/bestpath attribute entries using 248 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 684 total bytes of memory
BGP activity 2/0 prefixes, 3/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
46.46.46.4      4            2     321     322        4    0    0 04:48:27        1
56.56.56.5      4            2     320     319        4    0    0 04:48:28        1
R6#sh ip bgp
BGP table version is 4, local router ID is 6.6.6.6
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, x best-external
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i10.1.1.0/24      46.46.46.4               0    100      0 1 i
* i                 56.56.56.5               0    100      0 1 i
*> 20.1.1.0/24      0.0.0.0                  0         32768 i
R6#

PC1:-

PC1> trace 20.1.1.10
trace to 20.1.1.10, 8 hops max, press Ctrl+C to stop
 1   10.1.1.1   40.000 ms  10.000 ms  10.000 ms
 2   13.13.13.3   30.000 ms  30.000 ms  30.000 ms
 3   34.34.34.4   50.000 ms  50.000 ms  50.000 ms
 4   46.46.46.6   90.000 ms  80.000 ms  70.000 ms
 5   *20.1.1.10   150.000 ms (ICMP type:3, code:3, Destination port unreachable)


PC2:-

PC2> trace 10.1.1.10
trace to 10.1.1.10, 8 hops max, press Ctrl+C to stop
 1   20.1.1.1   10.000 ms  10.000 ms  10.000 ms
 2   46.46.46.4   30.000 ms  30.000 ms  30.000 ms
 3   34.34.34.3   40.000 ms  50.000 ms  50.000 ms
 4   13.13.13.1   60.000 ms  60.000 ms  60.000 ms
 5   *10.1.1.10   70.000 ms (ICMP type:3, code:3, Destination port unreachable)