What is BGP in Networking and How it Works?

In this post, we’ll explain what is BGP in Networking, how it works, and some of its key features, benefits, and challenges. By the end of this post, you should have a good understanding of BGP and what important concepts to learn to get a solid understanding of BGP.

Fun Facts:- As of January 2021, there are nearly 100,000 BGP ASNs worldwide, with about 29% of them located in the U.S. (networkworld.com)

A full IPv4 BGP table as of August 2015 Large ISPs may add another 50% for internal and customer routes. (en.wikipedia.org)

What is the definition of BGP (Border Gateway Protocol)?

Border Gateway Protocol (BGP) is a path vector dynamic routing protocol used to exchange routing and reachability information among autonomous systems (AS) on the Internet. It is the protocol used to build the global routing table, and it is the backbone of the modern Internet.

BGP is the only protocol that lets you build an IP network that is scalable, reliable, and strong. It is designed to allow routers to share information about networks, determine the best route for data to travel, and detect and respond to changes in the network quickly.

Why do we need BGP?

BGP is necessary for networking because it serves as the central nervous system of the Internet. By supporting routing between different Autonomous Systems (ASes), BGP allows networks to communicate effectively with each other. In addition, BGP4 is the most current standard for routing, making it an essential tool for multihoming networks to increase redundancy and improve network performance.

Without BGP, the Internet would not function as it does today. It is responsible for allowing different networks that are connected by different autonomous systems to communicate with one another and transfer data securely. This is done by providing an efficient and secure way for networks to share information about their routes and other related information.

The Origin & History of BGP

BGP was first developed by the IETF (Internet Engineering Task Force) in 1989 as an extension of the existing EGP (Exterior Gateway Protocol) protocol. EGP was the original protocol used to exchange information about external routes and was used in the early days of the Internet.

In 1991, BGP version 1 was released, followed by version 2 two years afterward. BGP is now in its fourth version, released in 2006. The main difference between BGP versions is the support for Classless Inter-Domain Routing (CIDR). CIDR, which replaces the old classful addressing scheme, allowed for more efficient use of IP address space.

Over the years, BGP has become the de facto standard for building the global routing table on the Internet and is still in use today.

What are the different types of BGP?

There are mainly three types of BGP.

  1. Internal BGP (iBGP)
  2. External BGP (eBGP)
  3. Multiprotocol BGP (MP-BGP)

1. Internal BGP (iBGP)

iBGP is used within an AS to exchange routing information with other routers in the same AS. It helps routers within the AS communicate to determine the best routes for data to take.

2. External BGP (eBGP)

eBGP is used between ASs to share information about routes and decide which routes should be used when forwarding traffic.

3. Multiprotocol BGP (MP-BGP)

MP-BGP allows for the exchange of routing information for a variety of different network layer protocols, such as IPv4 and IPv6. Additionally, Multiprotocol BGP can exchange labels with other providers for MPLS VPNs and enable traffic sharing based on bandwidth values.

How does BGP work?

For BGP to work, routers, known as “Border Gateways,” must first establish a TCP connection on port 179 with each other to exchange relevant data.

Once this connection or BGP neighborship is established, the network devices in each autonomous system must first exchange routing information to create a large routing table. This exchange of information among autonomous systems is referred to as “route propagation.”

This is done by exchanging messages called “BGP updates,” which contain information about the available routes and their associated metrics. This process is overseen by BGP routers, which also provide a “best path” selection algorithm that can be used to determine the best route for traffic to take at any given time.

Finally, when a router receives a BGP update from another router, it will use the information in the update to update its routing table, effectively allowing it to “learn about” the rest of the Internet. Each router will then compare the paths it has received from its neighbors and select the best route for any given destination. This is known as the “Best Path Selection Process.”

Once the best path has been determined, BGP will store it in the “Adjacent Routing Tables” of the router. This table contains the routes to each destination, and the associated Next Hop, which is the IP address of the neighboring router that the path is directed to. These tables are then used to route traffic as efficiently as possible.

This is how BGP is able to give each router an up-to-date view of the global Internet routing table.

How to effectively learn BGP concepts?

You can use this as a laundry list to prepare yourself to learn about BGP concepts. Don’t worry; I will be explaining each concept in upcoming posts.

For a deeper understanding of BGP concepts, I suggest reading RFCs related to BGP.

  1. Understand the basics of BGP
  2. Learn how to configure BGP on a router.
  3. Understand the different types of BGP messages
  4. Learn how to troubleshoot BGP
  5. Understand the different types of BGP attributes
  6. Understand Autonomous Systems AS numbers and their depletion.
  7. Learn BGP Next hop processing
  8. Learn how to advertise routes in BGP.
  9. Learn BGP Path Selection or route selection Process
  10. Learn BGP filtering to filter unwanted routes

1. Understand the basics of BGP

Learning about BGP is essential for those working in networks, as it can help optimize traffic flow and create better network performance. The basics of BGP include BGP message types, TCP ports, BGP states, and how BGP establishes and maintains neighborship.

2. Learn how to configure BGP on a router.

Learning how to configure BGP on a router is important for optimizing routing in a network. With BGP’s help, routers can communicate with each other and share routes. You can also improve the BGP setup with more advanced configurations like route reflectors and confederations. By configuring BGP correctly on a router, network performance can be maximized, and ensure efficient communication between networks can be.

3. Understand the different types of BGP messages

Understanding the different types of BGP messages is important as they are used to communicate routing information between routers. Different BGP messages include Open, Keepalive, Update, and Notification. Each message has a specific purpose and will cause the FSM (finite state machine) to transition between states based on their actions. For example, open is used when establishing a TCP connection, while Keepalive is used to check for messages from the peer. Update and Notification are both used to communicate routing information between routers. Understanding these different types of BGP messages helps networks optimize traffic flow and avoid congestion or network failure due to incorrect routes being taken by packets traversing the network.

4. Learn how to troubleshoot BGP

Troubleshooting BGP is important for network stability, as malicious attackers could tamper with routers if security mechanisms were not in place. As a result, resolving issues that arise due to BGP can help maintain the network’s overall performance. RFC 7454 provides an overview of BGP operations and security measures you can use in troubleshooting.

5. Understand the different types of BGP attributes

BGP, or the Border Gateway Protocol, is a very important networking protocol that is used to route Internet traffic. BGP uses path attributes to determine which route a packet should take from point A to point B. Main BGP path attributes include AS_Path, Next-hop, and Origin, which are important for understanding and configuring routes within an autonomous system. AS_Path is the simplest path attribute. It figures out a route based on how many ASs it went through to get to the local router. next-hop, on the other hand, figures out the next router in the path. Origin helps decide where the packet came from originally. The different types of BGP attributes are important for helping networks save bandwidth and make policy decisions while routing packets through the network.

6. Understand Autonomous Systems AS numbers and their depletion

An AS number is a unique identifier assigned by the IANA (Internet Assigned Numbers Authority) that is used to identify IP networks connected to a common ISP or organization. 

BGP AS numbers come in two formats, 2 bytes, and 4 bytes, with a maximum capacity of 65,536 and 4294967295, respectively. 

7. Learn BGP Next hop processing

BGP next-hop processing differs when a route passes between iBGP peers vs. eBGP peers; how can you change it to influence the traffic path?

8. Learn how to advertise routes in BGP

Advertising routes in BGP are different than in IGPs like OSPF, RIP, and IS-IS. There are multiple ways to advertise routes/networks, so ensure you understand them thoroughly.

9. Learn BGP Path Selection or route selection Process

It is important to learn the BGP path selection process because it can help to ensure that traffic is routed efficiently across a network. By understanding the metrics BGP uses when selecting routes, such as AS path information, Communities, and Local Preference network, administrators can ensure that traffic takes the best possible route through their autonomous systems. Furthermore, administrators can effectively manage their networks and prevent routing issues by knowing how BGP works and what factors it considers when selecting routes.

10. Learn BGP filtering to filter unwanted routes

The significance of BGP filtering is that it allows organizations to block inbound traffic from networks that are known to be controlled by malicious actors and monitor suspicious changes in network behavior that might indicate an attack. It also reduces routing table size, prevents routes from being accepted by unexpected customers, and dampens the effect of routes that tend to flap often. Additionally, it can be used to block specific types of traffic, such as spam or malicious content, and prevent customers from accessing internal systems.

What are the benefits of using BGP?

  1. The primary benefit of using BGP is its scalability, efficiency, and reliability.
  2. BGP can store and process a large number of routes, helping to handle any network faults quickly.
  3. Additionally, it allows for manual configuration, which provides flexibility in setting up networks.
  4. Moreover, BGP can help conserve bandwidth by using RPKI to ensure only the correct organization distributes route updates for addresses they own.
  5. Furthermore, BGP has some security features like filtering, and md5 authentication between peers, which helps protect networks from unauthorized changes or malicious attacks.
  6. It is highly scalable, efficient at choosing the best next hop for a given destination, and helps conserve network bandwidth by minimizing the number of updates and traffic.
  7. It can also quickly handle network failures and facilitate efficient network transmissions.
  8. Additionally, BGP allows for manual configuration to adjust routing information as needed.
  9. The use of RPKI also helps to mitigate security risks by ensuring only legitimate owners are able to distribute route updates.

What challenges arise with using BGP in Networking?

Some of the challenges while using BGP are:-

  1. AS number depletion and 32-bit ASNs
  2. Inefficient routing and scalability
  3. Lack of visibility and control of traffic
  4. Difficulty with troubleshooting and diagnostics
  5. Security threats from malicious actors
  6. Potential for routing loops and instability
  7. Configuration complexity when using BGP

1. AS number depletion and 32-bit ASNs

BGP AS Number Depletion is a problem that occurs when the finite pool of 16-bit AS numbers available for assigning to networks and ISPs becomes depleted. When this happens, the Regional Internet Registries (RIRs) cannot assign new AS numbers which limits the ability of these networks and ISPs to interconnect. To combat AS number depletion, RFC 1771 proposed coding AS numbers on 16 bits, whereas RFC 6793 extended this encoding from 16 bits up to 32 bits, thus allowing up to 4 billion available ASes. However, since many routers do not support the new 32-bit encoding, a new attribute called OT AS4_PATH has been introduced in order for traffic between router groups with different size encodings of their assigned autonomous system number (ASN) to be routed correctly.

2. Inefficient routing and scalability

One of the challenges that arise with using BGP in networking is malicious interference. The selection of the shortest path between two routers makes the network susceptible to malicious attacks, which could cause outages. Additionally, when a multi-homed network announces the same IP address blocks across all its BGP peers, this can result in congestion on its networks. To avoid this problem, administrators may divide large contiguous IP address blocks into smaller ones and announce different ones on optimal paths. Finally, when a load balancer distributes traffic among multiple servers using BGP/LISP gateways, it does not increase routes seen on the global BGP table, but it can help reduce the load on one’s network.

3. Lack of visibility and control of traffic

The lack of visibility and control of traffic is a challenge that arises with using BGP in networking due to the complexity of the algorithms used to determine which path between two networks is chosen, as well as its vulnerability to malicious interference and outages. To mitigate this risk, many network owners have started using RPKI to increase security and reduce potential outages or unauthorized manipulation. You can use IP Connects and DIA services for smaller networks or those who want to avoid taking on AS ownership responsibilities.

4. Difficulty with troubleshooting and diagnostics

Troubleshooting and diagnostics with BGP can be more difficult because route flaps can overwhelm routers with updates, leading to router failures. Certain misconfiguration problems particular to BGP can also cause widespread outages. Additionally, rolling back the router software or BGP configuration may speed up the process of recovering from a BGP issue. However, this may only sometimes work.

Furthermore, suppose networks are already unstable or in flux. In that case, troubleshooting and diagnostics become even more difficult as BGP updates may lead to DNS requests failing, which in turn can overload DNS servers and negatively affect other services.

5. Security threats from malicious actors

When using Border Gateway Protocol (BGP), malicious actors may attempt to launch Distributed Denial of Service (DDoS) attacks or bot abuse. To protect against these security threats, organizations should strengthen their website and API security, incorporate threat intelligence solutions, and develop a cyber resilience plan. Follow these BGP security best practices to secure your network.

6. Potential for routing loops and instability

According to the RIPE Routing Working Group, one of the challenges with using BGP in networking is that it is no longer as important to use route flap damping. Furthermore, applying flap damping to ISP networks may cause side effects for ISPs and their customers. Additionally, BGP updates are vulnerable to malicious interference and can often result in outages if not secured properly. This emphasizes the need for routing protocols such as RPKI (Routing Policy Information Base), which secure and validate BGP updates, reducing the risk of disruptions. Finally, route selection can be difficult due to complex algorithms that take into account multiple factors, including BGP metrics, making it difficult for network administrators to control traffic.

7. Configuration complexity when using BGP

Configuration complexity is an issue when using BGP because it can make it difficult to verify routing information. Incorrect configuration can lead to outages, suboptimal routes being selected, and false routing information, which may cause instability and chaos in the network. Additionally, configuration complexity increases the chance of security issues like BGP hijacking. This highlights why taking time to configure BGP properly is so important for maintaining a stable and secure network environment.

Conclusion

In conclusion, the Border Gateway Protocol (BGP) is a powerful and reliable path vector protocol responsible for building the global routing table on the Internet.

It is designed to provide robust and secure routing, quick convergence, incremental updates, and load balancing to ensure that data is routed to its intended destination along the most efficient route possible. However, BGP can be complex to configure and manage, is prone to Routing loops, requires the use of a consistent addressing scheme, and is vulnerable to malicious attacks.

Despite its drawbacks, BGP remains an essential part of the modern Internet and will continue to be used for many years to come.

FAQs

What is BGP?

Border Gateway Protocol (BGP) is an essential routing protocol for the internet backbone that helps ISPs and large companies route traffic more efficiently. BGP works by exchanging routing information between routers via a set of attributes, allowing for more precise control over how traffic is routed. This allows network administrators to better shape and directs traffic patterns, increasing performance and reliability. While this comes with advantages, it also has some weaknesses that need to be considered when using it. For complete details about BGP, consult the IETF RFC 4271 document.

What are the main features of BGP?

The main Features of BGP are:-

  1. Robust and secure routing: BGP is designed to be reliable and secure.
  2. Quick convergence: BGP can quickly detect and respond to network changes.
  3. Incremental updates: BGP is an incremental update protocol, meaning only changes or new routing information is sent, saving bandwidth.
  4. Load balancing: BGP can load balance traffic across multiple paths, allowing for better scalability and resiliency.
  5. BGP sends information about the reachable networks it knows to all its peers, allowing for better route selection and more efficient routing.
  6. Based on the routes it receives in return, it constructs a local routing information base consisting of the best route to each network. In turn, BGP sends its selected routes to the main system routing base, where they can be selected as the best route.
  7. BGP is a scalable and efficient standard that suffers from high memory requirements and security issues. Still, it supports security features such as next-hop support, path information, policy support, running over Transmission Control Protocol (TCP), conserving network bandwidth, supporting Classless Inter-Domain Routing (CIDR), and supporting multiple protocols.
  8. For full details about BGP, including state machine details and messaging formats, consult the IETF RFC 4271.

What are the drawbacks of using BGP?

Using the Border Gateway Protocol (BGP) can lead to several potential drawbacks, some of which are.

  1. BGP is prone to stability problems, manual configuration errors, suboptimal routing when extensions are used, delayed convergence times, and increased memory usage.
  2. Additionally, BGP is susceptible to security issues such as BGP Hijacking and can be used for malicious purposes. 

How is BGP used in networking?

BGP (Border Gateway Protocol) is a protocol for routing traffic between autonomous systems in a network. It works similarly to GPS applications on mobile phones, as it determines the best path based on existing knowledge.

BGP can manipulate traffic patterns by exchanging network reachability information between different ASes, making it easier for separate systems within the Internet to work together.

By using BGP, routers can update their routing tables with network-prefix announcements, which allows them to advertise prefixes to other AS networks and manage traffic within and between ASes.

Leave a Reply

Your email address will not be published. Required fields are marked *