BGP (Border Gateway Protocol) is a protocol in which routing information is exchanged between autonomous systems in telecommunications. Internet registered service providers usually consist of several autonomous systems and it is necessary to use a protocol such as BGP for data traffic between autonomous systems.
The BGP Protocol
With the BGP, route tables are exchanged between Internet providers’ autonomous systems. Routing information is made between external routers in each autonomous system compatible with BGP. Hence, it is the most widely used protocol used in EGP configuration.
In order to configure the operation of the BGP and to manage the information of data traffic between networks, locations that will become AS (Autonomous System) must be determined and installed.
Internal connections or sessions of each AS units will be iBGP, external sessions will be eBGP. Therefore, it is defined as an External Gateway Protocol and selects over loop-free paths and shares routing information between autonomous systems.
Used by the most important Internet service provider companies, this protocol is a basic routing protocol for networks.
BGP4 is the first to support CIDR and path aggregation, and unlike IGP, RIP, OSPF, and EIGRP, it doesn’t use metrics such as hop count, bandwidth, or latency. Unlike other protocols, it makes routing decisions based on network policies or rules using various routing features.
Version 1 of this BGP was defined in RFC 1105 in 1989 to replace EGP. The second version was defined in RFC 1163 in 1990 and the third version in RFC 1267 in 1991. Finally, version 4, which includes support for CIDR, is defined in RFC 1771 and RFC 4271.
The main features of the border gateway protocol are;
It is a routing path vector protocol.
It supports VLSM, CIDR, and route summarization.
Full updates are sent at the beginning of the session.
Peer-to-peer connections are established and maintained using TCP port 179.
The connection is maintained by periodic holds.
Any change made to the network results in an update.
Metrics called attributes used by the protocol provide a great level of detail in path selection.
The use of hierarchical addressing and the ability to change traffic flow has features that allow network design to grow.
It has its own routing table, but can share and query the internal IP routing table.
It is possible to change the traffic flow using attributes.
It is not concerned with transmitting the information of every single subnet in the organization, it just uses enough information to find an AS.
It forwards routing updates to other points with only AS numbers, bulk address prefixes, and policy-based routing information.
It ensures the reliability of the data transfer by carrying and synchronizing routing updates.
What is (Autonomous System)?
An AS is completely independent of different ASs and is a set of IP networks defined by their own routing policies. The BGP is also based on AS, so that connection between ASs is done through this protocol.
As the use of ASs does not contain information about ISPs’ internal networks of other ISPs, it sees them as a single management area and thus facilitates the exchange of routing information, as managed routing tables can be lightened.
It creates a list of ASs on the Internet and through which routing information passes, and these systems are managed and assigned by different organizations such as IANA (Internet Assigned Numbers Authority) and RIR (Regional Internet Registries).
How Does It Work?
BGP is a protocol that uses port 179 and runs over TCP. Inter-AS sessions are initiated over TCP connections and when route prefixes are dynamically changed between different ASs, secure communication is ensured, hiding the details of the entire network passing through it.
Since each AS uses an IGP for the path value of the links, when restrictions on routes are applied because it is impossible to find the shortest route to each destination, BGP uses an algorithm similar to the type of distance vector called road vector to select routes that contain the minimum number of AS to pass.
BGP routing tables store routes to reach target networks, and routes consist of a set of autonomous system numbers that must be followed to reach the specified prefix. The last AS number in the route corresponds to the organization where the prefix is registered.
The storage of all routes allows the detection and elimination of loops that may occur to prevent packets from passing through the same AS multiple times and sending continuously.
BGP uses different message types to announce new routing information.
This message type is used by the protocol to establish a session after a TCP connection has been established.
This type of message is one of the most important to BGP as these messages announce the announcement of new prefixes and are used every time a router calculates a better route to a destination.
This message type is used to report errors and to log out of a session.
These messages are used to track when a session has been created and verify that it is active.
Types of Situations
There are different state types to determine the operating structure of the router at the time the session process is performed.
The Idle indicates an initial state of the Router, such as enabling BGP and adding a neighbor where a session will be started or an interface to be enabled.
A state in which the router waits for its TCP session to complete in order to listen for incoming TCP sessions.
This is when a TCP session is expected.
This status type reports that the Open message was sent, but the Router is still waiting for a response from the device on which it was trying to establish a session.
OpenConfirm acknowledges that the previously sent Open message has received a reply, but a KeepAlive message has not yet been received.
Established reports that the Router initiates the transmission of Update, Information, and KeepAlive messages after receiving the first KeepAlive.