The maintenance window begins at midnight. The spare path is available. Then someone shuts down the preferred BGP session, and the network spends its next few seconds discovering where traffic should go instead.
BGP graceful shutdown changes the order: make the old path less attractive, let alternatives take over while it still works, and only then remove it.
Think of a bridge closing for repairs. You want drivers using the diversion before the barriers go across the road. A warning sign is useful only if there is another road—and the drivers follow it.
What Is BGP Graceful Shutdown?
BGP graceful shutdown is a planned-maintenance mechanism standardized in RFC 8326. It uses the GRACEFUL_SHUTDOWN community to signal that advertised paths should be made less preferred, reducing avoidable loss when a BGP session is deliberately taken down. [1]
The old path remains available during the transition. Lowering its preference is different from withdrawing it immediately: routers can keep using it while alternative routes are selected and propagated. [4]
The familiar community notation is 65535:0. IANA registers its value, 0xFFFF0000, as GRACEFUL_SHUTDOWN. It is a standard BGP community value, not a special shutdown packet sent directly to every router on the Internet. [2]
“Graceful” describes an intended transition, not a guarantee of zero packet loss.
The Tag Is a Request. Routing Policy Does the Work
A receiving network needs behavior that recognizes the community and lowers the route’s preference. The usual tool is LOCAL_PREF, with a low value such as 0.
Within an autonomous system, higher LOCAL_PREF expresses a stronger preference. It is normally distributed through iBGP, rather than advertised to ordinary eBGP neighbors; BGP confederations are an exception. The external community carries the signal, and each receiving AS applies its own policy. [3]
That distinction matters. Your router does not set the whole Internet’s LOCAL_PREF to zero. It announces a marked path and depends on participating networks to interpret it.
The receiving policy must also fit the rest of the import logic. A later rule that restores the route’s usual high preference can undo the intended effect. Existing prefix filters and origin-validation decisions should remain in force; the maintenance tag is not permission to accept an otherwise rejected route.
Our RPKI explainer covers that authorization question. A route can have an authorized origin and still be a poor choice during maintenance.
The Two Directions You Need to Move
Draining a peering connection has two separate routing problems:
Traffic leaving your AS: lower the preference of routes learned over the connection being maintained. Internal routers can then select an acceptable alternative exit.
Traffic entering your AS: attach 65535:0 to the routes you advertise over that connection. A cooperating neighbor lowers their preference and can choose another route toward your destinations. [1, 4]
Changing only your outbound advertisements does not, by itself, change your own exit selection. Changing only your internal preferences does not guarantee that a neighbor stops sending you traffic.
Both directions also need usable alternatives. De-preferencing a route cannot create a second transit provider, spare capacity, or a missing internal path.
A Two-Exit Example: R1 Leaves Without Slamming the Door
Imagine a fictional network, AS 64496, with border routers R1 and R2. Internal routers can reach both. R1 connects to Provider A; R2 connects to Provider B.
For one remote prefix, both paths are accepted and reachable. Assume no higher-priority local selection rule overrides the LOCAL_PREF comparison:
| Stage | Path through R1 | Path through R2 | Preferred exit |
|---|---|---|---|
| Normal operation | LOCAL_PREF 200 | LOCAL_PREF 100 | R1 |
| Maintenance drain | LOCAL_PREF 0 | LOCAL_PREF 100 | R2 |
| R1 session removed after convergence | Unavailable | LOCAL_PREF 100 | R2 |
The numbers are illustrative policy choices, not a universal default. The useful interval is the middle row: R1 is still there while the network settles on R2.
For incoming traffic, R1 also marks its advertisements toward Provider A. Provider A must honor the signal and have an acceptable alternative toward the same destinations. Its policy decision is independent of the table inside AS 64496.
If the low-preference path is the only eligible route left, it can still be selected. LOCAL_PREF 0 means less preferred; it does not mean discard. That preserves a fallback during the transition, but also exposes a failed assumption if traffic never moves away.
What to Check Before the Maintenance Window
The graceful-shutdown requirements distinguish a controlled maintenance transition from simply reacting after connectivity disappears. The alternative forwarding path must be ready before the old one is removed. [7]
- Define the scope. Identify the sessions, address families, VRFs, and locally originated routes affected. A whole router can carry more traffic than the one eBGP session you are watching.
- Confirm the alternative. Check reachability and available capacity. A valid backup route that becomes congested under the full load is an incomplete maintenance plan.
- Confirm receiver behavior. Check that the community is actually sent and honored, and that import/export policies do not remove or override the intended signal.
- Activate de-preference while forwarding still works. Give updated advertisements time to propagate and alternate routes time to be selected.
- Verify the result before removal. Check selected routes, installed forwarding next hops, traffic counters, and service probes from relevant locations.
A BGP table is evidence about routing, not complete proof of the forwarding path. Conversely, a quiet interface alone does not tell you that every important destination remains reachable.
There is no universal “wait 30 seconds” answer. Use convergence measurements and an operational margin, then verify the outcome. Cisco’s implementation documentation likewise requires enough time for affected peers to converge before shutdown. [4]
Expected production traffic should move away. BGP keepalives and management traffic may remain; the goal is not necessarily a literal zero on every packet counter.
A Small FRRouting Example
For an already configured FRR 10.6 BGP instance using the documentation ASN 64496, the documented instance-level activation looks like this:
configure terminal
router bgp 64496
bgp graceful-shutdown
end
FRR reannounces routes to eBGP peers with the shutdown community and announces LOCAL_PREF 0 to iBGP peers. Its documentation says receiving FRR speakers honor the community automatically; other implementations or policies may need explicit configuration. [5]
This command affects the BGP instance, not just one neighbor. FRR also supports a global configuration scope; the instance and global modes are mutually exclusive. [5]
Activating the feature does not power off the router or prove that traffic has moved. Verify the drain, then perform the separate session or equipment shutdown required by the maintenance plan.
After maintenance, when the forwarding path is healthy and ready to receive traffic again, remove this instance-level setting:
configure terminal
router bgp 64496
no bgp graceful-shutdown
end
FRR then reannounces routes without the maintenance community and/or with their usual LOCAL_PREF. If graceful shutdown was saved in startup configuration, it persists across bgpd restarts until explicitly disabled. [5]
These snippets illustrate one implementation’s control. They do not configure neighbors, backup paths, filtering, or a complete router-maintenance workflow.
Graceful Shutdown vs. Graceful Restart
The names sound interchangeable. Their objectives are quite different:
| Mechanism | Intended behavior | Crucial condition |
|---|---|---|
| Graceful Shutdown | Make paths less preferred before planned removal. | There must be an acceptable alternative and cooperating policy. |
| Graceful Restart | Temporarily retain routing information around a BGP restart. | Continued forwarding must be viable for the retained paths. |
| Immediate withdrawal | Remove the route and select among what remains. | Convergence follows the removal rather than a prior drain. |
Graceful Restart, defined in RFC 4724, supports retaining forwarding state and stale routing information while BGP restarts. It can help when control-plane software restarts without destroying the relevant forwarding ability. It is not a promise that a router with its power removed continues carrying packets. [6]
Graceful Shutdown is the mechanism aimed at moving traffic away before that forwarding path disappears.
What the Word “Drain” Can Hide
This is a routing drain, not an application-aware connection drain. BGP does not distinguish a new TCP connection from a nearly finished download. Changing a route can move packets belonging to existing flows.
That matters especially with anycast services. If rerouting sends an existing flow to another service instance, that instance may lack the required session state. Anycast operations need coordination between routing and the application. [8]
The procedure also cannot protect against every transient forwarding inconsistency. RFC 8326 explicitly addresses the problem of alternative paths being hidden before a withdrawal; it does not solve every possible forwarding loop during convergence. [1]
For an entire router, include locally originated prefixes and non-BGP transit roles in the plan. Lowering preference on external sessions alone may leave other traffic depending on the device.
A planned transition is also different from repeated route flapping. Graceful shutdown is preparation for a deliberate removal; it is not a repair for a link that keeps failing unpredictably.
Bring the Path Back Deliberately
Restoration deserves the same order of care: establish a healthy forwarding path, verify its routing and service behavior, then remove maintenance de-preference and observe traffic returning.
Leaving the tag active can produce a puzzling result: the router looks healthy, the sessions are established, and the preferred traffic stubbornly stays elsewhere.
The lesson is pleasingly simple. When you know a path is about to disappear, the network should learn where to go while that path still works.
Sources and Further Reading
- [1] IETF: RFC 8326 — Graceful BGP Session Shutdown.
- [2] IANA: BGP well-known community registry.
- [3] IETF: RFC 4271 — BGP-4, including LOCAL_PREF, Section 5.1.5.
- [4] Cisco: BGP Graceful Shutdown configuration and convergence considerations.
- [5] FRRouting: FRR 10.6 BGP documentation.
- [6] IETF: RFC 4724 — BGP Graceful Restart.
- [7] IETF: RFC 6198 — graceful-shutdown requirements.
- [8] IETF: RFC 4786 — operating anycast services.
