How to detected bgp session disconnected and reconnected too much faster?

How to detected bgp session disconnected and reconnected too much faster ? Then I can disable the link for a while automatically?

You could make use of BFD to faster detect if the peer is still available.

Normally the BGP process itself defaults to something like 180 60 as timeout. That is it does its refresh once a minute and if a peer is missing those routes will be withdrawn after 3 minutes.

This default is healty for Internet where you want to minimize short disconnect/reconnect but for internal use like within your datacenter or such 3 minutes is way too long time.

Normally you can safetly lower these BGP timers to 15 5 or even 9 3 but going lower than that will make too much stress on the MGMT-CPU.

So a common recommendation is to lower the BGP timers to a sane value lets say 30 10 or 15 5 and then apply BFD to get the subsecond detection.

This way the BGP process will do its thing but when/if BFD detects that the peer is gone it will trigger the BGP process to withdraw the routes to/from the peer who is no longer available.

Then you can tweak BFD down to lets say 3x250ms which would mean that routes would be withdrawn after 750ms of downtime.

The tricky part here is that you often want a low value but not too low so you get false positives. Such as if you get high amount of traffic that queues up then you dont want to get BFD triggerhappy just because it couldnt “ping” the opposite side.

Also as I recall it for BFD to do its magic both ends of the connection must use BFD - that is the peer you “ping” must also have BFD configured (multihops works fine for BFD - that is you can have Router_A ↔ another router ↔ yet another router ↔ some other router ↔ Router_B and then you have the BFD configured between Router_A and Router_B).