BGP prefix flapping can be caused by different issues in network. Basically every unstable network where links are unreliably and are going up and down here and there can cause BGP prefix flapping. Every prefix flap will cause some networks to became unreachable. BGP process will then need to recalculate best-path in order to hopefully find other way to get towards unreachable network.
Impact on the network can be enormous as one network prefix missing can mean that huge number of other networks will change the path on which they are reachable. In the situation of prefix flap we have the prefix going up and down all the time. After every status change all those efforts of finding new best-path are done, and when the prefix comes back, everything is calculated again and becomes like before. We have a way to cut the impact of flapping prefixes.
By implementing BGP prefix dampening. When configured, dampening will punish those prefixes that are changing state from reachable to unreachable few time in determined time period. After every flap BGP will give to that prefix a defined penalty of 1000 by default. The penalty points will immediately start to be reduced exponentially but if the prefix flaps more times in little time period he will surely collect enough point to reach Suppress Limit and BGP will at that point mark the prefix as damped. It means that it will immediately suppress the advertisement of the prefix until the penalty points do not fall below Reuse Limit which is 1000 by default. Suppress limit is 2000 by default and yes, there will be needed for prefix to flap three times in order to be suppressed by default (you need to count that the first penalty will be 1000, next one also 1000, but the first one will fall at least by 1 to 999 before second flap occurs.)
Dampening enables prefix advertisement of stable prefixes only and all prefixes that have some flapping issues will be temporarily suppressed until they do not get stable again.
Exponential penalty reduction process is working like this: It will decrease the penalty every five seconds. There is one factor that can be used to control the speed of the prefix dampening and is called Half-Life period. It’s the time period needed for damped prefix to decrease his penalty by half. Half-Life default value is 15.
It’s strange but here’s the process of finding the Half-Life value for desired prefix reuse time:
If we want the damped prefix to be used again in 7 minutes with Suppress Limit and Reuse Limit leaved to their default:
2000/1000=2^(7/Half-Life)
Half_Life=7*Ln(2)/Ln(200/100)=7
Configuration is like this in examples and it’s
(config)#bgp dampening half-life reuse suppress max-suppress [route-map map-name]
To be able to control when you would like to get prefix advertised again you can calculate and configure Half-Life attribute. Maximum Suppress Time in max time to have a prefix suppressed after being damped. It is usually 4*Half-Life.
router bgp 400 bgp dampening 7 1000 2000 28
ip as-path access-list 100 permit _400$ ! route-map DAMPENING match as-path 100 set dampening 7 1000 2000 28 router bgp 400 bgp dampening route-map DAMPENING