ccie blog

BGP Dampening

BGP route dampening can be used to reduce the propagation of unstable routes throughout a network. When a prefix flaps it will be assigned a penalty of 1000 and moved into the dampening state “history”. Each flap incurs another penalty (of 1000), which is applied cumulatively. If the penalty reaches the suppress-limit, the route is dampened, meaning it won’t be advertised to any neighbors. The default values for each dampening criteria are stated below:

  • Penalty :1000
  • Suppress Limit: 2000
  • Reuse Limit: 750
  • Half-Life: 15 Minutes
  • Maximum Suppress-Limit: 60 Minutes

Once a route has been dampened, the penalty must be reduced to a value lower than the reuse limit in order to be advertised once again. The half-life timer does this automatically. After a penalty has been assigned and the prefix has become stable again, the half-life timer starts. When the half-life time has been reached, the penalty will be reduced by half (it decreases exponentially every fifteen minutes). For example, if the penalty was 3000, then fifteen minutes later, the half-life will have reduced the penalty to 1500. Another 15minutes will reduce the penalty to 750, and so on.  Once the penalty goes below half of the re-use limit (375 in this case), the penalty is completely removed.

The maximum suppress-limit is used to ensure the prefix doesn’t get dampened indefinitely.   Using the default values above, a prefix would become un-suppressed after 60 minutes regardless of penalty.

There is also a hidden value called the max penalty; which gets calculated behind the scenes.  It is used to ensure you haven’t entered dampening values that aren’t going to work.  Lets look at an example:

  • Penalty :1000
  • Suppress Limit: 10000
  • Reuse Limit: 1500
  • Half-Life: 30 Minutes
  • Maximum Suppress-Limit: 60 Minutes

To work out the maximum penalty that can possibly be assigned to a prefix you can use the formula below:

max-penalty = reuse-limit * 2^(max-suppress-time/half-life)

Take the values above and insert them into our forumla:

max-penalty = 1500*2^(60/30) = 6000

So a route flap causes a penalty of 1000. When the penalty reaches 10,000, the prefix gets dampened. However, the maximum penalty that can be assigned is 6000. This means we will never incur a penalty significant enough to dampen the prefix. When deploying bgp dampening, you should run your values through the formula above to ensure you can actually dampen prefixes.

Let’s take a look at an example of BGP dampening in action. In the diagram below, we’re going to enable dampening on the 12.12.12.12 prefix.

R2(config)#access-list 1 permit 12.12.12.12
R2(config)#
R2(config)#route-map selective_dampening permit 10
R2(config-route-map)#match ip address 1
R2(config-route-map)#set dampening 5 1900 2000 10
// 5=half-life, 1900=reuse-limit, 2000=suppress-limit, 10 max-suppress-limit
R2(config-route-map)#route-map selective_dampening permit 20
R2(config-route-map)#
R2(config-route-map)#router bgp 3
R2(config-router)#no synchronization
R2(config-router)#bgp log-neighbor-changes
R2(config-router)#bgp dampening route-map selective_dampening
R2(config-router)#neighbor 192.168.0.2 remote-as 2
R2(config-router)#no auto-summary

Let’s check to make sure we are receiving the two prefixes on R2 from R1.

R2#sh ip bgp
BGP table version is 5, local router ID is 192.168.0.1
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale
Origin codes: i – IGP, e – EGP, ? – incomplete

Network                     Next Hop          Metric   LocPrf   Weight Path
*> 12.12.12.12/32     192.168.0.2              0                          0 2 i
*> 13.13.13.13/32     192.168.0.2              0                          0 2 i

Good, everything is working so far.  Let’s start by flapping the 12.12.12.12 prefix one time to see what affect it has in our BGP table.

R2#sh ip bgp
BGP table version is 12, local router ID is 192.168.0.1
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale
Origin codes: i – IGP, e – EGP, ? – incomplete

Network                   Next Hop  Metric  LocPrf  Weight  Path
h 12.12.12.12/32      192.168.0.2       0               0  2 i
*> 13.13.13.13/32      192.168.0.2       0               0  2 i

R2#sh ip bgp 12.12.12.12
BGP routing table entry for 12.12.12.12/32, version 16
Paths: (1 available, no best path)
Flag: 0×820
Not advertised to any peer
2 (history entry)
192.168.0.2 from 192.168.0.2 (13.13.13.13)
Origin IGP, metric 0, localpref 100, external
Dampinfo: penalty 965, flapped 1 times in 00:00:17

The output shows that bgp dampening has put the network into the history state, indicating the router does not have a best path based on historical information.  The Dampinfo (at the bottom) also identified the 12.12.12.12/32 network flapped one time, and assigned a penalty. You can also see that the half life has already started to decay the penalty over the time it took to jump over to R2 and execute the above show commands. Let’s flap the interface a few more times to make the penalty go over the suppress-limit, and in turn, cause the router to dampen the prefix.

R2#sh ip bgp
BGP table version is 12, local router ID is 192.168.0.1
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale
Origin codes: i – IGP, e – EGP, ? – incomplete

Network                Next Hop  Metric  LocPrf  Weight  Path
d 12.12.12.12/32    192.168.0.2       0               0  2 i
*> 13.13.13.13/32   192.168.0.2       0               0  2 i

R2#sh ip bgp 12.12.12.12
BGP routing table entry for 12.12.12.12/32, version 12
Paths: (1 available, no best path)
Flag: 0×820
Not advertised to any peer
2, (suppressed due to dampening) (history entry)
192.168.0.2 from 192.168.0.2 (13.13.13.13)
Origin IGP, metric 0, localpref 100, external
Dampinfo: penalty 3018, flapped 4 times in 00:04:11, reuse in 00:03:20

The Dampinfo shows the network flapped four times, and has now been dampened. The current penalty is 3018, and can be reused in 3minutes 20 seconds. Assume now, that this is a real life situation and an engineer has fixed what he believes caused the route to become unstable on R1.  We want to use the route right away rather than wait for the reuse timer to expire. We can use the following command to achieve this:

R2#clear ip bgp dampening

R2#sh ip bgp
BGP table version is 17, local router ID is 192.168.0.1
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale
Origin codes: i – IGP, e – EGP, ? – incomplete

Network Next             Hop Metric  LocPrf  Weight  Path
*> 12.12.12.12/32       192.168.0.2       0      0   2 i
*> 13.13.13.13/32       192.168.0.2       0      0   2 i

R2#sh ip bgp 12.12.12.12
BGP routing table entry for 12.12.12.12/32, version 15
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0×820
Not advertised to any peer
2
192.168.0.2 from 192.168.0.2 (13.13.13.13)
Origin IGP, metric 0, localpref 100, valid, external, best

As you can see; all penalties have been cleared, and the prefix is no longer dampened. There is another command, very similar to this, that can be used purely to clear the dampening statistics. The command is #clear ip bgp flap-statistics. However, it does not un-dampen the route. Let’s check it out. Behind the scenes, I’ve flapped the interface a bunch of times to dampen the prefix again. Here is the result when clearing the stats:

R2#clear ip bgp flap-statistics 12.12.12.12

BGP table version is 26, local router ID is 192.168.0.1
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale
Origin codes: i – IGP, e – EGP, ? – incomplete

Network                Next Hop  Metric  LocPrf  Weight  Path
d  12.12.12.12/32   192.168.0.2       0               0  2 i
*> 13.13.13.13/32   192.168.0.2       0               0  2 i

R2#sh ip bgp 12.12.12.12
BGP routing table entry for 12.12.12.12/32, version 26
Paths: (1 available, no best path)
Not advertised to any peer
2, (suppressed due to dampening) (history entry)
192.168.0.2 from 192.168.0.2 (13.13.13.13)
Origin IGP, metric 0, localpref 100, external
Dampinfo: penalty 3123, flapped 0 times in 00:02:15, reuse in 00:01:00

So although the prefix remains dampened, the number of flaps has been reset, and we are able to use the route again in one minute.  The only way to un-dampen the route is by using the previous command #clear ip bgp dampening.

If you are troubleshooting dampening on your network in real life, the commands below may also prove useful:

  • show ip bgp dampened-paths
  • show ip bgp flap-statistics

18 Comments

HariJune 5th, 2014 at 4:41 am

Excellent explanation

Avinash G.August 31st, 2014 at 6:41 am

Very detailed explanation, after reading this all doubts got cleared.

A BellSeptember 22nd, 2014 at 6:37 pm

Very nice and simple explanation. Clearly written

RajSeptember 25th, 2014 at 5:18 pm

Good Job!

BalaDecember 21st, 2014 at 4:08 pm

nice work –

UgurFebruary 1st, 2015 at 9:51 am

Can’t say anything else about bgp dampening. great explanation, thank you.

VithobaMay 29th, 2015 at 5:53 am

very clearly explained…Thanks.

AnonymousNovember 11th, 2015 at 7:36 pm

excellent description .tnx

marcelJune 13th, 2016 at 3:17 pm

Looking deeper into it I found the reason.
Apparently these routes are never announced to any neighbor. Even before there was a flap, as there is no 3rd bgp neighbor.

AnonymousSeptember 9th, 2016 at 4:56 am

amazing

zkh S PennaertzFebruary 9th, 2017 at 1:55 pm

Good explanation, used it on the fly

sushithFebruary 27th, 2017 at 3:10 pm

awesome! Thanku so much

MartinAugust 17th, 2017 at 11:56 am

Pretty clear and well explained

MarkSeptember 11th, 2017 at 1:26 pm

Thanks for your explanation of this process, Very clear. Its also worth mentioning in v15 code, BGP dampening is only configurable within the appropriate address family (IPv4/IPv6) and not in default router config mode.

StephenGarbettApril 19th, 2018 at 9:33 pm

Thanks 🙂

CCIE CandidateDecember 7th, 2017 at 2:10 pm

wow, very well explained and appreciate all your effort.

God bless you man

EvgenyDecember 14th, 2017 at 2:39 pm

Does it use for thousands of prefixes in real topologies? How does CPU of routers react?

StephenGarbettJanuary 19th, 2018 at 11:38 pm

Yes, usually there is a tonne of prefixes. The CPU isn’t really affected unless you have 10’s of thousands of routes, or 100’s of thousands of routes like in an ISP. In those cases, you really need to get bigger hardware. But most of the normal branch routers, such as the cisco 4k series can handle thousands of routes now.

Leave a comment

Your comment