Border Gateway Protocol (BGP)

You can view the internet as a graph of interconnected Autonomous Systems (ASes). Each AS can act on its own, and is responsible for routing traffic within itself. The routers within an AS are typically connected to eachother through high-speed links, and are connected to other ASes through border routers.

ASes are able to assume the role of a customer, provider, or peer to other ASes.

The protocol used to route traffic between ASes is called BGP (Border Gateway Protocol). Unlike OSPF and RIP, BGP doesn't find the "best" path to a destination, but rather finds the "best" path according to the policies of the ASes involved. In fact, BGP only advertises based on reachability, and not on cost, since cost is not a well-defined concept across ASes.

BGP Overview

Each AS has one or more border routers that handle ingress and egress traffic to and from other ASes. ASes also need to have at least one BGP speaker that is responsible for exchanging routing information with other ASes. Border routers and BGP speakers are often the same device, but they don't have to be.

BGP is a path vector protocol, which means that it advertises the entire path to a destination (as a sequence of ASes), not just the next hop. This prevents routing loops and allows for policy-based routing through the entire path a packet takes.

BGP speakers aren't obligated to advertise any given path, but they are obligated to advertise the best path according to their policies. They can also cancel advertisements using a withdraw route message.

BGP works over TCP, and uses a keep-alive mechanism. If a BGP speaker doesn't receive a keep-alive message from a neighbor within a certain time frame, it will assume that the neighbor is down and will stop advertising the routes it learned from that neighbor.

Relationships

BGP Algorithm

Let $AS_i \to AS_j$ be the best path from $AS_i$ to $AS_j$. Then, the BGP routing protocol is defined as follows:

Prefer Customer > Peer > Provider, and select the ONE path with the minimum number of AS hops.

Policy-Based Routing Summary