BGP Messages, Neighbor States Flashcards
BGP Messages
- OPEN: Sets up and establishes BGP adj.
- UPDATE: Advertises, updates, or withdraws routes.
- NOTIFICATION: Indicates an error condition to a BGP neighbor.
- KEEPALIVE: Ensures that BGP neighbors are still alive.
OPEN Message
The OPEN message is used to establish a BGP adjacency.
Both sides negotiate session capabilities before a BGP peering establishes.
The OPEN message contains:
- BGP version number
- ASN of the originating router
- Hold Time
- BGP Identifier
- Other optional parameters that establish the session capabilities such as support for MP-BGP, Route Refresh and 4-octect AS.
OPEN Message
Hold Time Attribute
The Hold Time attribute sets the Hold Timer in seconds for each BGP neighbor. Upon
receipt of an UPDATE or KEEPALIVE, the Hold Timer resets to the initial value.
If the Hold Timer reaches zero, the BGP session is torn down, routes from that neighbor
are removed, and an appropriate update route withdraw message is sent to other BGP
neighbors for the impacted prefixes.
The Hold Time is a heartbeat mechanism for BGP neighbors to ensure that the neighbor is healthy and alive.
Default hold timer is 180 seconds.
OPEN Message
RID
The BGP Router-ID (RID) is a 32-bit unique number that identifies the BGP router in
the advertised prefixes as the BGP Identifier.
The RID can be used as a loop prevention mechanism for routers advertised within an autonomous system.
The RID can be set manually or dynamically for BGP.
Dynamic RID allocation to become the RID when BGP initializes:
- highest IP address of the any up loopback interfaces
- highest IP address of any active up interfaces
Setting a static BGP RID is a best practice.
KEEPALIVE Message
BGP does not rely on the TCP connection state to ensure that the neighbors are still alive.
Default Hold Time of 180 seconds
Default Keepalive interval is 60 seconds.
If the Hold Time is set for zero, no Keepalive messages are sent between the BGP neighbors.
NOTIFICATION Message
A Notification message is sent when an error is detected with the BGP session, such as
a hold timer expiring, neighbor capabilities change, or a BGP session reset is requested.
This causes the BGP connection to close.
UPDATE Message
The Update message includes the Network Layer Reachability
Information (NLRI) that includes the prefix and associated BGP PAs when advertising prefixes.
Withdrawn NLRIs include only the prefix.
An UPDATE message can act as a Keepalive to reduce unnecessary traffic.
BGP Neighbor States
- Idle
- Connect
- Active
- OpenSent
- OpenConfirm
- Established
Connect
BGP initiates the TCP connection.
If the 3-way TCP handshake completes, the established BGP Session resets the ConnectRetryTimer and sends the Open message to the neighbor, and then changes to the OpenSent State.
If the ConnectRetry timer depletes before this stage is complete, a new TCP connection is
attempted, the ConnectRetry timer is reset, and the state is moved to Active. If any other
input is received, the state is changed to Idle.
During this stage, the neighbor with the higher IP address manages the connection.
The router initiating the request uses a dynamic source port, but the destination port is
always 179.
The ConnectRetryTimer is set to 60 seconds and must decrement to zero before the connection is initiated again.
Active
BGP starts a new 3-way TCP handshake.
If a connection is established, an Open message is sent, the Hold Timer is set to 4 minutes, and the state moves to OpenSent.
If this attempt for TCP connection fails, the state moves back to the Connect state and resets the ConnectRetryTimer.
OpenSent
An Open message has been sent from the originating router and is awaiting
an Open message from the other router.
After the originating router receives the OPEN
message from the other router, both OPEN messages are checked for errors.
- BGP version must match
- The SRC IP of the OPEN message must match the IP that is configured for the neighbor.
- The ASN must match what is configured for the neighbor.
- BGP RID must be unique.
- Security Parameters (passwords, TTL, and the like)
If the Open messages do not have any errors, the Hold Time is negotiated (using the
lower value), and a KEEPALIVE message is sent (assuming the value is not set to zero).
The connection state is then moved to OpenConfirm.
If an error is found in the OPEN message, a Notification message is sent, and the state is moved back to Idle.
OpenConfirm
BGP waits for a Keepalive or Notification message.
Upon receipt of a neighbor’s Keepalive, the state is moved to Established.
If the hold timer expires, a stop event occurs, or a Notification message is received, the state is moved to Idle.
Established
The BGP session is established.
BGP neighbors exchange routes via Update messages.
As Update and Keepalive messages are received, the Hold Timer is reset.
If the Hold Timer expires, an error is detected and BGP moves the neighbor back to
the Idle state.