< Home

Configuring BGP Keepalive and Hold Timers

The values of BGP Keepalive and hold timers determine the speed at which BGP detects network faults. You can adjust the values of these timers to improve network performance.

Context

Keepalive messages are used by BGP to maintain peer relationships. After establishing a BGP connection, two peers periodically send Keepalive messages to each other to detect BGP peer relationship status. If a device receives no Keepalive message from its peer after the hold timer expires, the device considers the BGP connection to be closed.

  • If short Keepalive time and holdtime are set, BGP can detect a link fault quickly. This speeds up BGP network convergence, but increases the number of Keepalive messages on the network and loads of routers, and consumes more network bandwidth resources.
  • If long Keepalive time and holdtime are set, the number of Keepalive messages on the network is reduced. This reduces loads of routers. If the Keepalive time is too long, BGP is unable to detect link status changes in a timely manner. This is unhelpful for implementing rapid BGP network convergence and may cause many packets to be lost.

If the values of the timers change after the timer command or the peer timer command is run, the BGP connection set up among routers is interrupted. So, confirm the action before you use the command.

Keepalive and hold timers can be configured either for all peers or peer groups, or for a specific peer or peer group. Keepalive and hold timers configured for a specific peer take precedence over those configured for the peer group of this peer. In addition, Keepalive and hold timers configured for a specific peer or peer group take precedence over those configured for all peers or peer groups.

Procedure

  • Configure the global timer.
    1. Access the system view.

      system-view

    2. Access the BGP view.

      bgp { as-number-plain | as-number-dot }

    3. Set BGP timers.

      timer keepalive keepalive-time hold hold-time [ min-holdtime min-holdtime ]

      The proper maximum interval at which Keepalive messages are sent is one third the holdtime and is not less than one second. If the holdtime is not set to 0, it is 3s at least. By default, the keepalive-time value is 60s and the hold-time value is 180s.

      Setting the Keepalive time to 20s is recommended. If the Keepalive time is smaller than 20s, sessions between peers may be closed.

      When setting values of keepalive-time and hold-time, note the following points:

      • The keepalive-time and hold-time values cannot be both set to 0. Otherwise, the BGP timers become invalid, meaning that BGP will not send Keepalive messages to detect connection status.
      • The hold-time value cannot be much greater than the keepalive-time value. For example, keepalive-time cannot be set to 1 while hold-time is set to 65535. If the hold-time value is too large, BGP cannot detect connection status in time.

      After a connection is established between peers, the keepalive-time and hold-time values are negotiated by the peers. The smaller one of the hold-time values carried by Open messages of both peers is taken as the hold-time value. The smaller of one third of the hold-time value and the locally configured keepalive-time value is taken as the 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 the value of min-holdtime is changed, but the values of keepalive-time and hold-time negotiated between two BGP peers remain unchanged, the established peer relationship is not affected. Only when the local device attempts to re-establish a relationship with a remote device, the value of min-holdtime configured on the local device takes effect. The local device compares min-holdtime with hold-time sent from the remote device. If the value of min-holdtime exceeds that of hold-time, hold-time negotiation fails, and the peer relationship fails to be established.

      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.

  • Configure the peer timer.
    1. Access the system view.

      system-view

    2. Access the BGP view.

      bgp { as-number-plain | as-number-dot }

    3. Set the Keepalive and hold timer values for a specific peer or peer group.

      peer timer { ipv4-address | group-name } timer keepalive keepalive-time hold hold-time

      For information about the relationship between the keepalive-time and hold-time values, see Configure BGP timers for all peers or peer groups.

      Setting the Keepalive time to 20s is recommended. If the Keepalive time is smaller than 20s, sessions between peers may be closed.

      Timers set for a specific peer or peer group take precedence over timers set for all peers or peer groups.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >