The timer command configures the Keepalive and Holdtime interval of BGP. The Holdtime period must be at least three times of the Keepalive period.
The undo timer command restores the default values of the Keepalive and Holdtime timer.
By default, the Keepalive time is 60 seconds, and the Holdtime is 180 seconds.
timer keepalive keepalive-time hold hold-time [ min-holdtime min-holdtime ]
undo timer keepalive keepalive-time hold hold-time [ min-holdtime min-holdtime ]
undo timer keepalive hold [ min-holdtime ]
| Parameter | Description | Value |
|---|---|---|
| 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 to be longer than 20s is recommended. If the hold interval
of a BGP peer 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. |
Applicable Environment
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.
After peers set up connections, 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 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.
Effect
If the value of a timer changes, the BGP peer relationship among routers is disconnected because the peers need to re-negotiate the Keepalive period and Holdtime. Exercise caution when using the timer command.
Note
In actual configuration, the Holdtime period 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 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 takes precedence over the global Keepalive period and Holdtime. This command can globally change the Keepalive period and Holdtime on all peers, but cannot change the value on a peer or peer group configured through the peer timer command.