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

BGP uses Keepalive messages 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 interrupted.

  • If short Keepalive time and holdtime are set, BGP can fast detect link faults. 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 and loads of routers are reduced. If the Keepalive time is too long, BGP cannot fast detect link status changes, which slows down BGP network convergence and may cause packet loss.

Changing timer values using the timer command or the peer timer command interrupts BGP peer relationships between routers. Therefore, exercise caution before running either of 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 BGP timers for all peers or peer groups.
    1. Run system-view

      The system view is displayed.

    2. Run bgp { as-number-plain | as-number-dot }

      The BGP view is displayed.

    3. Run timer keepalive keepalive-time hold hold-time [ min-holdtime min-hold-value ]

      BGP timers are configured.

      The proper maximum interval at which Keepalive messages are sent is one third the Hold timer and cannot be less than 1s. Therefore, set the Hold timer to 3s at least if it is not set to 0s.

      Setting the Hold timer to be longer than 20s is recommended. If the Hold timer is shorter than 20s, BGP peer relationships may be interrupted.

      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, and 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 peers negotiate the keepalive-time and hold-time values. The smaller one of the hold-time values carried by Open messages of both peers is used as the hold-time value. The smaller value of one third of the negotiated hold-time value and the locally configured keepalive-time value is used as the keepalive-time value.

    4. Run commit

      The configuration is committed.

  • Configure timers for a specific peer or peer group.
    1. Run system-view

      The system view is displayed.

    2. Run bgp { as-number-plain | as-number-dot }

      The BGP view is displayed.

    3. Run peer { ipv4-address | group-name } timer keepalive keepalive-time hold hold-time [ min-holdtime min-hold-value ]

      The Keepalive and Hold timer values are set for a specific peer or peer group.

      For information about the relationship between the Keepalive and Hold timer values, see Configuring BGP timers for all peers or peer groups.

      Setting the Hold timer to be longer than 20s is recommended. If the Hold timer is shorter than 20s, BGP peer relationships may be interrupted.

    4. Run commit

      The configuration is committed.

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