BGP Route Dampening

A flapping route is an unstable route that is advertised and withdrawn over and over again. Every time a flap occurs, a BGP UPDATE message is sent. When routers have to process many BGP UPDATE messages, their CPU load increases.

BGP route dampening can be used to prevent installing flapping BGP routes and forwarding them to other BGP routers. This decreases the CPU load of routers and increases network stability. Nowadays, routers are powerful enough to process BGP updates so dampening isn’t considered a best practice anymore. Back in the 90s, routers weren’t so powerful.

In fact, there are issues with best path selection when you use BGP route dampening so you shouldn’t blindly enable this feature for all routes.




Let’s take a look at how BGP route dampening works. There are five attributes:

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

I included the default values for Cisco IOS. In a nutshell, here’s how it works:

  • Each time a route flaps, the penalty is increased by 1000.
  • When the route exceeds the suppress limit, the route is dampened.
  • Once the route is dampened, the router won’t install the route in the routing table nor advertise it to other BGP neighbors.
  • When the router learns again about a route with a penalty, the half-life timer starts. When half-life is reached, the penalty is reduced by 50%.
  • To install or advertise the route again, the penalty has to be lower than a reuse limit.
  • Once the penalty is below 50% of the reuse limit, the penalty is removed completely.

Let me give you an example:

  • The penalty is 4000 and the half-life time is 15 minutes.
  • After 15 minutes the penalty is 2000.
  • After another 15 minutes, the penalty is 1000.
  • Another 15 minutes and the penalty is 500.

Once the penalty is below the reuse limit of 750, the route can be used again and advertised to other BGP routers. When the penalty is below 50% of the reuse limit, the penalty is removed from the route.

The maximum suppress limit ensures that a route won’t be dampened forever. The maximum suppress time is 60 minutes by default.

Configuration

Let’s see how we configure BGP dampening. This is the topology we’ll use:

R1 R2 As1 As2 Loopback0

I’m using IOSv Software version 15.9(3)M2.

Configurations

Want to take a look for yourself? Here you will find the startup configuration of each device.

R1

hostname R1
!
ip cef
!
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
!
interface GigabitEthernet0/0
 ip address 192.168.12.1 255.255.255.0
!
router bgp 1
 network 1.1.1.1 mask 255.255.255.255
 neighbor 192.168.12.2 remote-as 2
 !
end

R2

hostname R2
!
ip cef
!
interface GigabitEthernet0/0
 ip address 192.168.12.2 255.255.255.0
!
router bgp 2
 neighbor 192.168.12.1 remote-as 1
!
end

There are two routers, each in their own AS. R1 has a loopback interface that we advertise through BGP.

We have two options to configure BGP route dampening:

  • Global
  • Route-map

Global

When you enable BGP route dampening globally, it affects all routes. This is how to enable it:

R2(config)#router bgp 2
R2(config-router)#bgp dampening

Route-Map

The alternative is to include a route-map. This way, you can specify which routes you want to enable dampening for:

R2(config)#ip access-list standard R1_L0
R2(config-std-nacl)#permit host 1.1.1.1

R2(config)#route-map DAMPENING permit 10
R2(config-route-map)#match ip address R1_L0
R2(config-route-map)#set dampening 15 750 2000 60  

R2(config)#router bgp 2
R2(config-router)#bgp dampening route-map DAMPENING

I’ll keep it simple and use the global option for now.

Verification

Let’s see what we have. R2 has learned route 1.1.1.1/32 from R1:

R2#show ip bgp
BGP table version is 2, local router ID is 192.168.12.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
              t secondary path, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>   1.1.1.1/32       192.168.12.1             0             0 1 i

The route is installed in the routing table:

R2#show ip route bgp

      1.0.0.0/32 is subnetted, 1 subnets
B        1.1.1.1 [20/0] via 192.168.12.1, 00:07:15

Let’s try whether route dampening works or not. Let’s check the timers. You can see them in the running configuration:

R2#show run all | include dampening
 bgp dampening 15 750 2000 60

Or you can use this show command:

R2#show ip bgp dampening parameters
 dampening 15 750 2000 60 (DEFAULT)
  Half-life time      : 15 mins       Decay Time       : 2320 secs
  Max suppress penalty: 12000         Max suppress time: 60 mins
  Suppress penalty    :  2000         Reuse penalty    : 750

To see route dampening in action, I’ll enable a debug on R2:

R2#debug ip bgp dampening
BGP dampening debugging is on for all address families

To simulate a flapping route, we’ll shut the loopback interface of R1:

R1(config)#interface Loopback 0
R1(config-if)#shutdown

Now take a look at R2:

R2#debug ip bgp dampening
BGP dampening debugging is on for all address families
R2#
EvD: charge penalty 1000, new accum. penalty 1000, flap count 1
EvD: unsuppress item left in reuse timer array with penalty 1000
BGP(0): charge penalty for 1.1.1.1/32 path 1 with halflife-time 15 reuse/suppress 750/2000
BGP(0): flapped 1 times since 00:00:00. New penalty is 1000

In the output above, you can see that route 1.1.1.1/32 has flapped 1 time and now has a penalty of 1000. If you wait, you’ll also see some debug messages:

R2#
EvD: accum. penalty decayed to 958 after 60 second(s)
EvD: accum. penalty decayed to 924 after 60 second(s)

In the output above, we can see that the penalty is slowly decreasing (decaying).

R2#show ip bgp dampening flap-statistics 
BGP table version is 3, local router ID is 192.168.12.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
              t secondary path, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

    Network          From            Flaps Duration Reuse    Path
 h  1.1.1.1/32       192.168.12.1    1     00:02:19          1

Even though the 1.1.1.1/32 route is now gone, R2 keeps track of it. You can see the current penalty here:

R2#show ip bgp 1.1.1.1/32
BGP routing table entry for 1.1.1.1/32, version 14
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 1
  1
    192.168.12.1 from 192.168.12.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, external, best
      Dampinfo: penalty 872, flapped 1 times in 00:02:29
      rx pathid: 0, tx pathid: 0x0

Let’s see if we can get this route dampened. I’ll make the loopback interface flap one more time:

R1(config)#interface Loopback 0
R1(config-if)#no shutdown
R1(config-if)#shutdown

This is what we see on R2:

R2#
EvD: charge penalty 1000, new accum. penalty 1835, flap count 2
EvD: unsuppress item left in reuse timer array with penalty 1835
BGP(0): charge penalty for 1.1.1.1/32 path 1 with halflife-time 15 reuse/suppress 750/2000
BGP(0): flapped 2 times since 00:03:52. New penalty is 1835

The route receives another penalty (1000) and the current penalty is 1835. This is still below the suppress-limit threshold (2000) so we’ll make the interface flap one more time:

R1(config)#interface Loopback 0
R1(config-if)#no shutdown
R1(config-if)#shutdown

The route gets another penalty:

R2#
EvD: charge penalty 1000, new accum. penalty 2691, flap count 3
EvD: unsuppress item left in reuse timer array with penalty 2691
BGP(0): charge penalty for 1.1.1.1/32 path 1 with halflife-time 15 reuse/suppress 750/2000
BGP(0): flapped 3 times since 00:05:44. New penalty is 2691

We are now above the suppress-limit threshold (2000) so let’s see what happens when we enable the loopback interface again:

R1(config)#interface Loopback 0
R1(config-if)#no shutdown

R2 now dampens the route:

R2#
BGP(0): suppress 1.1.1.1/32 path 1 for 00:24:40 (penalty 2349)
halflife-time 15, reuse/suppress 750/2000
EvD: accum. penalty 2349, now suppressed with a reuse intervals of 148

R2 suppresses the router and won’t use it. We can also see this in the following show command:

R2#show ip bgp dampening flap-statistics 
BGP table version is 7, local router ID is 192.168.12.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
              t secondary path, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

    Network          From            Flaps Duration Reuse    Path
*d  1.1.1.1/32       192.168.12.1    3     00:09:27 00:02:09 1 

The route shows up as dampened. You can also use this show command:

R2#show ip bgp dampening dampened-paths 
BGP table version is 7, local router ID is 192.168.12.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
              t secondary path, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

   Network          From             Reuse    Path
*d 1.1.1.1/32       192.168.12.1     00:01:59 1 i

The route still shows up in the BGP table:

R2#show ip bgp
BGP table version is 7, local router ID is 192.168.12.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
              t secondary path, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *d   1.1.1.1/32       192.168.12.1             0             0 1 i

But it won’t be installed in the routing table:

R2#show ip route bgp

If you have fixed the issue why the route is flapping, you can also clear bgp dampening manually with the clear ip bgp dampening 1.1.1.1 255.255.255.255 command.

if you wait long enough, the route will be used again:

R2#
EvD: accum. penalty decayed to 2634 after 60 second(s)
EvD: accum. penalty decayed to 2513 after 60 second(s)
EvD: accum. penalty decayed to 2422 after 60 second(s)

[output omitted]
EvD: accum. penalty decayed to 882 after 60 second(s)
EvD: accum. penalty decayed to 748 after 60 second(s)
EvD: accum. penalty 748, now unsuppressed
BGP(0): Unsuppressed 1.1.1.1/32, path 1
EvD: accum. penalty decayed to 729 after 60 second(s)
EvD: accum. penalty decayed to 695 after 60 second(s)

Once the penalty is below the reuse limit (750), we can use the route again.  You won’t see the route anymore in this show command:

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You’ve Ever Spent on Your Cisco Career!
  • Full Access to our 787 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

625 Sign Ups in the last 30 days

satisfaction-guaranteed
100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!

Forum Replies

  1. A few things that needs to be explained here:

    Why is the penalty value getting decayed every 60 seconds, the article only mentions about one method of bringing down the penalty value i.e. half life which has a default value of 15 minutes. It is mentioned that when half life is reached the penalty is decayed by 50%

    EvD: accum. penalty decayed to 526 after 60 second(s)
    EvD: accum. penalty decayed to 502 after 60 second(s)
    EvD: accum. penalty decayed to 479 after 60 second(s)

    I am guessing that this 50% decrease is achieved by incrementally decaying the penalty ev

    ... Continue reading in our forum

  2. Hello Muhammad

    I understand your confusion. It is true that the penalty is decreased by 50% every 15 minutes. This however does not occur “all at once” when 15 minutes have elapsed. It takes place gradually over time.

    From the output you have in your post, you see that after 60 seconds the penalty has been reduced by 24. It is later reduced by 23 in the next 60 seconds. The rate of reduction every 60 seconds is such that by the time 15 minutes have elapsed, the value will reach 50% of what it was 15 minutes ago.

    I will ask Rene to add this detail to the le

    ... Continue reading in our forum

  3. Hi Rene and team.
    Thank you for all you do. My question here is:

    what if we still need to reach network 1.1.1.1/32 from R2 after dampening. Why not just shutdown Lo0 interface if we did not need the route on R2’s routing table?

  4. Hello Ayong

    Dampening is used to temporarily prevent changing network conditions from repeatedly installing and removing routes from BGP tables. If you still need to reach 1.1.1.1/32, well that’s life :stuck_out_tongue: . What I mean is, there’s nothing you can do. You must simply wait until the network stabilizes, and until the penalties expire to be able to reach that network once again.

    You suggest that the Lo0 interface can be shutdown to resolve the issue. Well, if you’re an admin, would you be able to determine that quickly enough to go in and shut it down? And if you

    ... Continue reading in our forum

  5. Thank you for clarifying that Las. Well understood.

Ask a question or join the discussion by visiting our Community Forum