reference:

http://archive.apnic.net/meetings/10/programme/presentations/pfs-route-flap.pdf

RFC2439 BGP Route Flap Damping

 

Route flap:

BGP UPDATE followed by WITHDRAW = 1 flap
eBGP neighbour going down/up is NOT a flap

 

Dampening

1. 对于每次flap给此route增加一个惩罚值;

2. 如果此route的惩罚值高于suppress-limit,这条路由就会被抑制而不会宣告给其他peer(惩罚值不能无限累加,有个最大值);

3. 如果此route被抑制了,那么只有它的惩罚值降到某一个reuse-limit,则此路由被重新启用,宣告给其他peer;

4. 为确保路由是真的稳定了,遭受惩罚的路由,惩罚值的降低是非线性的,而是指数式下降,这个下降的快慢,指数大小由half lift决定。

 

PPT里的一个图;

BGP Route Flap Dampening_第1张图片

 

Operation:

只对从eBGP peer入方向宣告的路由有效;

Penalty of 1000 per flap
Half-life (default 15 minutes)
reuse-limit (default 750)
suppress-limit (default 2000)
maximum suppress time (default 60 minutes)

 

配置:

router bgp 100
bgp dampening [
]

 

做个简单的实验验证一下:

拓扑:

BGP Route Flap Dampening_第2张图片

在R2上做flap damping, R1宣告一条BGP路由给R2,R3把这条路由反射给R4,在R1上让这条路由flapping。

R2上的BGP配置

R2(config)#router bgp 200
R2(config-router)#bg
R2(config-router)#bgp da
R2(config-router)#bgp dampening ?
  <1-45>     Half-life time for the penalty
  route-map  Route-map to specify criteria for dampening
  

R2(config-router)#bgp dampening 5 ?
  <1-20000>  Value to start reusing a route
  

R2(config-router)#bgp dampening 5 750 ?
  <1-20000>  Value to start suppressing a route

R2(config-router)#bgp dampening 5 750 2000 ?
  <1-255>  Maximum duration to suppress a stable route

R2(config-router)#bgp dampening 5 750 2000 10 ?
  

R2(config-router)#bgp dampening 5 750 2000 10
R2(config-router)#
R2(config-router)#
R2(config-router)#
*Mar  1 00:18:31.555: %BGP-5-DAMPENING_DECAY_TIME: Decay time from maximum penalty to suppress penalty is 175 secs. Maximum penalty: 3000, suppress penalty: 2000
R2(config-router)#do sh run | b r b
router bgp 200
bgp router-id 192.168.1.2
no bgp default ipv4-unicast
bgp log-neighbor-changes
neighbor 10.1.2.1 remote-as 100
neighbor 10.1.2.1 ebgp-multihop 255
neighbor 10.2.3.2 remote-as 200
!
address-family ipv4
  neighbor 10.1.2.1 activate
  neighbor 10.2.3.2 activate
  neighbor 10.2.3.2 next-hop-self
  no auto-summary
  no synchronization
  bgp dampening 5 750 2000 10
exit-address-family

正常时的路由:

BGP Route Flap Dampening_第3张图片

 

R1withdraw此路由后:

BGP Route Flap Dampening_第4张图片

penalty加1000

flap到四次后,惩罚超过2000,显示”suppressed due to dampening”,路由被抑制。

BGP Route Flap Dampening_第5张图片

可以看到有提示reuse in 00:07:50, 直到倒计时结束,penalty低于750时,此路由才会重新宣告给RR。

 

BGP Route Flap Dampening_第6张图片

penalty还没有小于reuse-limit就重新启用了,难道不是那么精确么?

BGP Route Flap Dampening_第7张图片