BGP Timers for Faster Failover
Cisco devices running BGP have a default Keepalive timer of 60 seconds and a default Holdtime of 180 seconds.
This means that it will take about 3 minutes for routing to failover to another BGP peer. In most cases this is adequate and but sometime you may want faster convergence.
One option to decrease that BGP failover time is to adjust the BGP timers, however care should be taken in how "fast" you want them. Too fast of timers with a flapping circuit or interface could create a lot of havoc in the network. Use with your own discretion.
The example below is pretty aggressive and allows for Keepalive of 7 seconds and Holdtime of 21 seconds allowing for failover in about 21 seconds.
Commands:
Router BGP 12345
Timers bgp 7 21
Example:
RTR_3(config-router)#router bgp 12345
RTR_3(config-router)#timers bgp ?
<0-65535> Keepalive interval
RTR_3(config-router)#timers bgp 7 ?
<0-65535> Holdtime
RTR_3(config-router)#timers bgp 7 21 ?
<0-65535> Minimum hold time from neighbor
<cr> <cr>
RTR_3(config-router)#timers bgp 7 21
RTR_3#sh run | sec bgp
router bgp 12345
network 192.168.100.0 mask 255.255.255.248
timers bgp 7 21
redistribute static
neighbor 192.168.100.5 remote-as 54321
neighbor 192.168.100.5 description RTR_1
neighbor 192.168.100.5 soft-reconfiguration inbound
neighbor 192.168.100.6 remote-as 54321
neighbor 192.168.100.6 description RTR_2
neighbor 192.168.100.6 soft-reconfiguration inbound
The command above will change the BGP timers for ALL BGP peers on that router, and will need to have the same timers set on all of it's BGP peers in order to be effective both directions.
If you want to only change the timers for SPECIFIC BGP Peers and leave all other peers as default, use the Neighbor command with Timers on both of those specific BGP peers.
Example below:
RTR_3(config)#router bgp 12345
RTR_3(config-router)#neighbor 192.168.100.5 timers ?
<0-65535> Keepalive interval
RTR_3(config-router)#neighbor 192.168.100.5 timers 7 ?
<0-65535> Holdtime
RTR_3(config-router)#neighbor 192.168.100.5 timers 7 21 ?
<0-65535> Minimum hold time from neighbor
<cr> <cr>
Dont forget the other side of that BGP peer...
RTR_1(config)#router bgp 54321
RTR_1(config-router)#neighbor 192.168.100.1 timers ?
<0-65535> Keepalive interval
RTR_1(config-router)#neighbor 192.168.100.1 timers 7 ?
<0-65535> Holdtime
RTR_1(config-router)#neighbor 192.168.100.1 timers 7 21 ?
<0-65535> Minimum hold time from neighbor
<cr> <cr>
Again, be cautious of how aggressive you set the timers and do not use if you have network instability that could cause flapping.
Cisco devices running BGP have a default Keepalive timer of 60 seconds and a default Holdtime of 180 seconds.
This means that it will take about 3 minutes for routing to failover to another BGP peer. In most cases this is adequate and but sometime you may want faster convergence.
One option to decrease that BGP failover time is to adjust the BGP timers, however care should be taken in how "fast" you want them. Too fast of timers with a flapping circuit or interface could create a lot of havoc in the network. Use with your own discretion.
The example below is pretty aggressive and allows for Keepalive of 7 seconds and Holdtime of 21 seconds allowing for failover in about 21 seconds.
Commands:
Router BGP 12345
Timers bgp 7 21
Example:
RTR_3(config-router)#router bgp 12345
RTR_3(config-router)#timers bgp ?
<0-65535> Keepalive interval
RTR_3(config-router)#timers bgp 7 ?
<0-65535> Holdtime
RTR_3(config-router)#timers bgp 7 21 ?
<0-65535> Minimum hold time from neighbor
<cr> <cr>
RTR_3(config-router)#timers bgp 7 21
RTR_3#sh run | sec bgp
router bgp 12345
network 192.168.100.0 mask 255.255.255.248
timers bgp 7 21
redistribute static
neighbor 192.168.100.5 remote-as 54321
neighbor 192.168.100.5 description RTR_1
neighbor 192.168.100.5 soft-reconfiguration inbound
neighbor 192.168.100.6 remote-as 54321
neighbor 192.168.100.6 description RTR_2
neighbor 192.168.100.6 soft-reconfiguration inbound
The command above will change the BGP timers for ALL BGP peers on that router, and will need to have the same timers set on all of it's BGP peers in order to be effective both directions.
If you want to only change the timers for SPECIFIC BGP Peers and leave all other peers as default, use the Neighbor command with Timers on both of those specific BGP peers.
Example below:
RTR_3(config)#router bgp 12345
RTR_3(config-router)#neighbor 192.168.100.5 timers ?
<0-65535> Keepalive interval
RTR_3(config-router)#neighbor 192.168.100.5 timers 7 ?
<0-65535> Holdtime
RTR_3(config-router)#neighbor 192.168.100.5 timers 7 21 ?
<0-65535> Minimum hold time from neighbor
<cr> <cr>
Dont forget the other side of that BGP peer...
RTR_1(config)#router bgp 54321
RTR_1(config-router)#neighbor 192.168.100.1 timers ?
<0-65535> Keepalive interval
RTR_1(config-router)#neighbor 192.168.100.1 timers 7 ?
<0-65535> Holdtime
RTR_1(config-router)#neighbor 192.168.100.1 timers 7 21 ?
<0-65535> Minimum hold time from neighbor
<cr> <cr>
Again, be cautious of how aggressive you set the timers and do not use if you have network instability that could cause flapping.