Updated March 31, 2023
Introduction to Border Gateway Protocol
Border Gateway Protocol (BGP) is an interdomain routing protocol using path vector routing. It is first appeared in 1989 and has gone through four versions. It is a standardized Exterior Gateway Protocol used to exchange the routing and reachability information between AS(Autonomous System) on the internet. It is classified as a vector protocol. It is also classified as a distance vector routing protocol. Border Gateway Protocol uses classless interdomain routing addresses. i.e. to define destination address, BGPuses prefix, address, and the number of bits (prefix length) are used to update the messages.
Types of Autonomous Systems in BGP
The Internet is divided into hierarchical domains called an autonomous system. The autonomous system is divided into three categories namely stub AS multihomed AS and transit AS.
- Stub AS: Stub AS has only one connection to another AS, inter domain data traffic can be either created or terminated in the AS only. The Host in AS can send data traffic to other ASs. The host in AS can receive data traffic from hosts in other ASs. Stub As can be either source or sink.
- Multihomed AS: It has more than one connection to other ASs, but it can either be a source or sink for data traffic. It can send the data traffic to more than one ASs, it can receive the data traffic from more than one ASs. It does not allow transient traffic i.e. It does not allow data coming from one AS and going to another AS.
- Transit AS: It is a multihomed AS that also allows transient traffic.
Border Gateway Protocol Session
In border gateway protocol, the exchange of information between two routers takes place through the session. A session is a connection that is established between two BGP routers for exchanging the routing information. Border gateway protocol has two types of sessions, one is external BGP session and the internal BGP session.
External border gateway protocol session. External BGP session is used to exchange the information between two user nodes belonging to two different autonomous system. Internal border gateway protocol session: Internal BGP session is used to exchange information between two user nodes inside the autonomous system.
1. Border Gateway Protocol Header Packet
All BGP packets share the same common header. Fields in the header are as follows.
- Marker: It is an 16 byte field reserved for authentication.
- Length: It is a 2 byte field, defines the length of the total message including the header.
- Type: It is a 1 byte field that defines the type of packet.
2. Border Gateway Protocol Messages
There are four types of Border Gateway protocol messages which are open message, update message, keepalive message, and notification message.
Open Message
To create a neighborhood relationship, a router running BGP opens a TCP connection with a neighbor and sends an open message. If the neighbor accept the neighborhood relationship, it responds with a keepalive message, which means that the connection has been established between these two routers. The open message has the following fields
- Common Header: The header is the same as we have discussed earlier. In this case, the type value is 1.
- Version: It is a 1 byte field that defines the BGP version.
- My Autonomous System: It is a 2 byte field which defines a number of an autonomous system.
- Hold Time: It is a 2 byte field that defines the maximum number of the second fact can elapse until one of the parties receive keepalive or update message from other. Party is considered as a dead if the router does not receive one of these messages during hold time.
- BGP Identifier: It is a 4 byte field which defines the router who sends the open message.
- Option Length: Open message may contain some option parameters. The value will be set to 1 if there are any options, otherwise, it will be set to 0.
- Option Parameters: Option parameters have two subfields, one is the length of the parameter, and other is the parameter value.
Update Message
The update message is called as the heart of Border Gateway protocol. It is used by router to withdraw destinations that have been advertised previously, announce a route to new destination, or both. Border Gateway protocol can withdraw several destinations that were advertised previously, but it can only advertise one new destination in a single update message. update message has following fields
- Common Header: The header is same as we have discussed earlier. In this case the type value is 2.
- Unfeasible Routes Length: It is a 2 byte field that defines the length of the next field.
- Withdrawn Length: It lists out all the routes that must be deleted from previously advertised list.
- Path Attributes Length: It is a 2 byte field that defines the length of the next field.
- Path Attributes: It defines attributes of a path to the network whose reachability is being announced.
- Network Layer Reachability Information: It defines the network that is actually advertised by this message.
Keepalive Message
Routers running border gateway protocol must exchange the keepalive message regularly to tell each other that they are alive. It consists of inky one filed i.e. common header. The header is the same as we have discussed earlier. In this case, the type value is 3.
Notification Message
A router sends a notification message whenever the error is detected or router wants to close the connection. The notification message has the following fields
- Common Header: The header is the same as we have discussed earlier. In this case, the type value is 4.
- Error Code: It is a1 byte field which defines the error category.
- Error Subcode: It is a 1 byte field that defines a type of error in each category.
- Error Data: It is us d to give more diagnostic information about the error.
Recommended Articles
This is a guide to Border Gateway Protocol. Here we also discuss the introduction and types of autonomous systems in BGP along with border gateway protocol session. You may also have a look at the following articles to learn more –