The Router waits for the TCP connection to be finished when it is in the Connect State. These two neighbors need to establish a TCP connection on port 179 and do the usual TCP three-way handshake to accomplish this.The following is an example of a three-way handshake between a web server and a client.
In a similar fashion, BGP also makes use of the TCP three-way handshake in order to establish neighborship.
Over the TCP connection, every single BGP message is sent in a unicast way to a single neighbor.
Types of BGP Messages
These are the different kinds of BGP messages:
- Open
- Keepalive
- Update
- Notification
BGP Message Type I: OPEN
Open messages ask for a BGP session to be started on top of an existing TCP/IP session. This starts a BGP session. After two BGP routers have finished a TCP 3-way exchange, they will use open messages to try to set up a BGP session. There will be details about the BGP router in the open message.
This message let’s routers say who they are and what their BGP operational parameters are. When a TCP session is set up between neighbors, an open message is always sent.
Fill out the following fields in the open message:
- Version: picks the version (2, 3, or 4); version 4 is the default.
- Autonomous System: it gives the sender’s AS number. If the AS numbers are the same, it checks to see if the BGP connection is EBGP or IBPG.
- Hold: This tells you how many seconds have passed since the last message has been sent before the emitter is thought to be broken. The hold time is set to 180 seconds by default. If the hold times of two neighbors are different, the smaller of the two times is used as the hold time.
- BGP identifier: which is an IP address, tells you the sender’s BGP identity. IOS figures out the number in the same way that OSPF figures out the router ID. The loopback interface address with the highest number is used. If there is no loopback, the IP address with the highest number on a physical interface is chosen.
- Optional Parameters Length: This field shows how long the optional parameters are or whether they are present (with a 0 value).
- Optional Parameters: The list of optional parameters, which includes route refresh, multiprotocol support, and authentication, is called Optional Parameters. It consists of
- assistance with Multi-Protocol BGP, or MP-BGP.
- assistance with Route Refresh.
- Support for 4-octet AS numbers.
Type II BGP Message: KEEPALIVE
The purpose of Keepalive Messages is to determine whether or not the link is available. Moreover, this prevents the hold time from expiring. Only the BGP header is present in this communication. Each and every sixty seconds, keepalive messages are transmitted. When there is no response after three keepalive times, which is equivalent to hold time, and 180 seconds, it is determined that the connection has been lost.
Type III BGP Message: UPDATE MESSAGE
Notifies users of routes that are either possible or withdrawn, or both. The contents of the update message are as follows:
Field Length in Bytes
- Unfeasible Routes Length: This value shows how long the pulled routes field is or whether it is not present.
- Withdrawn Routes: This is a list of IP address prefixes from which routes are being taken away. These are (Length, Prefix) tuples that list locations that can no longer be reached and will no longer be served.