Networking Basics: What is Border Gateway Protocol?
The quick definition: Border Gateway Protocol (BGP) is a standardized exterior gateway protocol designed to exchange routing information among autonomous systems on the internet.
If you don't know Border Gateway Protocol (BGP), you should. There's a reason BGP is dubbed "the protocol that makes the internet work." It does exactly that. This protocol controls routing of traffic across the entire web — and is critical to your network infrastructure.
BGP is mainly used by large networks for router configurations. But it's also used by small home networks to access the internet. Even though it can be a complex protocol, understanding the basics of BGP gives you the skills to increase your network's stability, security, and scalability.
What is BGP and How Does it Work?
When you connect a primary home router, your computer pulls an IP address from the router. Devices in your home then use that IP address to access the internet.
In the past few posts about IP and MAC Addresses and IPv4 Subnetting, we've talked about the IP address as similar to a postal address. We'll continue that analogy with BGP because it really helps illustrate this concept.
Let's say you want to send a postcard to your aunt. You live in Oregon. She lives in Florida.
You address and stamp the postcard and drop it in a mailbox. It arrives in Florida. What happens in between? A mail carrier empties the mailbox, and takes its contents to the post office. From the post office, the letter is sorted and bundled for delivery to a distribution center with all the other mail heading to the Southeast. It's probably four or five stops in three days for your postcard to arrive. The same thing is happening to your packets on the internet.
When you open a browser and access a website, you need to connect to a server that is not on your local network. Your browser needs to send the request to your home router that connects to your internet service provider's router. That router sends a request to the internet. The request then bounces from router to router until it reaches its intended destination, which is usually a web server.
BGP comes into play somewhere between your server request going from your home router to your provider's router. Your ISP's router "sits" between your home router and the public internet. BGP's primary responsibility is to find the best route for your request to reach its destination.
In this image, the router in red represents your local ISP's router. Notice how the two lines connect to other routers at the left and right of your ISP? BGP is what allows the main ISP router to connect to the other two routers to get the best possible path over the internet.
What is the BGP Routing Table?
You might wonder if you can connect a router to the internet and apply BGP yourself. The answer is probably not. BGP is designed to work with ISPs and requires certain permissions. Both the source and the target router have to request and accept permissions to do a lookup on what's known as the BGP Routing Table.
Each router represented in the image above uses BGP, and the routing tables that connect each router are large. The ISP connected to that router is responsible for looking at this massive routing table and getting you to the website you're trying to find.
What are BGP Neighbors?
BGP also allows your ISP to peer with other service providers — a process known as neighboring. When service providers share their networks, you can see the beginnings of a big mesh of websites — that's what we call "the internet." Now, everyone can start connecting to everyone else and exchanging routes.
Routes to distant locations can be long, but it's necessary for internet communication. You might not see BGP perform a lookup, but it happens every time you access a web page or any other public internet service. So, what happens when a network node crashes? BGP can easily route around it, recalculating the best route. BGP also ensures that your request goes to the right location, even if it uses a different route.
What are BGP Peer Groups
A BGP peer group is a set of neighbors that share the same outbound policy even though their inbound policies might be different. Instead of configuring each neighbor with the same policy individually, a peer group allows you to group the policies, which then can be applied to individual peers.
Usually with BGP, peers receive the same updates, making them ideal for the arrangement of a peer group. The main advantage, besides ease of configuration, is that updates are generated only once per peer group.
BGP Path Selection Explained
As you can imagine, there are practically infinite routes that can be used to travel the internet. BGP has to analyze every single route to determine which path is the most efficient to take. Literally, every single route is like, "Okay, let's see. Do any of these have a higher weight?" No. "Does anyone have a higher local preference? Did anyone of these routes… is it one that I originated?"
If there's a tie between routes, whichever has the lower IP address as a neighbor relationship ends up becoming the best route. If you're learning BGP, expect to spend a lot of time looking at different routing metrics. You can modify and tweak each metric to make sure that your system is choosing the best path.
What is a BGP Looking Glass?
It's possible to see the best routing path in action from anywhere in the world by using a BGP Looking Glass. A Looking Glass is accessed remotely for the purpose of viewing routing information. Essentially, the server acts as a limited, read-only portal to all the routers running the LG server.
You can access one through a service provider or an exchange point to see if your routes are showing up — and they're literally anywhere else in the world. For instance, if you ever wonder, "Well, how does Japan get to my network?" You can go to a looking glass in Japan and find out what it's thinking is the best route. It's pretty cool.
How to Learn BGP with CBT Nuggets Courses
CBT Nuggets offers hours of training on Border Gateway Protocol if you're looking to dive deeper into networking basics. Whether you want to learn more about the basics, peerings, advertising NLRI, Cisco routing policy mechanisms, or scalability mechanisms, you can explore trainer Anthony Sequiera's training.
Without BGP, the internet would have far more traffic than necessary, and there would be reduced bandwidth. With this protocol, your connection to the internet is always on and the requests you send always reach their intended destination. In fact, sometimes, BGP is the only fix you need to increase security or stability throughout your network.
CBT Nuggets trainer Jeremy Cioara has more to say on the subject of BGP in this MicroNugget:
delivered to your inbox.
By submitting this form you agree to receive marketing emails from CBT Nuggets and that you have read, understood and are able to consent to our privacy policy.