Unless you’re a network administrator or tech enthusiast, you’ve probably never heard of BGP (Border Gateway Protocol), but the Internet could not exist without it.
A network is a group of computers linked together, either wired or wireless. Each computer is identified by a unique ID number called an IP address. BGP allows computers in different networks to communicate with one another, and we’ve come to know the combination of all the countless interconnected networks on the planet as the Internet.
A technology that defines how exactly to communicate messages is called a protocol. When you define a protocol, you mostly define what kinds of communication can take place. So what kinds of communication are possible with BGP?
First, it advertises blocks of IP addresses on that network to neighboring networks, a process known as originating an advertisement. Second, it gives networks a way to pass along this information to other networks, who pass it in turn to other networks, a process known as propagating an advertisement.
So why are these two kinds of communication needed?
If there was just one network in existence, there would be no need for a protocol that allows networks to share information about addresses. Figure 1 represents a network, labeled AS1.
You can think of this as just a name, but AS actually stands for Autonomous System, which is another word for network. A network is a system that is managed by a single person or group of people, and is thus “autonomous”. Generally, each organization has its own AS, and each has a unique number assigned to it. Networks use numbers rather than names because numbers are easier for computers, so AS1 is network 1.
If there were two networks, then each network would just need a way to tell the other, “These are my IP addresses.” This type of message is called an advertisement. This makes more sense when dealing with more than two networks, but for now, it’s worth knowing that creating an advertisement for your own IPs is called originating an advertisement. The red arrow in figure 2 represents AS2 originating an advertisement to AS1.
With three networks, we need an additional mechanism. In the diagram, AS3 is originating the advertisement for its addresses. But it would be nice if the people in AS1 could also reach AS3. So AS2 now takes the advertisement from AS3 and sends it on to AS1. This is called propagating an advertisement, and the diagram represents it with the green arrow. In this simple example, AS2 could just pass on the message it got from AS3 to AS1 without any changes. But in the real-world application of BGP protocol, AS2 would add its own AS number to the advertisement.
A more complex example
In this image, AS5 now is originating its advertisements to both AS3 and AS4, which are in turn propagating the advertisements to the remaining networks. AS1 can reach the AS5 addresses through either AS2 or AS4.
How does AS1 decide which path is better? Because each AS has been adding its own AS number to the advertisement, each one looks different:
AS2’s advertisement says the path is AS2 > AS3 > AS5
AS4’s advertisement says the path is AS4 > AS5
All other things being equal, a path with fewer networks is usually more desirable, but other factors often come into consideration.
BGP Allows Networks to Set Their Own Policy
BGP allows a network to control how it sends and receives traffic: what your network advertises, what it accepts, and what paths it prefers to use. In the example from Figure 4, AS1 might decide that the path through AS4 looks shorter. However, it might also decide that AS4 is untrustworthy and prefer the other path through AS2 > AS3. How exactly the network uses the data depends on the policies configured by the people running the network.
Ready, Set, Dive
It’s easy to take the Internet and the technology behind it for granted. If you made it this far, it you’re showing interest in looking under the hood and going beyond being a strict consumer. Keep your eye on this space for opportunities to learn more!Posted in: Web Hosting Basics