BGP Neighbor Flapping Explained: Why a BGP Session Keeps Going Up and Down
A BGP neighbor that keeps going down and coming back up is flapping, and %BGP-5-ADJCHANGE is the log line that records every change. The cause is almost never BGP itself: hold timers expire when keepalives are lost to congestion, large updates vanish into an MTU black hole, firewalls reset TCP 179, the peer restarts the session on purpose, or routes stay missing afterwards because dampening suppressed the prefixes — not the session. This guide shows how to read the log pattern, separate the causes, and fix the path in a safe order.
The short answer
What is BGP neighbor flapping? A BGP session — the connection between two routers that exchange routes — keeps going down and back up instead of staying established. Each change is logged as %BGP-5-ADJCHANGE, with the neighbor address and the word Up or Down. One drop can be a real failure or a deliberate restart. The same neighbor dropping repeatedly is flapping, and the cause is almost never BGP itself: something underneath — a lossy link, a broken TCP connection, a wrong packet size, or a person resetting the session — keeps breaking it. Read the log sequence and the reset reason, not any single drop.
Picture two offices that must stay on one long phone call to keep swapping delivery lists. The call keeps cutting out mid-sentence, so they hang up, redial, swap half a list, and lose it again. Nothing is wrong with what they are saying — the line keeps failing underneath the conversation.
How to read %BGP-5-ADJCHANGE in plain English
%BGP-5-ADJCHANGE: neighbor 203.0.113.1 Down BGP Notification received
%BGP-5-ADJCHANGE: neighbor 203.0.113.1 Up
The line tells you what changed and when, but not why. The why lives around the line: the timestamps (regular and random intervals point at different causes), show bgp neighbors on both ends (the last reset reason, and how long the session has survived), the interface logs and error counters at the same times, and the TCP and MTU checks below. For the message itself, see the Error Decoder entry for %BGP-5-ADJCHANGE.
A flap timeline. The session establishes cleanly every time, but survives only minutes — pointing underneath BGP: the link, TCP, or packet size.
The causes, in working order
1. Hold-timer expiry on a congested or dying path. The classic cause. On Cisco IOS the default hold time is 180 seconds, with a keepalive every 60 seconds, unless the neighbors negotiate lower values at session setup. If no keepalive or update arrives in time, the neighbor is declared dead — and congestion, a failing optic or a saturated CPU can all swallow keepalives. Evidence: regular-interval drops, a reset reason of hold time expired, a session surviving roughly the same time each cycle.
2. MTU black-holing. The session establishes happily — opening messages are small — then dies once real routes flow in large updates that a tunnel or link on the path silently drops, because it accepts fewer bytes than the ends assume and the "too big" replies that would reveal it are filtered. Evidence: small pings pass, large do-not-fragment pings fail at one size, drops line up with route exchange, not the clock.
3. TCP 179 resets, or blocked return traffic. BGP is only as healthy as its TCP connection. A firewall or ACL that allows setup but drops or resets TCP 179 mid-session — or blocks the return path — kills a good session. Evidence: the reset reason points at TCP, and drops track a middlebox, not interface errors.
4. The other end really did restart it. A peer reload, a configuration change, or an engineer running clear ip bgp produces a genuine teardown — often announced with a Cease notification, BGP's formal "closing this on purpose" message. Evidence: the peer's logs and uptime agree, and its team can say what they did — ask before troubleshooting your own side.
5. The physical interface underneath is flapping. If the link itself bounces, every session on it follows. Evidence: interface up/down lines at exactly the ADJCHANGE timestamps, plus rising CRC or input errors.
6. Dampening — the one that is usually innocent. Route flap dampening penalises flapping prefixes: a route that keeps appearing and disappearing earns penalty points and is suppressed for a while. It does not dampen the neighbor session itself — nothing in dampening tears a session down. But it explains a confusing aftermath: after the session stays Up, some routes stay missing a while, suppressed while it bounced — the prefixes are still serving their penalty.
Flapping is not the same failure as a neighbor that never comes up. A session stuck before Established — cycling through Idle and Active — is a connection problem from packet one, covered in BGP neighbor states explained and, as a worked fault, in BGP neighbor stuck in Active. For what it carries once stable, see BGP explained.
A three-way split that resolves most flaps: match drop timestamps against the clock pattern, the interface log, and packet size.
Checks in order
- Read the log timestamps and compute the interval pattern. Regular intervals suggest timer expiry under loss; busy-hour drops suggest congestion; drops with matching interface messages suggest the physical path.
- Read
show bgp neighborsdetail on both ends — last reset reason and current session uptime. Hold time expired, a TCP reset, and a notification received are three different investigations. - Check the underlying interface at the same times — state changes, CRC and input errors. If it flapped, stop: BGP is the victim, not the cause.
- Test TCP 179 reachability both ways. Confirm the connection opens from each side and nothing on the path drops or resets port 179 in either direction.
- Test MTU with do-not-fragment ping sweeps. Raise the size until pings fail; a hard ceiling below the expected size locates the black hole. The site's troubleshooting case works this fault's close cousin: a neighbor stuck in Active.
- Check whether many neighbors flapped at once. If every session bounced together, the fault is local — the router, its CPU, or shared transport — not one peer. If only one bounced, look at that path and peer.
- Ask the peer what their logs say before changing configuration. A Cease notification, a reload, or a maintenance window on their side ends the investigation in one message — reconfiguring your side to chase their restart only adds a second fault.
Fixes and prevention, in a production-safe order
Fix the underlying link and transport first — the failing optic, the congested segment, the loss. Every other fix is decoration while packets still drop. Do not just raise the hold timer to silence the alarms: a longer timer does not repair loss, it only delays detection of real failures — a noisy warning traded for a slower failover.
Correct MTU and MSS where tunnels are involved: set the tunnel MTU honestly and clamp the TCP maximum segment size to match, so updates are never built bigger than the path can carry. Remove TCP 179 drops: audit ACLs and firewall policy on the whole path, both directions, return traffic included. Handle intentional resets gracefully: schedule clear ip bgp and peer changes under change control, warn the other side, and expect routes to stay suppressed a while afterwards where dampening is enabled. Then verify: session uptime climbs past every previous failure interval, ADJCHANGE lines stop, missing routes return as penalties expire.
Fact-check sources: hold timer and keepalive behaviour, the 180-second hold and 60-second keepalive Cisco IOS defaults unless negotiated lower, and the Cease notification — RFC 4271 and Cisco BGP documentation. Dampening as a per-prefix penalty — RFC 2439.
Related guides
- Flapping means the session itself keeps dying and restarting — %BGP-5-ADJCHANGE records each Up and Down, and the interval pattern plus the last reset reason in show bgp neighbors matter more than any single drop.
- The causes separate by evidence: regular-interval drops with hold time expired mean keepalives lost to congestion or a dying link (Cisco IOS defaults: 180-second hold time, 60-second keepalive); drops when large routes flow mean an MTU black hole; interface logs at the same timestamps mean the physical link; a Cease notification or peer reload means the other end closed it on purpose.
- Dampening does not dampen the neighbor session — it penalises flapping prefixes. That is why routes can stay missing after the session looks Up again: the session recovered, but the prefixes are still suppressed.
- Fix the link and transport first, and never just raise the hold timer to hide flapping — a longer timer only delays detection of real failures. Correct MTU and MSS on tunnels, remove TCP 179 drops, and ask the peer what their logs say before changing your own configuration.