OSPF neighbor relationship flapping suppression works by delaying OSPF neighbor relationship reestablishment or setting the link cost to the maximum value (65535).
If the status of an interface carrying OSPF services alternates between Up and Down, OSPF neighbor relationship flapping occurs on the interface. During the flapping, OSPF frequently sends Hello packets to reestablish the neighbor relationship, synchronizes LSDBs, and recalculates routes. In this process, a large number of packets are exchanged, adversely affecting the stability of the existing neighbor relationships, OSPF services, and other OSPF-dependent services, such as LDP and BGP. Suppression of OSPF neighbor relationship flapping can address this problem by delaying OSPF neighbor relationship reestablishment or preventing service traffic from passing through flapping links.
Flapping_event: A flapping_event occurs when the status of a neighbor relationship on an interface last changes from Full to a non-Full state. A flapping_event triggers flapping detection.
Flapping_count: This parameter indicates the number of times flapping has occurred.
Detect-interval: This parameter indicates the flapping detection interval. The interval is used to determine whether to trigger a valid flapping_event.
Threshold: This parameter indicates the flapping suppression threshold. When the flapping_count reaches or exceeds the threshold, flapping suppression takes effect.
Resume-interval: This parameter indicates the resumption interval. If the time between two valid flapping_events is longer than the resume-interval, flapping suppression exits.
A flapping counter is started on OSPF interfaces. Each time two consecutive flapping_events occur within a detect-interval, a valid flapping_event is recorded and the flapping_count increments by 1. When the flapping_count reaches or exceeds the threshold, the system determines that flapping occurs, triggers flapping suppression accordingly, and sets the flapping_count to 0. If two consecutive valid flapping_events occur within a period longer than the resume-interval before the flapping_count reaches the threshold again, the system also sets the flapping_count to 0. Interfaces start the suppression timer when the neighbor status last changes to ExStart or Down.
The detect-interval, threshold, and resume-interval are configurable.
Flapping suppressionFlapping suppression works in either Hold-down or Hold-max-cost mode.
Flapping suppression can also work first in Hold-down mode and then in Hold-max-cost mode after the Hold-down mode exits.
By default, the Hold-max-cost mode takes effect. The suppression mode and period can be changed manually using command lines.
Interfaces exit flapping suppression in the following scenarios:
In Figure 1, the traffic forwarding path is Switch A -> Switch B -> Switch C -> Switch E before a link failure occurs. After the link between Switch B and Switch C fails, the forwarding path switches to Switch A -> Switch B -> Switch D -> Switch E. At the early stage of the path switchover, there is a high probability that the status of the neighbor relationship between Switch B and Switch C flaps frequently, leading to frequent switchovers of forwarding paths. Each switchover triggered by faults causes traffic loss. The network stability is affected. In this scenario, if the devices are configured with flapping suppression, flapping suppression takes effect when the suppression conditions are met.
If only one forwarding path exists on the network, the neighbor relationship flapping between any two devices on the path will interrupt traffic forwarding. In Figure 2, the only traffic forwarding path is Switch A -> Switch B -> Switch C -> Switch E. If the neighbor relationship between Switch B and Switch C flaps and the flapping meets the suppression conditions, flapping suppression takes effect. However, if the neighbor relationship between Switch B and Switch C is prevented from being reestablished, the whole network will be divided. Therefore, the Hold-max-cost mode (rather than the Hold-down mode) is recommended. If flapping suppression works in Hold-max-cost mode, 65535 is used as the cost of the link between Switch B and Switch C within the suppression period. After the network stabilizes and the suppression timer expires, the link is restored.
By default, the Hold-max-cost mode takes effect.
In Figure 3, four devices are deployed on the same broadcast network using switches, and the devices are broadcast network neighbors. If Switch C flaps due to a link failure and Switch A and Switch B were deployed at different time (Switch A was deployed earlier for example) or the flapping suppression parameters on Switch A are different from those on Switch B, Switch A first detects the flapping and suppresses Switch C. Consequently, the Hello packets sent by Switch A do not carry the Switch ID of Switch C. However, Switch B has not detected the flapping yet and still considers Switch C as a valid node. As a result, the DR candidates identified by Switch A are Switch B and Switch D, whereas the DR candidates identified by Switch B are Switch A, Switch C, and Switch D. Different DR candidates result in a different DR election result, which may lead to route calculation errors. To prevent this problem in scenarios where an interface has multiple neighbors, such as on a broadcast, P2MP, or NBMA network, all neighbors on the interface are suppressed when the status of a neighbor relationship last changes to ExStart or Down. Specifically, if Switch C flaps, Switch A, Switch B, and Switch D on the same broadcast network as Switch C are all suppressed. After the network stabilizes and the suppression timer expires, Switch A, Switch B, and Switch D are restored to normal status.
Multi-area scenarioIn Figure 4, Switch A, Switch B, Switch C, Switch E, and Switch F are connected in area 1, and Switch B, Switch D, and Switch E are connected in backbone area 0. Traffic from Switch A to Switch F is preferentially forwarded along intra-area routes, and therefore the forwarding path is Switch A -> Switch B -> Switch C -> Switch E -> Switch F. When the neighbor relationship between Switch B and Switch C flaps and the flapping meets suppression conditions, flapping suppression takes effect in the default mode of Hold-max-cost. Consequently, 65535 is used as the cost of the link between Switch B and Switch C. However, the forwarding path remains unchanged because intra-area routes take precedence over inter-area routes during route selection according to OSPF route selection rules. Therefore, the Hold-down mode must be used in this scenario to prevent the neighbor relationship between Switch B and Switch C from being reestablished within the suppression period. During this period, traffic is forwarded along the path Switch A -> Switch B -> Switch D -> Switch E -> Switch F.
By default, the Hold-max-cost mode takes effect. You can manually configure command lines to change the mode to Hold-down.
In Figure 5, if the link between PE1 and P1 fails, an LDP LSP switchover is implemented immediately, causing the original LDP LSP to be deleted before a new LDP LSP is established. To prevent traffic loss, LDP-IGP synchronization needs to be configured. With LDP-IGP synchronization configured, 65535 is used as the cost of the new LSP to be established. After the new LSP is established, the original cost takes effect. Then, the original LSP is deleted, and LDP traffic is forwarded along the new LSP.
Both LDP-IGP synchronization and OSPF neighbor relationship flapping suppression work in either Hold-down or Hold-max-cost mode. If both functions are configured, the Hold-down mode takes precedence over the Hold-max-cost mode, followed by the configured link cost. Table 1 lists the suppression modes that take effect in different situations.
LDP-IGP Synchronization/OSPF Neighbor Relationship Flapping Suppression Mode |
Hold-down Mode of LDP-IGP Synchronization |
Hold-max-cost Mode of LDP-IGP Synchronization |
Exiting LDP-IGP Synchronization Suppression |
---|---|---|---|
Hold-down mode of OSPF neighbor relationship flapping suppression |
Hold-down |
Hold-down |
Hold-down |
Hold-max-cost mode of OSPF neighbor relationship flapping suppression |
Hold-down |
Hold-max-cost |
Hold-max-cost |
Exiting OSPF Neighbor Relationship Flapping Suppression |
Hold-down |
Hold-max-cost |
Exiting LDP-IGP synchronization and OSPF neighbor relationship flapping suppression |
For example, the link between PE1 and P1 frequently flaps, as shown in Figure 5, and both LDP-IGP synchronization and OSPF neighbor relationship flapping suppression are configured. In this case, the suppression mode is selected based on the above principles. No matter which mode (Hold-down or Hold-max-cost) is selected, the forwarding path is switched to PE1 -> P4 -> P3 -> PE2.
If a link has a poor link quality, services transmitted along it may be adversely affected. If bit-error-triggered protection switching is configured and the bit error rate (BER) along a link exceeds a specified value, a bit error event is reported, and 65535 is used as the cost of the link, triggering route reselection. Consequently, service traffic is switched to the backup link. If both bit-error-triggered protection switching and OSPF neighbor relationship flapping suppression are configured, they both take effect. The Hold-down mode takes precedence over the Hold-max-cost mode, followed by the configured link cost.