Internet Fundamentals

Fundamental Terms Underpinning the Internet

06 What is BGP?
An Explanation of the Fundamental Routing Protocol of the Internet

How much do you know about the workings of the internet? BGP (Border Gateway Protocol) is a crucial keyword for profoundly understanding the internet's workings. Every day, when we use the internet, we are benefiting from BGP. This article focuses on BGP, the protocol that underpins the internet's infrastructure, and explains it in a way that's easy for beginners to understand.

What is BGP (Border Gateway Protocol)?

BGP is a type of routing protocol.
A routing protocol is a set of rules and agreements for determining the optimal path for data packets on a communication network.
All data (packets) exchanged on the internet are delivered according to route information, and routing protocols are used to operate and control routing accurately. BGP is a prime example of such a protocol.

There are two main types of routing protocols: IGP (Interior Gateway Protocol), which is a dynamic routing protocol within an AS, and EGP (Exterior Gateway Protocol), which is a dynamic routing protocol between ASes.
While IGP is used to exchange information between routers within an AS to find the optimal path, EGP is used to exchange route information between different ASes.
BGP, which we will discuss below, falls under EGP. Route information via BGP includes a list of AS*1 numbers that the route passes through, and typically, routes with shorter AS paths are chosen. Additionally, manipulating path attributes as needed allows for more flexible routing control. This makes BGP a routing protocol that offers scalability, flexibility, and stability.

*1 AS (Autonomous System): A network managed by a single organization. The internet consists of numerous ASes interconnecting with each other.

The Connection Process of BGP

BGP routers establish connections called "peers" and exchange messages in a specific format. There are several types of messages, which vary depending on the state of BGP. Once the peer connection is established, routers regularly exchange route information, enabling each network to maintain up-to-date routing information and manage the flow of data on the internet efficiently.

BGP handles peer connections differently depending on whether the routers making peer connections are within the same AS or between different ASes. Peer connections within the same AS are called "iBGP" (internal BGP), while those between different ASes are called "eBGP" (external BGP). The following section explains the types of messages exchanged in BGP and the path attributes used in these messages.

Types of BGP Messages

As mentioned earlier, BGP uses several message types to efficiently exchange information between routers and maintain stable internet communication. Below are the main types of messages and their roles:


After establishing a TCP connection, the OPEN message is the first to initiate a session with a BGP neighbor. The OPEN message contains information such as version, AS number, BGP router ID, hold time, and authentication. If there are no issues at this stage, the router exchanges KEEPALIVE and UPDATE messages.


This message contains all route information for creating a BGP table or the differences in route information when changes occur. Each route has path attributes set, which control the route's priority and characteristics.


This message is sent when an error is detected. The sender of a NOTIFICATION message disconnects the TCP session after sending it.


Regularly sent messages confirm that the peer is established. They are usually exchanged at intervals of one-third of the hold time. The peer connection is considered down if no KEEPALIVE or UPDATE message is received after the set hold time.

Path Attributes

BGP's UPDATE messages include 'path attributes' to effectively control route information and choose the best paths based on network topology and policies. Below, we will explain notable path attributes:

AS_PATH Attribute

The AS_PATH attribute is a list of AS numbers the route information has passed through. By viewing the AS-PATH, routers can check if their own AS is on the list to avoid loops and control route priority.

NEXT_HOP Attribute

The NEXT-HOP attribute specifies the IP address of the next router to reach for the specified route. This ensures that packets are forwarded in the correct direction toward their destination.


The MULTI_EXIT_DISC attribute controls the flow of traffic within a network with different entry points in the same AS. Routes with lower MED values are preferred.

ORIGIN Attribute

The ORIGIN attribute indicates the origin of the route information. This attribute helps in prioritizing multiple routes that reach the same destination.

LOCAL_PREF Attribute

Used to control traffic flow within the same AS, routes with higher LOCAL_PREF values are preferred.


In this article, we have explained the connection process of different types of BGPs. BGP optimizes routing across the internet, enhancing data transfer efficiency and allowing network administrators to set routing policies flexibly. Additionally, it is a protocol that provides high scalability and stability, suitable for use in large-scale network environments, thereby supporting the internet.