Skip to content
LinkState
Go back

Tracing Confidence Collapse During Route Flaps

Introduction to BGP Flapping

Definition and Causes of BGP Flapping

BGP flapping is the rapid, repeated transition of a BGP peer session between the Established state and one of the non‑established states (Idle, Connect, Active, OpenSent, OpenConfirm). Each transition generates a BGP NOTIFICATION (or a TCP reset) and causes the peer to withdraw and re‑advertise its routes. Common causes include:

Impact of BGP Flapping on Network Stability

When a BGP session flaps, the control plane experiences:

Understanding the exact control‑plane state transitions is essential to decide whether to suppress the flapping automatically or to escalate for manual investigation.

Understanding Control-Plane State Changes

BGP Session States and Transitions

A BGP peer follows the finite‑state machine defined in RFC 4271:

StateTrigger (incoming)Action (outgoing)Next State
IdleStart event (manual or automatic)Initialize TCP, send OPENConnect
ConnectTCP connection successfulSend OPEN, start ConnectRetry timerOpenSent
TCP connection failureRestart ConnectRetry timerIdle
OpenSentReceive OPEN (valid)Send KEEPALIVE, start Hold timerOpenConfirm
Receive OPEN (invalid)Send NOTIFICATION (error)Idle
Hold timer expiresSend NOTIFICATION (Hold Timer Expired)Idle
OpenConfirmReceive KEEPALIVEReset Hold timerEstablished
Receive UPDATE/NOTIFICATIONProcess message, reset Hold timerEstablished
Hold timer expiresSend NOTIFICATION (Hold Timer Expired)Idle
EstablishedReceive KEEPALIVE/UPDATEReset Hold timerEstablished
Send KEEPALIVEReset Hold timerEstablished
Hold timer expiresSend NOTIFICATION (Hold Timer Expired)Idle
Manual stopSend NOTIFICATION (Cease)Idle

A flap is observed when the session moves from Established → Idle/Connect/Active/OpenSent/OpenConfirm → Established within a short interval (typically seconds to a few minutes). Each transition generates a NOTIFICATION (or TCP reset) that is logged by the router.

Role of Keepalives and Hold Timers in BGP Sessions

If the underlying link experiences intermittent loss, the TCP stack may not deliver KEEPALIVEs in time, causing the hold timer to expire and triggering a transition to Idle. Conversely, if the local BGP process is CPU‑starved, it may fail to transmit KEEPALIVEs, also leading to hold‑timer expiry.

Detecting State Changes in BGP Sessions

Operators can observe state changes via:

A typical log entry for a flap caused by hold‑timer expiry:

%BGP-5-ADJCHANGE: Neighbor 10.0.0.5 Down Hold timer expired
%BGP-5-ADJCHANGE: Neighbor 10.0.0.5 Up

The timestamp difference between the Down and Up messages quantifies the flap duration.

Automated Suppression of BGP Flapping

Principles of Automated Suppression

Automated suppression aims to dampen the propagation of unstable BGP information without disabling the underlying session. Two complementary mechanisms exist:

  1. BGP Route Flap Dampening (RFC 2439) – applies a penalty to each route withdrawal/advertisement; when the penalty exceeds a suppress limit, the route is temporarily suppressed from advertisement. Penalties decay exponentially with a configurable half‑life. When the penalty falls below a reuse limit, the route is unsuppressed.
  2. BGP Peer Session Flap Suppression – some vendors (Cisco, Juniper, Nokia) allow configuration of a flap‑damping policy on the BGP peer itself: after N state changes within a monitoring window, the peer is placed in a suppressed state where further KEEPALIVE/UPDATES are still exchanged but the router refrains from sending NOTIFICATIONs or generating syslog alerts for a configurable period. This prevents the control plane from being flooded with flap‑related notifications while still allowing the session to recover.

Both mechanisms operate purely in the control plane: they monitor state transitions or update streams, compute penalties, and decide whether to forward updates to peers or to install routes in the RIB/FIB. They do not alter the forwarding plane directly; any forwarding impact stems from whether a route is present in the RIB and subsequently programmed into the FIB.

Configuring Automated Suppression Mechanisms

Configuration varies by vendor. Below are representative snippets; timer values and parameter names are vendor‑specific and must be tuned to the observed flap characteristics.

Cisco IOS/IOS‑XR

router bgp 65000
  bgp dampening 15 750 2000 60   ! half-life reuse suppress max-suppress-time

Juniper Junos

set protocols bgp group <group-name> damping half-life 15 reuse 750 suppress 2000 max-suppress 60

Adjust the values according to network stability requirements and observed flap patterns. Proper tuning ensures that transient noise is suppressed while persistent instability triggers escalation for manual review.


Share this post on:

Previous Post
State changes that separate churn from path loss
Next Post
CI tests for partial-withdraw containment