设为首页收藏本站language→→ 语言切换

鸿鹄论坛

 找回密码
 论坛注册

QQ登录

先注册再绑定QQ

查看: 296|回复: 1
收起左侧

[分享] BGP Route Dampening

[复制链接]
 成长值: 59995
发表于 6 天前 | 显示全部楼层 |阅读模式
Configuration
Let’s see how we configure BGP dampening. This is the topology we’ll use:
r1-r2-as1-as2-loopback0.png
Want to take a look for yourself? Here you will find the startup configuration of each device.

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)

您需要登录后才可以回帖 登录 | 论坛注册

本版积分规则

QQ|Archiver|手机版|小黑屋|sitemap|鸿鹄论坛 ( 京ICP备14027439号 )  

GMT+8, 2024-6-20 20:04 , Processed in 0.056437 second(s), 11 queries , Redis On.  

  Powered by Discuz!

  © 2001-2024 HH010.COM

快速回复 返回顶部 返回列表