Border Gateway Protocol or BGP is a routing protocol that uses timers as part of its operation. Various timers perform different functions, and some are used for very specialized operations that are unique to BGP.
In this article, we’ll be exploring some of the most common timers used for BGP as well as some less familiar ones that help to support BGP’s many functions.
Timers for Fundamental BGP Operation
The two fundamental timers that BGP uses when establishing BGP peerings and exchanging routing information are the hold down and the keepalive timers.
Hold Down Timer
This timer sets the time period that a BGP router will wait for a keepalive message from its peer before considering the connection as failed.
If the hold time expires without receiving a keepalive message, the BGP session is torn down. The default value for the hold timer is typically 180 seconds which is three times the default keepalive timer value.
Keepalive Timer
This timer controls how frequently BGP keepalive messages are sent to BGP peers. Keepalive messages are used to maintain the connection and ensure that the link between the BGP peers is alive.
If a BGP router doesn’t receive a keepalive message within the time period defined by the hold down timer, it assumes that the connection has failed. The default value for the keepalive timer is typically 60 seconds.
Additional BGP Timers
The hold down and keepalive timers are the two fundamental BGP timers used for maintaining BGP peers.
However, there are three more timers that are inherent to BGP’s primary finite state machine (FSM) operation.
Using the names as they appear in the official RFC, these timers are: ConnectRetryTimer, MinASOriginationInterval, and MinRouteAdvertisementIntervalTimer. These are briefly described below:
ConnectRetryTimer
This timer is used in the BGP connection establishment process. This timer controls the interval between successive attempts by a BGP router to establish a TCP connection with a BGP peer.
MinASOriginationInterval
The MinASOriginationInterval timer controls the minimum time interval between successive advertisements of routes that have the same Autonomous System (AS) path.
This is particularly relevant when BGP routers are originating or re-announcing routes. This helps limit the frequency with which updates are sent by a BGP router, thereby minimizing the processing load on other BGP routers and limiting the potential for route flapping.
It contributes to overall BGP stability and efficiency.
MinRouteAdvertisementIntervalTimer (MRAI timer)
The MRAI timer specifies the minimum amount of time that must elapse between subsequent route advertisements to a particular BGP peer.
This timer can be set for both eBGP and iBGP sessions. Like the previous timer, its purpose is to limit the frequency of updates and contribute to BGP stability.
Related BGP Feature Timers
Besides the fundamental operation of BGP and its FSM, there are other features and capabilities that BGP has to further refine how routes are advertised and how traffic is routed. These other features leverage additional timers to make them work.
Route Refresh Timer
This timer is associated with the Route Refresh capability in BGP. It controls the frequency at which routing updates are requested from a BGP peer.
This capability allows a BGP speaker to request a re-advertisement of all the routes from a peer, which can be useful for clearing routing table inconsistencies without resetting the entire BGP session.
Route Flap Damping Timers
Route flap damping is a mechanism used in BGP networks to reduce the instability caused by routes that are constantly changing state (flapping).
It involves timers that control penalties and suppressions applied to routes that flap too frequently. These timers include the penalty timer, suppress limit timer, reuse limit timer, maximum suppress time, and half-life timer.
Delay Timer and Idle Timer
These are two timers used within the context of BGP Graceful Restart. The delay timer controls the delay before BGP starts re-establishing sessions after a restart, and the idle timer defines the period a router should wait for End-of-RIB markers, which are special BGP messages used to signal the completion of the initial routing table transfer between BGP peers.
BGP Timer Best Practices
All of these timers play a vital role in the operation of BGP. They are all typically assigned a default value that is generally suitable for most network scenarios and operations.
However, most of these are adjustable to accommodate specialized scenarios. Here are some general guidelines to keep in mind when and if adjusting the values of these timers:
- Understand Network Requirements: Before adjusting any timer, thoroughly analyze the specific requirements of your network. Factors such as network size, topology, and stability should guide your adjustments.
- Avoid Too Short Timers: Setting timers too short, especially the keepalive and hold down timers, can lead to unnecessary session resets due to minor network interruptions. This can cause instability in the network.
- Balance Stability with Responsiveness: While longer timers can provide stability, they might also delay the detection of downed links or peers. Strive for a balance where the timers are short enough for timely reaction to changes but long enough to avoid instability.
- Customize Based on Peer Type: Consider different timer settings for different types of BGP peers (e.g., internal vs. external). External peers might require different timer settings compared to internal peers due to different network conditions.
- Consistency Across Peers: Ensure consistency in timer settings among BGP peers where possible. This helps in predictable and uniform behavior across the network.
- Incremental Adjustments: Make incremental changes to timers and monitor the impact before making further adjustments. Sudden and significant changes can lead to unforeseen issues.
- Use Vendor Recommendations: Consult with your network equipment vendor for recommendations on timer settings. They often provide guidelines based on extensive testing and experience.
- Prioritize Network Stability: Always prioritize network stability over aggressive tuning. Conservative settings are typically preferable in a production environment.
- Keep Default Values: Whenever possible, use the default timer values. Change these values only when it is absolutely necessary.
Conclusion
BGP timers play a vital role in maintaining BGP sessions and ensuring the robustness of the routing process by timely detection of failed peers and minimizing unnecessary traffic due to keepalive messages. Proper configuration of these timers is key to optimizing BGP performance and reliability.
Useful Links:
- https://datatracker.ietf.org/doc/html/rfc4271#page-90 – Section 10 of the BGP RFC that describes BGP timers.
- https://datatracker.ietf.org/doc/html/rfc2918 – Route Refresh RFC describing the feature operation and timers
- https://datatracker.ietf.org/doc/html/rfc4724 – Graceful Restart RFC describing feature operation and timers
- https://datatracker.ietf.org/doc/html/rfc2439 – Route Flap Damping RFC describing feature operation and timers