BGP graceful restart provides for the continued processing and packet forwarding of a router‘s data-forwarding plane even if the router control plane fails. With both a router and its peer graceful restart enabled, BGP exchanges the graceful restart capability (BGP code 64) in the initial BGP OPEN messages that establish the session.
When a failure takes place and the router restarts its BGP process, normally peer routers clear all routes associated with the restarting router. When graceful restart is enabled on a router, the peer router marks all routes as "stale" and continues to forward packets based on the expectation that the restarting router will reestablish the BGP session within a reasonable period of time. During the period of the restart, the restarting router continues to forward packets based upon routing state at the time of the restart. Peers refresh the restarting router with RIB updates.
When the restarting router opens the new BGP session, it will again send the BGP capability code 64 to its peers with flags set to let the peer router know that the BGP process has restarted. When the restarting router completes its restart and RIB update, it in turn updates its peers with any new updates.
Graceful restart reduces routing flaps, which stabilizes the network and reduces the consumption of control-plane resources.
BGP graceful restart timing is based upon four configurable intervals:
Graceful restart must be enabled for the four configurable graceful restart timers to be relevant.
Use the bgp graceful-restart command, in BGP configuration mode, to enable graceful restart on the local router.
The following example enables graceful restart on router 151.1.1.9
System(su-config-bgp)->bgp router 65151 System(su-config-bgp)->bgp router-id 151.1.1.9 System(su-config-bgp)->bgp graceful-restart System(su-config-bgp)->
Use the bgp restart-defer command, in BGP configuration mode, to configure the time to defer route selection after gracefully restarting.
The following example configures the defer timer to 150 seconds:
System(su-config)->router bgp 65151 System(su-config-bgp)->bgp router-id 151.1.1.9 System(su-config-bgp)->bgp restart-defer 150 System(su-config-bgp)->
Use the bgp restart-time command, in BGP configuration mode, to configure the maximum time to wait for a graceful restarting peer to come back up after a restart.
The following example configures the restart time to be 100 seconds:
System(su-config)->router bgp 65151 System(su-config-bgp)->bgp router-id 159.1.1.9 System(su-config-bgp)->bgp restart-time 100 System(su-config-bgp)->
Use the bgp restart-timeout command, in BGP configuration mode, to configure the estimated time advertised to peers in the OPEN message for the session to be reestablished after a graceful restart.
The following example configures the restart-timeout to be 150 seconds:
System(su-config)->router bgp 65151 System(su-config-bgp)->bgp router-id 159.1.1.9 System(su-config-bgp)->bgp restart-timeout 150
Use the bgp stale-path-time command, in BGP configuration mode, to configure the maximum time following a restart stale routes are allowed to persist on the peer.
The following example sets the stale-path-time to 150 seconds:
System(su-config)->router bgp 65151 System(su-config-bgp)->bgp router-id 159.1.1.9 System(su-config-bgp)->bgp stale-path-time 150