When a junos bgp prefix limit exceeded event fires, the neighbor drops to Idle, the routing table empties out for that peer, and show bgp neighbor reports a PrefixLimitIdle flag. The fix is almost never just "raise the limit" -- in most cases either the peer leaked more routes than they should have, your inbound policy is missing a filter that used to be there, or the limit itself was set for a routing table size that no longer matches reality. This guide walks the diagnostic order before you touch the configuration.
This is written against Junos OS 21.4R3. The prefix-limit statement itself has existed since before Junos 7.4, but the drop-excess and hide-excess options are newer, introduced in Junos OS 21.2 and Junos OS Evolved 21.3R1 -- if you are running an older release, those two options will not be available to you and teardown is your only enforcement mechanism.
What PrefixLimitIdle Actually Means
Juniper's own support documentation describes this flag plainly: whenever the number of prefixes received from a neighbor exceeds the configured allowed value, Junos sets the PrefixLimitIdle flag and tears the session down if teardown is configured. If you also configured idle-timeout, the session stays in Idle for that duration -- or forever, if you set idle-timeout forever -- until you manually intervene with clear bgp neighbor.
That last detail trips people up constantly. An engineer raises the prefix-limit maximum, commits, and the session still does not come back up, because the idle-timeout is still running or was set to forever. The fix for a stuck session is not always a configuration change at all -- sometimes it is just a clear bgp neighbor.
Diagnostic Order: Check Before You Touch the Limit
show bgp neighbor 203.0.113.1 | match "Prefix|Options|State"
This tells you the configured maximum, how many prefixes were actually received at the moment of teardown, and whether PrefixLimitIdle is currently set.
show bgp summary
Confirms current session state across all peers -- useful for spotting whether this is isolated to one neighbor or whether several sessions tripped at once, which usually points to a route leak upstream rather than a local configuration problem.
show route receive-protocol bgp 203.0.113.1 count
Run this against a peer that is still up with a similar expected table size, or against your own route-collector session if you have one, to sanity-check what a "normal" prefix count should look like for that peering relationship.
Root Cause 1: The Peer Actually Leaked Routes (Most Common)
In our experience this is the most frequent real-world cause, particularly on eBGP sessions with smaller downstream customers or partners. A misconfigured redistribution policy on the far end -- often someone accidentally redistributing a full OSPF or static route table into BGP -- sends tens of thousands of unexpected prefixes in a short burst. The prefix-limit doing its job and tearing the session down is the system working correctly, not a bug to engineer around.
Before increasing any limit, get the peer to confirm what they actually intended to announce. Raising your local limit to accommodate someone else's misconfiguration just delays the next outage and makes your own route table unpredictable.
Root Cause 2: Limit Set Too Low for Organic Growth
Full-table eBGP sessions grow over time as the global routing table grows. A prefix-limit set a few years ago against "the current full table plus headroom" can become stale and trip during a routine growth period with no actual problem on either side. This is legitimate and the fix here really is to raise the number -- but do it with a specific target in mind, not an arbitrary round number.
set protocols bgp group TRANSIT neighbor 203.0.113.1 family inet unicast prefix-limit maximum 1000000
set protocols bgp group TRANSIT neighbor 203.0.113.1 family inet unicast prefix-limit teardown 90
set protocols bgp group TRANSIT neighbor 203.0.113.1 family inet unicast prefix-limit idle-timeout 5
The teardown 90 option logs a warning at 90 percent of the configured maximum before the hard limit is hit, giving you a window to react before the session actually drops.
Root Cause 3: Missing Inbound Filter That Used to Exist
On partial-table or customer-facing sessions where you expect only a specific prefix range, a prefix-limit exceeded event often means an inbound route-filter was accidentally removed or never applied, and the peer is now sending their full table instead of the agreed subset.
set policy-options policy-statement CUSTOMER-IN term allowed from route-filter 203.0.113.0/24 orlonger
set policy-options policy-statement CUSTOMER-IN term allowed then accept
set policy-options policy-statement CUSTOMER-IN term reject-rest then reject
set protocols bgp group CUSTOMER neighbor 203.0.113.1 import CUSTOMER-IN
This fixes the root cause rather than just absorbing more prefixes, and it is almost always the right fix on a session where you know exactly what the peer should be announcing.
Root Cause 4: Session Parked by idle-timeout forever
If someone configured idle-timeout forever months ago as a safety measure, the session will never self-recover even after the underlying prefix issue is fixed. You have to clear it manually.
clear bgp neighbor 203.0.113.1
Confirm first that the root cause is actually resolved -- clearing the session without fixing the underlying leak just restarts the same cycle a few minutes later.
Quick Reference: Symptom, Cause, Fix
| What You See | Likely Cause | Fix |
|---|---|---|
| Single peer trips suddenly, far above normal count | Peer-side route leak | Contact peer, do not raise limit blindly |
| Session trips gradually over months | Organic table growth | Raise prefix-limit maximum deliberately |
| Customer session receives full table unexpectedly | Missing inbound filter | Apply route-filter import policy |
| Limit fixed but session stays Idle | idle-timeout still active | clear bgp neighbor manually |
Verification: Confirming the Fix Held
show bgp neighbor 203.0.113.1 | match "Prefixes|State"
Type: External State: Established Flags: <Sync>
Options: <Preference LocalAddress AddressFamily Rib-group Refresh>
Accepted prefixes: 482913
Suppressed due to damping: 0
State should read Established with no PrefixLimitIdle flag listed, and Accepted prefixes should sit comfortably under the configured maximum -- not right at the edge of it, which just means the next growth cycle trips the same alarm again.
Use commit confirmed 5 when changing prefix-limit values on a production eBGP session, and make sure you have out-of-band console access before you do -- a mistyped import policy on a transit session can drop your default route along with everything else. Full statement reference is available in Juniper's TechLibrary. prefix-limit | Junos OS
Frequently Asked Questions
What does the PrefixLimitIdle flag mean on a BGP neighbor?
It means the number of prefixes received from that peer exceeded the configured maximum and Junos tore the session down. Check show bgp neighbor for the configured maximum versus what was actually received at the time of teardown.
Why does my BGP session stay down after I raised the prefix-limit?
If idle-timeout is configured, especially set to forever, the session will not automatically re-establish just because the limit changed. Run clear bgp neighbor <address> after confirming the underlying cause is fixed.
Should I just raise the prefix-limit every time this happens?
No. Check whether the increase is organic growth or an actual route leak from the peer first. Raising the limit to absorb a misconfiguration on the other end just delays the next incident.
What is the difference between prefix-limit and accepted-prefix-limit?
The prefix-limit statement counts prefixes received from the peer before any import policy is applied. The accepted-prefix-limit statement counts only prefixes that actually pass your import policy, which is useful when you expect policy to filter out most of what is received.
Can I drop excess prefixes instead of tearing down the whole session?
Yes, on Junos OS 21.2 and later (21.3R1 and later on Junos Evolved) you can use drop-excess or hide-excess instead of teardown. These keep the session up while discarding or hiding prefixes beyond the configured threshold rather than killing the whole peering.
Related guides: visit our routing and switching category hub for more BGP and OSPF troubleshooting, see our guide on Junos LACP interface down if the underlying transport link is also unstable, and check Junos VRRP not working if you are troubleshooting a related first-hop redundancy issue on the same box.
Juniper, Junos, MX, SRX, EX and QFX are trademarks of Juniper Networks, Inc. juniperclient.com is independent and unaffiliated.
Discussion (0)