BGP Prefix Leaks: The Missing Max-Prefix Check and How to Fix It
Archi4 min read
Contents
- The root cause is a counter, not a policy
- What a leak actually does on the wire
- Why the max-prefix limit keeps failing
- Limits set by habit, not by baseline
- The warning threshold nobody watches
- The session that never receives a limit
- What actually works
- Treat the limit as a required field
- Pair the limit with filtering
- Add an outbound check
- Practice the shutdown
- The opinion
The root cause is a counter, not a policy#
When a BGP leak pushes a full table into a smaller network, the postmortem often blames a typo. The deeper cause is usually mechanical: a session with no max-prefix limit, or a limit set so high it never trips before the damage is done. The limit is a small integer attached to a neighbor statement. Most leaks happen because that integer was missing, stale, or set to a number the router could never reach in normal operation.
Border routers accept whatever prefixes a peer sends unless something stops them. Route filters and prefix lists are supposed to do that work, but they depend on someone updating them. A max-prefix limit is the last line of defense. It counts prefixes on a session and tears the session down when the count crosses a threshold. The failure mode is simple: no count, no shutdown.
What a leak actually does on the wire#
A typical leak starts with a configuration change on one router. An operator turns on a customer session, applies a route map in the wrong direction, or restores an old config from backup. The router then re-advertises routes it learned from one upstream to another. If the receiving peer has no filter for the leaked prefixes, those routes enter its table and spread outward.
The propagation is fast. Each border router that accepts the routes passes them on within seconds. Within a few minutes, parts of the internet see a new, more specific path to a large block of addresses. Traffic follows the longest match. Legitimate destinations lose their traffic to a network that has no idea it is carrying it. The routers stay up. The damage is invisible to interface counters and ping tests to the router itself.
Why the max-prefix limit keeps failing#
Limits set by habit, not by baseline#
A common pattern: an engineer copies a neighbor template from an old build and leaves the limit at 1,000,000. The peer normally sends 400 prefixes. The limit is effectively infinite. Nobody notices until the session announces 900,000 routes and the router's memory and CPU absorb them. By then the session has already done its damage.
A better practice is to set the limit close to the observed baseline. If a peer sends 400 prefixes today, a limit of 600 to 800 gives headroom for growth while capping the blast radius. The exact number depends on how often the peer's table changes. A limit that is too tight causes false shutdowns and support tickets. A limit that is too loose is decoration.
The warning threshold nobody watches#
Most router vendors let operators set a warning threshold below the hard limit, often a percentage. Many networks set the warning and never route it to an alerting system. The router logs a message, the log rotates, and nobody sees it. The hard limit still works, but the early warning is wasted.
Wiring the warning into monitoring is cheap. A prefix count rising 20 percent above baseline is a signal worth a page. That signal often arrives minutes before a full leak, which is enough time to shut the session by hand.
The session that never receives a limit#
Some leaks come through sessions where a max-prefix limit is impossible or forgotten: route reflectors, internal BGP sessions, and peering fabrics that were built before the limit was standard. In a route reflector, a broken client can inject routes that the reflector redistributes to every other client. The reflector may have no per-client limit at all.
Modern routing stacks support per-neighbor limits on most session types, including iBGP. Checking every session, not just eBGP, closes a gap that many networks still carry.
What actually works#
Treat the limit as a required field#
A neighbor without a max-prefix limit should fail configuration review the same way a neighbor without a password does. That means templates, automation, and audits. If a network provisions sessions by script, the script should refuse to commit when the limit is absent or above a per-peer-class ceiling.
Pair the limit with filtering#
The limit is a circuit breaker, not a routing policy. Prefix filters and RPKI-based origin validation stop the wrong routes from being accepted in the first place. The limit catches what the filters miss. Operators who rely on one without the other are choosing which failure they prefer, not preventing failure.
Add an outbound check#
Most of the attention goes to inbound filters. The leak originates on the outbound side. A router that advertises more than its own aggregate to an upstream is doing something wrong. Some networks now attach an outbound prefix count check or a simple route map that permits only the customer's registered blocks. That check does not stop every mistake, but it catches the common one: a full table leaking into a transit session.
Practice the shutdown#
A max-prefix limit ends with a session reset. That reset should be a rehearsed event, not a surprise. Teams should know which alarm fires, who has authority to re-enable the session, and what evidence they need before doing it. Without that, the limit may trip and someone may raise it to clear the alarm.
The opinion#
The industry treats BGP leaks as a routing policy problem. They are mostly a counting problem. A single integer per session, set near the baseline, monitored at the warning threshold, and enforced on every session type, would prevent a large share of the incidents that make headlines. The fix is not new. It has been in router software for years. What is missing is the discipline to treat an absent limit as an incomplete configuration. Until that changes, the next leak will start the same way: one router, one missing counter, and a few minutes of chaos that the rest of the internet absorbs.
More articles