Overview

BGP neighbors are basically maintained by exchanging KEEPALIVE messages periodically; this section describes the timer settings related to KEEPALIVE messages.

What is KEEPALIVE Timer/Hold Time?

Use KEEPALIVE messages to maintain BGP neighbors. Periodically sending KEEPALIVE messages to let the neighbor know that it is working properly. The KEEPALIVE timer is the interval at which KEEPALIVE messages are sent. The hold time is the amount of time that the neighbor is considered to be down without receiving a periodic KEEPALIVE from the neighbor.

The default values for each timer in Cisco IOS are as follows

  • KEEPALIVE timer : 60sec
  • Hold time : 180sec

Of course, the hold time must be greater than the KEEPALIVE timer. Recommended hold time is three times the KEEPALIVE timer.

BGP neighbors can also be maintained by BFD (Bidirectional Forwarding Detection) without BGP KEEPALIVE messages.

KEEPALIVE timer/hold time configuration and verification commands

KEEPALIVE timer/hold time configuration

To change the KEEPALIVE timer and hold time values, use the following commands.

KEEPALIVE timer/hold time configuration

(config)#router bgp <AS>
(config-router)#timers bgp <keepalive> <holdtime>

<AS>:AS number
<keepalive> : KEEPALIVE timer. default 60sec
<holdtime> : Hold time. default 180sec

The timers bgp command changes the timers for all neighbors. It is also possible to configure individual KEEPALIVE timer values and hold time values for each neighbor.

KEEPALIVE timer/hold time configuration (each neighbor)

(config)#router bgp <AS>
(config-router)#neighbor <ip-address> timers <keepalive> <holdtime>

<AS>:AS number
<ip-address>: neighbor IP address
<keepalive> : KEEPALIVE timer. default 60sec
<holdtime> : Hold time. default 180sec

If both the timers bgp command and the neighbor timers command are configured, the neighbor timers command overrides the timers bgp command. If the KEEPALIVE timer value and the Hold time value do not match between neighbors, they are automatically adjusted to the smaller value when neighbor is established.

KEEPALIVE timer/hold time verifycation

The main command to verify the KEEPALIVE timer/hold time.

CommandOverview
#show ip bgp neighborDisplays details of the BGP neighbor.

show ip bgp neigbhor

R1#show ip bgp neighbors 172.16.1.11
BGP neighbor is 172.16.1.11,  remote AS 1, external link
  BGP version 4, remote router ID 111.1.1.11
  BGP state = Established, up for 00:18:51
  Last read 00:00:31, hold time is 150, keepalive interval is 50 seconds
  Neighbor capabilities:
    Route refresh: advertised and received(old & new)
    Address family IPv4 Unicast: advertised and received
-- omitted --
R1#show ip bgp neighbors 172.16.1.22
BGP neighbor is 172.16.1.22,  remote AS 2, external link
  BGP version 4, remote router ID 222.2.2.22
  BGP state = Established, up for 00:15:27
  Last read 00:01:00, hold time is 30, keepalive interval is 10 seconds
  Configured hold time is 30, keepalive interval is 10 seconds
  Neighbor capabilities:
    Route refresh: advertised and received(old & new)
    Address family IPv4 Unicast: advertised and received
-- omitted --

KEEPALIVE timer/hold time configuration example

Network Diagram

Verify the timer with the following network diagram.

Figure KEEPALIVE timer/hold time configuration example
Figure KEEPALIVE timer/hold time configuration example

BGP configuration for each router

The BGP configuration for each router is as follows

R1 BGP Configuration

router bgp 100
 no synchronization
 bgp log-neighbor-changes
 neighbor 172.16.1.11 remote-as 1
 neighbor 172.16.1.22 remote-as 2
 neighbor 172.16.1.22 timers 10 30
 no auto-summary

ISP1 BGP Configuration

router bgp 1
 bgp log-neighbor-changes
 timers bgp 50 150
 neighbor 172.16.1.1 remote-as 100
 no auto-summary

ISP2 BGP Configuration

router bgp 2
 no synchronization
 bgp log-neighbor-changes
 timers bgp 70 210
 neighbor 172.16.1.1 remote-as 100
 no auto-summary

Verify KEEPALIVE timer and Hold time

Summarize the timer values configured and actual timer values between each neighbor.

  • R1-ISP1
    • R1 Configuration : KEEPALIVE 60s/Hold time 180s (default)
    • ISP1 Configuration : KEEPALIVE 50s/Hold time 150s
    • Actual timer value : KEEPALIVE 50s/Hold time 150s
  • R1-ISP2
    • R1 Configuration : KEEPALIVE 10s/Hold time 30s
    • ISP2 Configuration : KEEPALIVE 70s/Hold time 210s
    • Actual timer value : KEEPALIVE 10s/Hold time 30s

If the timer values do not match between neighbors, the smaller timer value will be used. Verify this with the show ip bgp neighbor command on R1.

R1 show ip bgp neigbhor

R1#show ip bgp neighbors 172.16.1.11
BGP neighbor is 172.16.1.11,  remote AS 1, external link
  BGP version 4, remote router ID 111.1.1.11
  BGP state = Established, up for 00:18:51
  Last read 00:00:31, hold time is 150, keepalive interval is 50 seconds
  Neighbor capabilities:
    Route refresh: advertised and received(old & new)
    Address family IPv4 Unicast: advertised and received
-- omitted --
R1#show ip bgp neighbors 172.16.1.22
BGP neighbor is 172.16.1.22,  remote AS 2, external link
  BGP version 4, remote router ID 222.2.2.22
  BGP state = Established, up for 00:15:27
  Last read 00:01:00, hold time is 30, keepalive interval is 10 seconds
  Configured hold time is 30, keepalive interval is 10 seconds
  Neighbor capabilities:
    Route refresh: advertised and received(old & new)
    Address family IPv4 Unicast: advertised and received
-- omitted --

Summary

Points

  • BGP neighbors are basically maintained by exchanging KEEPALIVE messages periodically.
  • The defaults for the KEEPALIVE timer, which sends the KEEPALIVE message, and the hold time at which the neighbor is considered down are as follows
    • KEEPALIVE timer : 60 sec
    • Hold time : 180 sec
  • Timer changes can be configured in the BGP process or on a per-neighbor basis.
  • If the timers do not match between neighbors, they are adjusted to the smaller value.