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

Source

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s