To use BGP, the neighbourship between BGP routers must be established. This is named as BGP neighbourship or BGP peer. In this lesson, we will learn how to build a BGP Session, What is BGP Session Establishment, What are the jused BGP Messages for this process.
There are two types of BGP peer. These are iBGP(interior BGP) peer and eBGP(exterior BGP) peer. iBGP peer is the neighbour within the same AS. eBGP peer is the neighbour within another AS.
To learn how to configure BGP, you can BGP Configuration Lesson.
Without any connection attemp, the session is firstly in the idle state. With the first TCP message, the state changes to connect.
After TCP connection, one peer send Open Message and the other peer respond with another Open Message. During this process the state become OpenSent .
You can test your BGP Knowledge on BGP Practice Tests Page!
Upon receipt of Open Messages, neighbours generates Keepalive Messages. The name of this state which one peer waiting the other for reply keepalive is OpenConfirm.
Lastly, after the receiving response keepalive, point-to-point connection is established.And the name of this last state is Established.
During this processes, if any IP connectivity problem occurs or any neighbour missconfiguraion or any other problem occurs, the state become Active. Do not think that this word is good for BGP. In BGP world, Active means there is a problem on connection.
BGP keeps a version number of the BGP table. The version number changes whenever BGP updates the table with routing information changes.
BGP maintains a separate routing table based on shortest AS Path and various other Path Attributes, as opposed to IGP metrics like distance or cost. We will discuss these Path Attributes in the following posts.
We have learned the steps of BGP Session Establishment. Now, let’s learn a little more about BGP Messages used in this mechanims. Before learning BGP Messages and their fields, let’s firsly check the common BGP Header. Below, you can find common BGP header with its fileds.
BGP has four types of message if we do not include TCP messages. These messages are given below:
Let’s check these BGP Messages one by one with their fields.
Open Messages are used to create BGP connection. With the Open messages the following values exchanged:
Update Messages are used to send routing updates to peers. After the BGP session start, update messages are sent until the complete BGP table has been exchanged. After that at every update message, the BGP route table is updated and the BGP route table version number is incremented by one.
Keepalive Messages are to check the availability of the link. This also prevents hold time expire. This message has only BGP header. Keepalive messages are sent every 60 seconds. If no response during 3 keepalive time(hold time), 180 seconds, then it is realized that the connection is lost.
Notification Messages are used when an error detected. After receiving this messages, BGP and TCP connection is closed. Notification messages consist of the BGP header, error code, subcode and the data that describes the error.