Awesome BGP Notes

Nonstop Forwarding (NSF) or Graceful Restart allows a router to continue forwarding with the existing information (retained from the previous session) while the session is being reset.

Several measures are available to increase BGP scalability. These measures reduce either the number of routes/paths to be maintained or the number of updates to be generated.

 

To enforce policies, BGP uses a three-step process:
1 Input policy engine
2 Path selection
3 Output policy engine

As updates are received from a peer, they are stored in a Routing Information Base (RIB) for that peer (Adj-RIB-In). The updates are filtered by the Input Policy Engine. A path selection algorithm is then performed to determine the best path for each prefix. The resulting best paths are stored in the local BGP RIB (Loc-RIB) and then are submitted to the local IP routing table (IP-RIB) for installation consideration. When multipath is enabled, the best path plus all equal-cost paths are submitted for IP-RIB consideration.

In addition to the best paths received from peers, the Loc-RIB also contains BGP prefixes injected by the current router (called locally sourced) that are selected as the best paths. The
content of the Loc-RIB must pass through the Output Policy Engine before being advertised to other peers. The routes that successfully pass through the Output Policy Engine are
installed in the output RIB (Adj-RIB-Out).

The primary function of the BGP Scanner process is BGP housekeeping. Specifically, the BGP Scanner performs periodic scans of the BGP RIB to determine if prefixes and
attributes should be deleted and if route map or filter caches should be flushed. This process also scans the IP RIB to ensure that all the BGP next hops are still valid. If the next hop is
unreachable, all BGP entries using that next hop are removed from the BGP RIB

BGP Capabilities
As defined in RFC 1771, BGP supports the following four types of messages:
• Open—This type of message is used to set up the initial BGP connections.
• Update—These messages are used between peers to exchange network layer reachability information.
• Notification—These messages are used to communicate error conditions.
• Keepalive—These messages are exchanged periodically between a pair of peers to keep the session up.

Here are some of the capabilities that are supported in Cisco IOS software:
• Capability code 1, Multiprotocol extension
• Capability code 2, Route refresh
• Capability code 64, Graceful restart
• Capability code 128, Old form of route refresh
• Capability code 130, Outbound Route Filter (ORF)

 

Tuning BGP Performance
TCP MSS - The two main parameters that affect TCP’s performance are the maximum segment size (MSS) and the TCP window size. The TCP MSS controls the size of the TCP segment, or
packet, and the TCP window size controls the rate at which packets can be sent.

Queue Optimization - The purpose of queue optimization is to minimize packet loss. This most often occurs on a router with a large fan-out of BGP sessions. The root cause is the stream of acknowledgments that are received from a large number of peers simultaneously. The router is unable to process all the TCP ACKs, causing the input queues to overflow, resulting in packet loss.
The packet reception process for BGP packets has three major components:

  • Input hold queue—This is not an actual queue, but a counter that is assigned to an interface. When a packet bound for the processor is received on an interface, the input hold queue is incremented by 1. After that packet has been processed, the input hold queue is decremented to reflect that the packet is no longer in the queue. Each input queue has a maximum queue depth.
  •  Selective Packet Discard (SPD) Headroom—SPD Headroom is a counter that allows the input hold queues to exceed their configured maximum size. The total value of the SPD Headroom is shared by all the interfaces. This headroom is used to store high-priority packets, such as routing control traffic, above and beyond the input hold queue. The SPD feature is discussed in detail in the section “Selective Packet Discard.”
  •  System buffers—The system buffers store the incoming packets being sent to the process level. A packet destined for the processor is removed from the interface buffer and is put in the system buffer. These buffers can be seen with the show buffers command.

SPD - The SPD feature is a queue-management mechanism that operates on the input hold queues for traffic destined for the route processor. The SPD process can distinguish between highand normal-priority traffic, allowing it to better manage system resources in the input queue. The SPD function is specifically for managing input queue congestion.

BGP Network Performance Features
BGP Fast External Fallover - The default behavior for tearing down a BGP session is to require the hold timer to expire, which by default is 180 seconds. The BGP fast external fallover function triggers the teardown of an eBGP session immediately when the link to that eBGP peer fails. This feature is only for external peers.

BGP Non-Stop Forwarding - The BGP Non-Stop Forwarding (NSF) or graceful restart (BGP-GR) feature takes advantage of the independence of the data plane and control plane processing. The concept of BGP NSF is that the data plane can continue forwarding for a period of time while BGP restarts.

End-of-RIB Marker - The end-of-RIB marker indicates to a BGP peer that the initial routing update has completed after session initiation. This feature is valuable for BGP convergence independently of BGP-GR

Graceful Restart Capability - This capabilityalso contains the Restart State, Restart Time in the Restart Flags, and Forwarding State foreach AFI/SAFI, as part of the Address Family flags.

BGP Soft Reconfiguration - Soft reconfiguration outbound does not require any additional resource. The BGP router can process the Adj-RIB-Loc through the outbound policy for the particular peer, creating a new Adj-RIB-Out. The remote peer can be updated by any changes with BGP Update messages.
The soft reset of an inbound connection presents more of a difficulty. When prefix information for a remote peer is rejected because of inbound policy, that prefix information is not
maintained in the BGP table. This is intended to optimize resource utilization on a BGP router that has a large number of prefixes. The BGP soft reconfiguration feature lets a BGP peer maintain all prefix information learned from the remote peer, even if it is rejected because of inbound policy filtering. This feature increases the memory resource requirements; however, the router can reprocess all inbound prefixes through an updated inbound configuration.

Route Refresh Feature - The route refresh feature is a replacement for the soft reconfiguration feature. Route refresh is a capability that is negotiated at session initiation. The route refresh feature allows a BGP BGP Network Performance Features 95 router to request that a remote peer resend its BGP Adj-RIB-Out. This allows the BGP router to reapply the inbound policy.