Perform this task to enable and disable BGP graceful restart for BGP neighbors using peer session templates. In this task, a BGP peer session template is created, and BGP graceful restart is enabled. A second peer session template is created, and this template is configured to disable BGP graceful restart.
In this example, the configuration is performed at Router B in the figure below, and two external BGP neighbors--Router A and Router E--are identified. The first BGP peer at Router A is configured to inherit the first peer session template, which enables BGP graceful restart, whereas the second BGP peer at Router E inherits the second template, which disables BGP graceful restart. Using the optional show ip bgp neighbors command, the status of the BGP graceful restart capability is verified for each BGP neighbor configured in this task.
Figure 1 |
Network Topology Showing BGP Neighbors |
The restart and stale-path timers can be modified only using the global bgp graceful-restart command. The restart and stale-path timers are set to the default values when BGP graceful restart is enabled for BGP neighbors using peer session templates.
 Note |
A BGP peer cannot inherit from a peer policy or session template and be configured as a peer group member at the same. BGP templates and BGP peer groups are mutually exclusive.
|
SUMMARY STEPS
1. enable
2. configure terminal
3. router bgp autonomous-system-number
4. template peer-session session-template-name
5. ha-mode graceful-restart [disable]
6. exit-peer-session
7. template peer-session session-template-name
8. ha-mode graceful-restart [disable]
9. exit-peer-session
10. bgp log-neighbor-changes
11. neighbor ip-address remote-as autonomous-system-number
12. neighbor ip-address inherit peer-session session-template-number
13. neighbor ip-address remote-as autonomous-system-number
14. neighbor ip-address inherit peer-session session-template-number
15. end
16. show ip bgp template peer-session [session-template-number]
17. show ip bgp neighbors [ip-address [received-routes | routes | advertised-routes | paths [regexp] | dampened-routes | flap-statistics | received prefix-filter | policy [detail]]]
DETAILED STEPS
|
Command or Action |
Purpose |
|
enable
Example:
Device> enable
|
Enables privileged EXEC mode.
-
Enter your password if prompted.
|
|
configure terminal
Example:
Device# configure terminal
|
Enters global configuration mode. |
|
router bgp autonomous-system-number
Example:
Device(config)# router bgp 45000
|
Enters router configuration mode and creates a BGP routing process. |
|
template peer-session session-template-name
Example:
Device(config-router)# template peer-session S1
|
Enters session-template configuration mode and creates a peer session template.
-
In this example, a peer session template named S1 is created.
|
|
ha-mode graceful-restart [disable]
Example:
Device(config-router-stmp)# ha-mode graceful-restart
|
Enables the BGP graceful restart capability and BGP NSF awareness.
-
Use the disable keyword to disable BGP graceful restart capability.
-
If you enter this command after the BGP session has been established, you must restart the session in order for the capability to be exchanged with the BGP neighbor.
-
In this example, the BGP graceful restart capability is enabled for the peer session template named S1.
|
|
exit-peer-session
Example:
Device(config-router-stmp)# exit-peer-session
|
Exits session-template configuration mode and returns to router configuration mode. |
|
template peer-session session-template-name
Example:
Device(config-router)# template peer-session S2
|
Enters session-template configuration mode and creates a peer session template.
-
In this example, a peer session template named S2 is created.
|
|
ha-mode graceful-restart [disable]
Example:
Device(config-router-stmp)# ha-mode graceful-restart disable
|
Enables the BGP graceful restart capability and BGP NSF awareness.
-
Use the disable keyword to disable BGP graceful restart capability.
-
If you enter this command after the BGP session has been established, you must restart the session in order for the capability to be exchanged with the BGP neighbor.
-
In this example, the BGP graceful restart capability is disabled for the peer session template named S2.
|
|
exit-peer-session
Example:
Device(config-router-stmp)# exit-peer-session
|
Exits session-template configuration mode and returns to router configuration mode. |
|
bgp log-neighbor-changes
Example:
Device(config-router)# bgp log-neighbor-changes
|
Enables logging of BGP neighbor status changes (up or down) and neighbor resets.
-
Use this command for troubleshooting network connectivity problems and measuring network stability. Unexpected neighbor resets might indicate high error rates or high packet loss in the network and should be investigated.
|
|
neighbor ip-address remote-as autonomous-system-number
Example:
Device(config-router)# neighbor 192.168.1.2 remote-as 40000
|
Configures peering with a BGP neighbor in the specified autonomous system.
-
In this example, the BGP peer at 192.168.1.2 is an external BGP peer because it has a different autonomous system number from the router where the BGP configuration is being entered (see Step 3).
|
|
neighbor ip-address inherit peer-session session-template-number
Example:
Device(config-router)# neighbor 192.168.1.2 inherit peer-session S1
|
Inherits a peer session template.
-
In this example, the peer session template named S1 is inherited, and the neighbor inherits the enabling of BGP graceful restart.
|
|
neighbor ip-address remote-as autonomous-system-number
Example:
Device(config-router)# neighbor 192.168.3.2 remote-as 50000
|
Configures peering with a BGP neighbor in the specified autonomous system.
-
In this example, the BGP peer at 192.168.3.2 is an external BGP peer because it has a different autonomous system number from the router where the BGP configuration is being entered (see Step 3).
|
|
neighbor ip-address inherit peer-session session-template-number
Example:
Device(config-router)# neighbor 192.168.3.2 inherit peer-session S2
|
Inherits a peer session-template.
-
In this example, the peer session template named S2 is inherited, and the neighbor inherits the disabling of BGP graceful restart.
|
|
end
Example:
Device(config-router)# end
|
Exits router configuration mode and enters privileged EXEC mode. |
|
show ip bgp template peer-session [session-template-number]
Example:
Device# show ip bgp template peer-session
|
(Optional) Displays locally configured peer session templates.
-
The output can be filtered to display a single peer policy template by using the session-template-name argument. This command also supports all standard output modifiers.
|
|
show ip bgp neighbors [ip-address [received-routes | routes | advertised-routes | paths [regexp] | dampened-routes | flap-statistics | received prefix-filter | policy [detail]]]
Example:
Device# show ip bgp neighbors 192.168.1.2
|
(Optional) Displays information about TCP and BGP connections to neighbors.
-
"Graceful Restart Capability: advertised" will be displayed for each neighbor that has exchanged graceful restart capabilities with this router.
-
In this example, the output is filtered to display information about the BGP peer at 192.168.1.2.
|
Examples
The following example shows partial output from the show ip bgp neighbors command for the BGP peer at 192.168.1.2 (Router A in the figure above). Graceful restart is shown as enabled. Note the default values for the restart and stale-path timers. These timers can be set only by using the bgp graceful-restart command.
Device# show ip bgp neighbors 192.168.1.2
BGP neighbor is 192.168.1.2, remote AS 40000, external link
Inherits from template S1 for session parameters
BGP version 4, remote router ID 192.168.1.2
BGP state = Established, up for 00:02:11
Last read 00:00:23, last write 00:00:27, hold time is 180, keepalive intervals
Neighbor sessions:
1 active, is multisession capable
Neighbor capabilities:
Route refresh: advertised and received(new)
Address family IPv4 Unicast: advertised and received
Graceful Restart Capability: advertised
Multisession Capability: advertised and received
!
Address tracking is enabled, the RIB does have a route to 192.168.1.2
Connections established 1; dropped 0
Last reset never
Transport(tcp) path-mtu-discovery is enabled
Graceful-Restart is enabled, restart-time 120 seconds, stalepath-time 360 secs
Connection state is ESTAB, I/O status: 1, unread input bytes: 0
The following example shows partial output from the show ip bgp neighbors command for the BGP peer at 192.168.3.2 (Router E in the figure above). Graceful restart is shown as disabled.
Device# show ip bgp neighbors 192.168.3.2
BGP neighbor is 192.168.3.2, remote AS 50000, external link
Inherits from template S2 for session parameters
BGP version 4, remote router ID 192.168.3.2
BGP state = Established, up for 00:01:41
Last read 00:00:45, last write 00:00:45, hold time is 180, keepalive intervals
Neighbor sessions:
1 active, is multisession capable
Neighbor capabilities:
Route refresh: advertised and received(new)
Address family IPv4 Unicast: advertised and received
!
Address tracking is enabled, the RIB does have a route to 192.168.3.2
Connections established 1; dropped 0
Last reset never
Transport(tcp) path-mtu-discovery is enabled
Graceful-Restart is disabled
Connection state is ESTAB, I/O status: 1, unread input bytes: 0