Welcome to QSFPTEK Global     Free shipping on orders over US$ 79.8     US and Poland Local warehouse

Contact Us


Free shipping on orders over US$ 79.8

Everything You Should Know About BGP

Author Leslie

Date 04/26/2024

This article tells you what BGP is and internal and external BGP, helping you understand and deepen your knowledge of BGP, and understand the importance of BGP to the Internet.

BGP, as an important participant in network communication, is a path-vector protocol used to exchange routing information between routers in different autonomous systems and help packets find the optimal path for transmission, reducing transmission time. This article will take you through a detailed understanding of what BGP is and how it works.

What is BGP

BGP shares some similarities with OSPF to a certain extent, but there are more distinct differences in functionality and application. BGP is similar to express delivery services on the Internet. When someone sends a package, the delivery company receives it and selects an efficient route to deliver the package to the recipient. The border gateway protocol's role is to exchange routing information between routers in thousands of autonomous systems via TCP connections (port 179), enabling routers to understand the routing information of the entire internet and select the best path for data transmission based on local policies.

How Does BGP Work

BGP is used for exchanging routing information between different autonomous systems. Here's how it works:

Establishing Neighbor Relationships: BGP routers establish neighbor relationships by connecting to adjacent border gateway protocol routers via TCP on port 179, configuring the IP addresses of neighboring routers, and necessary parameters.

Exchanging Routing Information: After establishing neighbor relationships, BGP routers periodically send route update messages to ensure that neighboring routers understand reachable destinations and their paths. Announcement messages are sent to confirm whether the neighbor relationship is active.

Applying Routing Policies: After receiving routing information, border gateway protocol routers decide whether to accept, reject, or forward the information based on locally configured routing policies, typically based on AS paths, prefix lengths, or autonomous system numbers.

Path Selection: BGP routers use the path vector algorithm to select the best path, with the AS path being the most important attribute. The best path is selected based on routing policies and configurations and stored in the routing table.

Updating the Routing Table: After determining the best path, BGP routers update their routing table and guide the data packets to their destination. The routing table contains the best paths to reach the target network and their relevant attributes.

What Is Autonomous System

The internet we are familiar with is composed of thousands of autonomous systems (AS), each of which is operated by a single organization running a set of routers. 

network structure

In the previous context, we compared BGP to courier services on the internet, where autonomous systems are akin to courier companies in each city. A city may have dozens or hundreds of courier points, but all packages must first be consolidated at the courier company's warehouse before being distributed. Internal routing in autonomous systems is similar to courier points, where outbound traffic is sent to the autonomous system and then further transmitted to other destinations using border gateway protocol routing.

best path example

In this illustration, we assume there are six autonomous systems. If AS1 needs to route a packet to AS3, it has the following two options:

Option 1: Sent from AS1 to AS2, then from AS2 to AS3.

Option 2: Sent from AS1 to AS6, passing through AS5, AS4, and finally reaching AS3.

Since the path to AS2 is shorter than the path to AS6, the default path via AS2 is considered the best path. This is the actual scenario of BGP routing. Each autonomous system connects to neighboring autonomous systems via the TCP/IP protocol to share routing information and find the best path. However, border gateway protocol routing sometimes considers business factors, as autonomous systems may choose routes based on commercial considerations rather than purely selecting the best path.

What Is The Difference Between eBGP and iBGP

eBGP and iBGP are two different operational modes of the BGP protocol, primarily used for different routing information exchange and path selection functions.

Operational Environment

eBGP is typically used for routing information exchange between different autonomous systems (ASes), operating between different ASes. It is mainly used between border routers of different organizations or network service providers.

iBGP is typically used for routing information exchange between routers within the same autonomous system (AS), operating within the same AS. It is mainly used between routers within the same organization or network service provider.

Routing Information Propagation

eBGP propagates routing information between different autonomous systems to ensure that data packets can be transmitted across different autonomous systems.

iBGP is used to propagate routing information within the same autonomous system to ensure that routers within the same AS select the best path for data transmission.

Attribute Handling

eBGP typically resets the NEXT_HOP attribute, replacing the IP address of the next-hop router with the IP address of the receiving eBGP router.

iBGP does not modify the NEXT_HOP attribute because all iBGP routers are within the same autonomous system, and the NEXT_HOP address still points to the original eBGP router.

ebgp and ibgp

Why Do We Need BGP

BGP, as one of the primary routing protocols on the Internet, plays several crucial roles, which are the reasons why we need BGP:

Exchange of routing information between different autonomous systems (ASes)

The Internet consists of thousands of different autonomous systems, and BGP primarily facilitates the exchange of routing information between these autonomous systems, ensuring the transmission of data packets across them. This is essential for constructing the overall structure of the Internet, as autonomous systems are independently managed networks. BGP enables communication and exchange of routing information between autonomous systems, thereby achieving global network interconnection.

Ensuring network reachability and stability

BGP ensures network reachability by selecting the best path to transmit data packets from source addresses to destination addresses. It selects the optimal path based on network topology, policies, and performance to ensure the most efficient data transmission. Moreover, it can quickly adapt and recover in case of network issues, thereby ensuring network stability.

ISP's routing control

For Internet Service Providers (ISPs), border gateway protocol is a critical tool for managing their networks. ISPs use BGP to manage and control network routing information, ensuring network stability and performance. Additionally, ISPs can utilize BGP in switches to manage internal routing information and optimize network traffic forwarding.

Support for multipath forwarding and load balancing

BGP can select the best transmission path based on predefined policies for different data packets. Switches can also achieve load balancing by distributing traffic across multiple paths. When the load is high, the border gateway protocol routes data packets through alternative paths, thus improving network resource utilization and performance. A BGP switch is much better than a normal switch.


BGP, as a key participant in network communication, ensures the exchange of routing information between different autonomous systems and facilitates the optimal transmission of data packets among them. Its presence enables global connectivity, turning the world into a unified entity. If you have any questions about BGP, please feel free to contact QSFPTEK's CCIE/HCIE engineers at support@qsfptek.com. Our engineers will provide you with comprehensive support.


Contact us