The peer timer command configures the Keepalive and Holdtime intervals for a specified peer or peer group.
The undo peer timer command restores the default value of the timer.
By default, the Keepalive interval is 60 seconds, and the Holdtime is 180 seconds.
peer { group-name | ipv4-address | ipv6-address } timer keepalive keepalive-time hold hold-time [ min-holdtime min-holdtime ]
undo peer { group-name | ipv4-address | ipv6-address } timer keepalive keepalive-time hold hold-time [ min-holdtime min-holdtime ]
undo peer { group-name | ipv4-address | ipv6-address } timer keepalive hold [ min-holdtime ]
| Parameter | Description | Value |
|---|---|---|
group-name |
Specifies the name of the peer group. |
The name is a string of 1 to 47 characters without any space. It is case-sensitive. |
ipv4-address |
Specifies the IPv4 address of the peer. |
It is in dotted decimal notation. |
ipv6-address |
Specifies the IPv6 address of the peer. |
The prefix is a 32-digit hexadecimal number, in the format of X:X:X:X:X:X:X:X. |
keepalive keepalive-time |
Specifies the Keepalive interval. |
It is an integer that ranges from 0 to 21845, in seconds. |
hold hold-time |
Specifies the Holdtime interval. |
The value is 0 or an integer that ranges from 3 to 65535, in seconds. NOTE:
Setting the hold interval of a BGP peer or peer group to be longer than 20s is recommended. If the hold interval of a BGP peer or peer group is shorter than 20s, the session may be closed. |
min-holdtime min-holdtime |
Specifies the minimum Holdtime configured on the local device.
NOTE:
The value of min-holdtime configured cannot exceed the value of hold-time. |
The value is an integer ranging from 20 to 65535, in seconds. |
ipv4-address is valid only in the BGP view and BGP-VPN instance IPv4 address family view.
ipv6-address is valid only in the BGP view and BGP-VPN instance IPv6 address family view.
BGP view, BGP-VPN instance IPv4 address family view, and BGP-VPN instance IPv6 address family view
Usage Scenario
After establishing a BGP connection, two peers send Keepalive messages periodically to each other to detect the status of the BGP connection. If a device receives no Keepalive message or any other types of packets from its peer within the holdtime, the device considers the BGP connection closed, and it closes the BGP connection.
When the peers set up a connection, the values of keepalive-time and hold-time are determined by negotiations between the peers. Each of the two peers sends the other an Open packet containing hold-time. The smaller of the hold-time values contained in the Open packets from both peers is used. The smaller of the locally configured keepalive-time value and one third of the negotiated hold-time value is used as the actual keepalive-time value.
If the local device establishes BGP peer relationships with many devices, it needs to process huge BGP messages. If hold-time negotiated among BGP peers is small, the timer may expire before the local device processes the Keepalive messages sent from other BGP peers. The peer relationships are then interrupted, and routes flap. To solve the preceding problem, you can configure an appropriate value for min-holdtime min-holdtime based on the CPU processing capability of the local device.
If min-holdtime is configured on the local device, and the value of hold-time sent from the remote device is 0, hold-time negotiation between the two devices succeeds. The negotiated value of hold-time is 0, and the peer relationship is established. The value 0 of hold-time indicates that the peer relationship never expires.
Prerequisites
The peer as-number command has been used to create a peer or peer group.
Configuration Impact
If the value of a timer changes, the BGP peer relationship among routers is disconnected because the peers need to re-negotiate the values of keepalive-time and hold-time. Exercise caution when using the peer timer command.
Precautions
In actual configuration, the holdtime must be at least three times of the Keepalive period.
When setting the values of the two timers, note the following points:
The values of the keepalive-time and the hold-time cannot both be set to 0. This renders the BGP timers invalid. BGP is unable to detect link faults using the timers.
The hold-time value cannot be significantly greater than the keepalive-time value. A setting of keepalive 1 hold 65535, for example, would be improper. If the holdtime is too long, link faults cannot be detected in a timely manner.
The Keepalive period and Holdtime can be configured globally, or on a particular peer or peer group. The Keepalive period and Holdtime configured on a specific peer or peer group takes precedence over the global Keepalive period and Holdtime. Using this command can still change the Keepalive period and Holdtime configured on a peer or peer group, although they were globally configured through the timer command.
# Configure the Keepalive and the Holdtime time of the specified peer 1.1.1.2.
<sysname> system-view [sysname] bgp 100 [sysname-bgp] peer 1.1.1.2 as-number 200 [sysname-bgp] peer 1.1.1.2 timer keepalive 10 hold 30 Warning: Changing the parameter in this command resets the peer session. Continue?(Y/N):y