Routing – After TCP is established which BGP peer will send open message first

bgpprotocol-theoryrouting

After a Tcp connection is established between two bgp peers. which peer will send the open message first ? the active peer(which is initiating outbound connection) or the passive peer?(peer which is accepting a inbound connection).

Or is it independent of this active passive state ? Can any of the peer send the first open message based on scheduling?

What will happen when a open mesage is received before the local router sends out a open message?

Is there any good BGP Peer fsm diagram? RFC4271 doesn't have a fsm diagram 🙁

Best Answer

which peer will send the open message first?

Normally, the speaker that opens the socket sends the first OPEN message. But it actually doesn't matter (ref the DelayOpen timer), because BGP also provides a way to delay the OPEN message so the opposite peer can send first:

    Option 1:     DelayOpen

    Description: The DelayOpen optional session attribute allows
                 implementations to be configured to delay sending
                 an OPEN message for a specific time period
                 (DelayOpenTime).  The delay allows the remote BGP
                 Peer time to send the first OPEN message.

         Value:       TRUE or FALSE

In the event that both speakers open duplicate TCP sessions and send OPEN messages on each socket simultaneously, the BGP Identifier is used to resolve which socket should be closed. See RFC 4271, Section 6.8:

6.8. BGP Connection Collision Detection

If a pair of BGP speakers try to establish a BGP connection with each other 
simultaneously, then two parallel connections well be formed. If the source IP address 
used by one of these connections is the same as the destination IP address used by the 
other, and the destination IP address used by the first connection is the same as the 
source IP address used by the other, connection collision has occurred. In the event 
of connection collision, one of the connections MUST be closed.

Based on the value of the BGP Identifier, a convention is established for detecting 
which BGP connection is to be preserved when a collision occurs. The convention is to 
compare the BGP Identifiers of the peers involved in the collision and to retain only 
the connection initiated by the BGP speaker with the higher-valued BGP Identifier. 

Is there any good BGP Peer fsm diagram?

Wikipedia has this simplified BGP FSM.