The peer timer command sets the Keepalive timer and Hold timer for a peer or peer group.
The undo peer timer command restores the default values of the Keepalive timer and Hold timer.
By default, the value of a Keepalive timer is 60s and the value of a Hold timer is 180s.
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 a peer group. | The name is a string of 1 to 47 case-sensitive characters, with spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string. |
ipv4-address | Specifies the IPv4 address of a peer. | It is in dotted decimal notation. |
ipv6-address | Specifies the IPv6 address of a peer. | The value is a 32-digit hexadecimal number, in the format of X:X:X:X:X:X:X:X. |
keepalive-time | Specifies the Keepalive period. | The value is an integer that ranges from 0 to 21845, in seconds. |
hold-time | Specifies the holdtime. | The value is an integer that can be 0, or 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 that ranges 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, 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.
The peer timer command is used to set the Keepalive period and holdtime.
If short Keepalive period and holdtime are set, BGP can detect a link fault quickly and implement link switching. The number of Keepalive messages on the network, however, is increased. This increases device loads and consumption of network bandwidth resources.
If long Keepalive period and holdtime are set, the number of Keepalive messages on the network is reduced. This reduces device loads. If, however, the Keepalive period is too long, BGP is unable to detect link status changes in a timely manner, causing many packets to be lost.
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
Peer relationships have been established using the peer as-number command.
Precautions
If the value of a timer changes, the BGP peer relationship between devices will be disconnected. This is because the devices need to re-negotiate the values of keepalive-time and hold-time. Therefore, exercise caution before changing the value of a timer.
The Keepalive period must be at least three times of the holdtime.
When setting the values of keepalive-time and hold-time, note the following points:
The values of keepalive-time and 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 timer 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 take 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.