BGP is based on TCP and port number is 179.
Initiate a TCP connection every 30 seconds, and the neighbor enters the Active state.
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/02324262O-0.jpg "/>
1. Because the neighbor does not enable BGP, the neighbor is reset. 2. We can see that the bgp tcp connection is sent by the router that initiates the TCP connection first to access the neighbor's high port.
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/0232424D1-1.jpg "/>
Neighbor v as MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
12.0.0.1 4 1 0 0 0 0 never Active
BGP is based on TCP and port 179
TCP three-way connection:
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/0232424127-2.jpg "/>
BGP header:
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/023242E95-3.jpg "/>
OPEN message:
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/023242OZ-4.jpg "/>
If the received OPEN message is acceptable, a KEEPLIVE is sent to confirm the OPEN message.
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/023242IH-5.jpg "/>
Keeplive:
Keeplive is exchanged by 1/3 of the holding time (not less than 1 S). If the holding time is 0, Keeplive is not sent.
In Keeplive, only the 16-byte sign + 2-byte Length + 1-byte type = keeplive19 byte
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/02324260O-6.jpg "/>
Update message:
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/0232421340-7.jpg "/>
Only one feasible route can be declared for each Update packet, and multiple unfeasible routes can be revoked. Because the path attribute can only describe one route, if multiple routes exist, you cannot determine which route the path attribute describes.
An optional value for the Update packet is withdraw routes. This field lists the vrouters to be withdrawn from the service and is expressed in length and prefix dual groups.
Notification Message:
This message is sent after an error is detected. After the message is sent, the BGP connection is closed immediately.
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/02324214B-8.jpg "/>
BGP state machine
The first router to start the BGP process (active)
* Oct 2 21:43:44. 411: BGP: 12.0.0.1 open active, local address 12.0.0.2
* Oct 2 21:43:44. 471: BGP: 12.0.0.1 went from Active to OpenSent
* Oct 2 21:43:44. 471: BGP: 12.0.0.1 sending OPEN, version 4, my as: 2, holdtime 180 seconds
* Oct 2 21:43:44. 475: BGP: 12.0.0.1 send message type 1, length (incl. header) 45
* Oct 2 21:43:44. 571: BGP: 12.0.0.1 rcv message type 1, length (excl. header) 26
* Oct 2 21:43:44. 575: BGP: 12.0.0.1 rcv OPEN, version 4, holdtime 180 seconds
* Oct 2 21:43:44. 575: BGP: 12.0.0.1 rcv OPEN w/OPTION parameter len: 16
* Oct 2 21:43:44. 575: BGP: 12.0.0.1 rcvd OPEN w/optional parameter type 2 (Capability) len 6
* Oct 2 21:43:44. 575: BGP: 12.0.0.1 OPEN has CAPABILITY code: 1, length 4
* Oct 2 21:43:44. 579: BGP: 12.0.0.1 OPEN has MP_EXT CAP for afi/safi: 1/1
* Oct 2 21:43:44. 579: BGP: 12.0.0.1 rcvd OPEN w/optional parameter type 2 (Capability) len 2
* Oct 2 21:43:44. 579: BGP: 12.0.0.1 OPEN has CAPABILITY code: 128, length 0
* Oct 2 21:43:44. 579: BGP: 12.
R2 (config) #0.0.1 OPEN has ROUTE-REFRESH capability (old) for all address-families
* Oct 2 21:43:44. 579: BGP: 12.0.0.1 rcvd OPEN w/optional parameter type 2 (Capability) len 2
* Oct 2 21:43:44. 583: BGP: 12.0.0.1 OPEN has CAPABILITY code: 2, length 0
* Oct 2 21:43:44. 583: BGP: 12.0.0.1 OPEN has ROUTE-REFRESH capability (new) for all address-families
BGP: 12.0.0.1 rcvd OPEN w/remote AS 1
* Oct 2 21:43:44. 583: BGP: 12.0.0.1 went from OpenSent to OpenConfirm
* Oct 2 21:43:44. 583: BGP: 12.0.0.1 went from OpenConfirm to Established
Active:
BGP tries to initialize a TCP connection with the neighbor. If the TCP connection is successful, it sends an OPEN packet and migrates It To The Opensent status.
OpenSent:
An Open message has been sent. Wait for the Open message from the neighbor and check the required parameters. If an error exists, the notification message is sent and migrated to the idle state.
If no error exists, send the Keeplive message and negotiate the holding time and Keeplive timer. And migrate to openconfirm
Openconfirm:
Wait for the Keeplive or notification message. If the received message is the former, it is transferred to established. If the received message is the latter message or the TCP connection is disconnected, it is transferred to the idle status.
Established:
The BGP peer connection has been fully established.
Second vro (passive)
* Oct 2 21:43:21. 895: BGP: 12.0.0.2 went from Idle to Active
* Oct 2 21:43:21. 907: BGP: 12.0.0.2 open active delayed 31051 ms (35000 ms max, 28% jitter)
R1 (config-router )#
* Oct 2 21:43:44. 539: BGP: 12.0.0.2 passive open to 12.0.0.1
* Oct 2 21:43:44. 543: BGP: 12.0.0.2 went from Active to Idle
* Oct 2 21:43:44. 543: BGP: 12.0.0.2 went from Idle to Connect
* Oct 2 21:43:44. 555: BGP: 12.0.0.2 rcv message type 1, length (excl. header) 26
* Oct 2 21:43:44. 555: BGP: 12.0.0.2 rcv OPEN, version 4, holdtime 180 seconds
* Oct 2 21:43:44. 555: BGP: 12.0.0.2 went from Connect to OpenSent
* Oct 2 21:43:44. 559: BGP: 12.0.0.2 sending OPEN, version 4, my as: 1, holdtime 180 seconds
* Oct 2 21:43:44. 559: BGP: 12.0.0.2 rcv OPEN w/OPTION parameter len: 16
* Oct 2 21:43:44. 559: BGP: 12.0.0.2 rcvd OPEN w/optional parameter type 2 (Capability) len 6
* Oct 2 21:43:44. 559: BGP: 12.0.0.2 OPEN has CAPABILITY code: 1, length 4
* Oct 2 21:43:44. 559: BGP: 12.0.0.2 OPEN has MP_EXT CAP for afi/safi: 1/1
* Oct 2 21:43:44. 563: BGP: 12.0.0.2 rcvd OPEN w/optional parameter type 2 (Capability) len 2
* Oct 2 21:43:44. 563: BGP: 12.0.0.2 OPEN has CAPABILITY code: 128, length 0
R1 (config-router )#
* Oct 2 21:43:44. 563: BGP: 12.0.0.2 OPEN has ROUTE-REFRESH capability (old) for all address-families
* Oct 2 21:43:44. 563: BGP: 12.0.0.2 rcvd OPEN w/optional parameter type 2 (Capability) len 2
* Oct 2 21:43:44. 563: BGP: 12.0.0.2 OPEN has CAPABILITY code: 2, length 0
* Oct 2 21:43:44. 567: BGP: 12.0.0.2 OPEN has ROUTE-REFRESH capability (new) for all address-families
BGP: 12.0.0.2 rcvd OPEN w/remote AS 2
* Oct 2 21:43:44. 567: BGP: 12.0.0.2 went from OpenSent to OpenConfirm
* Oct 2 21:43:44. 567: BGP: 12.0.0.2 send message type 1, length (incl. header) 45
* Oct 2 21:43:44. 611: BGP: 12.0.0.2 went from OpenConfirm to Established
Idle:
This State rejects all connections and initializes the TCP connection to the neighbor. Listen for TCP initialization from a neighbor and change the status to the connection status. (After neighbor, it will migrate from idle to active to try the TCP connection, but at this time it has accepted the TCP connection sent from the neighbor-passive open to 12.0.0.1)
In the active state, an OPEN packet sent from a neighbor is received, the status is transferred from active to idle, and the status is transferred from idle to connect, waiting for the TCP connection to complete.
Connect:
In this status, wait until the TCP connection is complete. If the TCP connection is successful, BGP sends an OPEN packet and enters the OPENSENT status.
This article is from "_ Epilepsy ." Blog, please be sure to keep this source http://zhangchiccie.blog.51cto.com/1579309/696254