8 mins read

BGP – damping

1. Intro

BGP route flapping describes the situation in which BGP systems send an excessive number of update messages to advertise network reachability information.

BGP flap damping is a method of reducing the number of update messages sent between BGP peers, thereby reducing the load on these peers, without adversely affecting the route convergence time for stable routes. In simple, BGP route flap damping helps to diminish route instability caused by routes being repeatedly withdrawn and readvertised when a link is intermittently failing.

You typically apply flap damping to external BGP (EBGP) routes (that is, to routes in different ASs). You can also apply it within a confederation, between confederation member ASs. Because routing consistency within an AS is important, do not apply flap damping to internal BGP (IBGP) routes. (If you do, it is ignored.) The exception to this rule is when flap damping is applied at the address family level. When you apply flap damping at the address family level, it works for both IBGP and EBGP.

Defaults:

  • route flap damping is not enabled by default.
  • half-live minutes – 15 mins
  • max-suppress minutes – 60 mins
  • reuse – 750
  • suppress – 3000

To change the default BGP flap damping values, you define actions by creating a named set of damping parameters and including it in a routing policy with the damping action. For the damping routing policy to work, you also must enable BGP route flap damping.

A figure-of-merit value of zero is assigned to each new route. The value is increased each time the route is withdrawn or readvertised, or when one of its path attributes changes. With each incident of instability, the value increases as follows:

  • Route is withdrawn – 1000
  • Route is readvertised – 1000
  • Route’s path attributes change – 500

To display figure-of-merit information, use the show policy damping command.

2. Basic configuration

Let’s use the following setup to configure BGP damping:

The configuration is the following:

### R1 config: 

set protocols bgp group AS-200 export BGP-EXPORT
set protocols bgp group AS-200 peer-as 200
set protocols bgp group AS-200 neighbor 17.8.0.2

### R2 config: 

set protocols bgp group AS-100 peer-as 100
set protocols bgp group AS-100 neighbor 17.8.0.1
set protocols bgp group iBGP type internal
set protocols bgp group iBGP export NHS
set protocols bgp group iBGP neighbor 17.8.8.2

### R3 config: 

set protocols bgp group iBGP type internal
set protocols bgp group iBGP neighbor 17.8.8.1

The proper place to configure damping in this setup is R2, but let’s try 1st to configure it on R3 instead:

### Configure R3 for basic damping: 

root@R3# show | compare 
[edit protocols bgp group iBGP]
+    damping;

[edit]
root@R3# commit 
commit complete

### Now trigger some route flaps: 

root@R1# run clear bgp neighbor all          
Cleared 1 connections

[...] ### Repeat multiple times. 

[edit]
root@R1# run clear bgp neighbor all    
Cleared 1 connections

### Damping is not working if we read the documentation:  

root@R3# run show route damping suppressed table inet.0 

inet.0: 23 destinations, 23 routes (23 active, 0 holddown, 0 hidden)

### When you apply flap damping at the address family level, it works for both IBGP and EBGP: 

root@R3# show | compare 
[edit protocols bgp group iBGP]
-    damping;
+    family inet {
+        unicast {
+            damping;
+        }
+    }

[edit]
root@R3# commit 
commit complete

### Only 1 route flap: 

root@R1# run clear bgp neighbor all    
Cleared 1 connections

### We can see the route is decayed (merit not yet above the 3000 threshold): 

root@R3# run show route damping decayed detail 

inet.0: 23 destinations, 23 routes (23 active, 0 holddown, 0 hidden)
192.168.10.0/26 (1 entry, 1 announced)
        *BGP    Preference: 170/-101
                Next hop type: Indirect, Next hop index: 0
                Address: 0x7bbe424
                Next-hop reference count: 3, key opaque handle: 0x0, non-key opaque handle: 0x0
                Kernel Table Id: 0
                Source: 17.8.8.1
                Next hop type: Router, Next hop index: 649
                Next hop: 17.8.8.1 via ge-0/0/3.0, selected
                Session Id: 141
                Protocol next hop: 17.8.8.1
                Indirect next hop: 0x791d3c0 1048574 INH Session ID: 350
                State: <Active Int Ext>
                Local AS:   200 Peer AS:   200
                Age: 6  Metric2: 0 
                Validation State: unverified 
                Task: BGP_200.17.8.8.1
                Announcement bits (2): 0-KRT 4-Resolve tree 3 
                AS path: 100 I 
                Accepted
                Localpref: 100
                Router ID: 17.0.0.2
                Merit (last update/now): 2000/2000
                Default damping parameters used
                Last update: 00000000:00:06 First update: 00000000:00:08
                Flaps: 2
                Thread: junos-main 

### After one more flap now the route is suppressed: 

root@R3# run show route damping suppressed detail 

inet.0: 23 destinations, 23 routes (22 active, 0 holddown, 1 hidden)
192.168.10.0/26 (1 entry, 0 announced)
         BGP                 /-101
                Next hop type: Indirect, Next hop index: 0
                Address: 0x7bbe424
                Next-hop reference count: 2, key opaque handle: 0x0, non-key opaque handle: 0x0
                Kernel Table Id: 0
                Source: 17.8.8.1
                Next hop type: Router, Next hop index: 649
                Next hop: 17.8.8.1 via ge-0/0/3.0, selected
                Session Id: 141
                Protocol next hop: 17.8.8.1
                Indirect next hop: 0x791d3c0 1048574 INH Session ID: 350
                State: <Hidden Int Ext>
                Local AS:   200 Peer AS:   200
                Age: 6  Metric2: 0 
                Validation State: unverified 
                Task: BGP_200.17.8.8.1
                AS path: 100 I 
                Localpref: 100
                Router ID: 17.0.0.2
                Merit (last update/now): 3693/3693
                Default damping parameters used
                Last update: 00000000:00:06 First update: 00000000:02:35
                Flaps: 4
                Suppressed. Reusable in: 00000000:34:40
                Preference will be: 170
                Hidden reason: Suppressed by damping
                Thread: junos-main 

As we can see, damping works on iBGP sessions only when applied per address family. But, we already mentioned that the proper place to implement damping is on the edge of the network, on the eBGP session. So, let’s delete damping from R3 and apply to R2:

### Apply damping on R2: 

root@R2# show | compare 
[edit protocols bgp group AS-100]
+    damping;

[edit]
root@R2# commit 
commit complete

### Damping already works (with default parameters) after triggering a couple of flaps: 

root@R2# run show route damping suppressed detail 

inet.0: 22 destinations, 22 routes (21 active, 0 holddown, 1 hidden)
192.168.10.0/26 (1 entry, 0 announced)
         BGP                 /-101
                Next hop type: Router, Next hop index: 604
                Address: 0x7bbe3b4
                Next-hop reference count: 1, key opaque handle: 0x0, non-key opaque handle: 0x0
                Kernel Table Id: 0
                Source: 17.8.0.1
                Next hop: 17.8.0.1 via ge-0/0/1.0, selected
                Session Id: 341
                State: <Hidden Ext>
                Local AS:   200 Peer AS:   100
                Age: 13:58 
                Validation State: unverified 
                Task: BGP_100.17.8.0.1
                AS path: 100 I 
                Localpref: 100
                Router ID: 17.0.0.1
                Merit (last update/now): 4000/2109
                Default damping parameters used
                Last update: 00000000:13:58 First update: 00000000:14:08
                Flaps: 4
                Suppressed. Reusable in: 00000000:22:40
                Preference will be: 170
                Hidden reason: Suppressed by damping
                Thread: junos-main 

### If we want to see the default parameters: 

root@R2# run show policy damping 
Default damping information:
  Halflife: 15 minutes
  Reuse merit: 750 Suppress/cutoff merit: 3000
  Maximum suppress time: 60 minutes
  Computed values:
    Merit ceiling: 12110
    Maximum decay: 6193

### If we do more flaps, we will see that the route merit ceiling is reached: 

root@R2# run show route damping suppressed detail    

inet.0: 22 destinations, 22 routes (21 active, 0 holddown, 1 hidden)
192.168.10.0/26 (1 entry, 0 announced)
         BGP                 /-101
                Next hop type: Router, Next hop index: 604
                Address: 0x7bbe3b4
                Next-hop reference count: 1, key opaque handle: 0x0, non-key opaque handle: 0x0
                Kernel Table Id: 0
                Source: 17.8.0.1
                Next hop: 17.8.0.1 via ge-0/0/1.0, selected
                Session Id: 341
                State: <Hidden Ext>
                Local AS:   200 Peer AS:   100
                Age: 1 
                Validation State: unverified 
                Task: BGP_100.17.8.0.1
                AS path: 100 I 
                Localpref: 100
                Router ID: 17.0.0.1
                Merit (last update/now): 12110/12110
                Default damping parameters used
                Last update: 00000000:00:01 First update: 00000000:19:29
                Flaps: 18
                Suppressed. Reusable in: 00000001:00:20
                Preference will be: 170
                Hidden reason: Suppressed by damping
                Thread: junos-main 

3. Change the default damping parameters

Let’s Configure our own custom BGP Route Flap Damping Parameters:

### Configure a new policy for damping and apply to the BGP group as import: 

root@R2# show | compare 
[edit policy-options]
+   policy-statement damp-fast-recovery {
+       then {
+           damping fast-recovery;
+           accept;
+       }
+   }
[edit policy-options]
+   damping fast-recovery {
+       half-life 5;
+       reuse 1000;
+   }
[edit protocols bgp]
+   import damp-fast-recovery;

[edit]
root@R2# commit 
commit complete

### We can see our new damping parameters: 

root@R2# run show policy damping               
Default damping information:
  Halflife: 15 minutes
  Reuse merit: 750 Suppress/cutoff merit: 3000
  Maximum suppress time: 60 minutes
  Computed values:
    Merit ceiling: 12110
    Maximum decay: 6193
Damping information for "fast-recovery":
  Halflife: 5 minutes
  Reuse merit: 1000 Suppress/cutoff merit: 3000
  Maximum suppress time: 20 minutes
  Computed values:
    Merit ceiling: 16053
    Maximum decay: 6229

### And the suppressed route, with the new calculated merit ceiling: 

root@R2# run show route damping suppressed detail 

inet.0: 22 destinations, 22 routes (21 active, 0 holddown, 1 hidden)
192.168.10.0/26 (1 entry, 0 announced)
         BGP                 /-101
                Next hop type: Router, Next hop index: 604
                Address: 0x7bbe3b4
                Next-hop reference count: 1, key opaque handle: 0x0, non-key opaque handle: 0x0
                Kernel Table Id: 0
                Source: 17.8.0.1
                Next hop: 17.8.0.1 via ge-0/0/1.0, selected
                Session Id: 341
                State: <Hidden Ext>
                Local AS:   200 Peer AS:   100
                Age: 9 
                Validation State: unverified 
                Task: BGP_100.17.8.0.1
                AS path: 100 I 
                Localpref: 100
                Router ID: 17.0.0.1
                Merit (last update/now): 16053/16053
                damping-parameters: fast-recovery
                Last update: 00000000:00:09 First update: 00000000:35:40
                Flaps: 38
                Suppressed. Reusable in: 00000000:20:20
                Preference will be: 170
                Hidden reason: Suppressed by damping
                Thread: junos-main 


External Resources:

Leave a Reply