Border Gateway Protocol Guide
Border Gateway Protocol Guide
Are you ready to learn about cloud can help the network “self-heal” if a
networking and Border Gateway Pro router or link becomes unusable.
tocol (BGP)? Should any failure occur, BGP will
I began my tech career as a calculate a new path for traffic to
network engineer and have more reach its destination as a GPS would
than 25 years of networking recalculate a path around a blocked
experience. I love BGP and use it road or freeway.
everywhere. I’m so passionate about
it that I’ve spent more than 10,000 When connecting to external organiza
hours work tions, BGP is used as an exterior
ing with BGP. For cloud architects, gateway protocol. For the last few
cloud solution architects, network decades, organ izations have used
architects, and cloud network BGP to connect to Inter net Service
engineers, BGP is the most Providers. BGP is also used to
important routing protocol to connect Internet Service Providers to
understand. BGP knowledge is each other. BGP also connects
extremely critical for building an elite organizations to cloud service
cloud computing career. In this providers (CSPs). Why? Be cause
article, we explain why we use BGP, CSPs are external organizations, the
how BGP works, and how to optimize same as Internet Service Providers
BGP routing for traffic engineering. (ISPs).
This article takes you closer to
building a successful cloud architect BGP is widely used because it’s
or cloud networking career! incredi bly scalable. Routers on the
global internet traffic move both IPv4
Inroduction to BGP and IPv6 traffic. The Internet IPv4
BGP is the primary routing routing table has more than 800,000
protocol of the Internet. Did you routes. It is common for Internet
know that every time you visit a service providers to connect to 10
website or surf the Internet, you are other In ternet service providers, all
using BGP? BGP is a dynamic rout providing 800k routes per ISP,
ing protocol, meaning it helps to totaling 8 million routes!
determine the best path for traffic to
reach its destina tion. BGP helps
routers exchange routing (network
layer reachability information)
between routers running the BGP
routing protocol. Being dynamic,
BGP determines the best path for
traffic to reach its destina tion and
destination is blocked thus preventing
anyone from accessing their intended
website, portal, or other destination.
Also of note is that static routing
would require the manual
configuration of all 800k routes on
every router - that’s a lot of
configuring!
10
ognized by all BGP routers. Well-known tive and stay with the route
mandatory attributes must be included advertisement
with from AS to AS. Unrecognized optional at
every prefix advertisement. This is tributes should be accepted and passed
different to other BGP peers. If it is accepted and
from well-known discretionary attributes, passed from one BGP peer to another
which may or may not be included in then
prefix going forward it must continue to be
advertisements. passed.
Other Path Attributes (PAs) are
Now, optional attributes are not required nontransitive
to and cannot be shared from AS to AS.
be recognized by all BGP routers.
Optional In eBGP, the Network Layer Reachability
attributes can be set so that they are Information (NLRI) consists of the
transi
network
prefix, prefix length, and any BGP attrib
utes. BGP attributes are mandatory
when
eBGP and iBGP exchange NLRI in the
up
date message.
BGP Attributes
BGP attributes are characteristics
of the route. BGP attributes are related
to
the origin of the route, AS Path, Next
Hop
IP, Multi-Exit Discriminator, Local Prefer
ence, Atomic Aggregate, and Weight.
These attributes will be discussed in the
following section.
11
Origin
The Origin is a mandatory attrib
ute that defines the origin of the path discretionary attribute. Local preference
and associated routing information and is
is gen erated by the BGP speaker. The used to help determine the best path. All
Origin can be learned from the IGP (i.e things being equal, routers prefer the
OSPF) from BGP (EGP) or incomplete. path
BGP prefers IGP learned routes over with the highest local preference.
EGP learned routes over incomplete
routes. Atomic Aggregate
Atomic Aggregate is also a well
AS (Autonomous Systems) Path An AS known discretionary attribute. This
Path is an attribute that iden tifies the attribute
different autonomous systems a route is carried out when BGP routes are
has passed through. Anytime a BGP aggre
speaker creates a route or learns about gated (summarized) and routes inside
a route from another BGP speaker, the the
AS Path is updated – depending on the summary address are suppressed.
loca tion of the BGP speaker.
Weight
Next Hop Weight was a Cisco proprietary
Next hop is another well-known means to influence outbound traffic.
mandatory BGP attribute. The next hop Now,
at tribute defines the IP address that the it’s supported by AWS and some other
router should send traffic to for the organizations as well. Weight is another
specified route. This attribute is so attribute used for traffic engineering. For
critical because if the next hop is not
routers that support the weight attribute,
available the route will not be placed in
the
the routing table.
higher the weight the more preferred the
route.
Multi-Exit Discriminator (MED) The
Multi-Exit-Discriminator or MED is an
BGP Path Selection
optional, non-transitive attribute used to
How does BGP select a path? The
determine the best path. It is part of the
BGP decision process. When all factors BGP prefers the path with the highest
are equal, BGP prefers the path with the weight.
low If the weights are equal, then it prefers
est MED (Multi-Exit Discriminator). You the
can route with the highest local preference. If
consider it a metric for the route. the
local preferences are the same, prefer
Local Preference the
Local Preference is a well-known route that originated locally on the router.
If the local preferences are the same
prefer If the AS Path is the same, then prefer
the route with the shortest AS path. the paths with the best origin code. This
is where we talk about an IGP being
better than an EGP versus better than
incomplete. Now, if the origin codes are
the same, then prefer the route with the
lowest MED, or multi-ex
it discriminator. If the MEDs are the
same, then prefer an eBGP route
versus an iBGP route. At this point,
we’re getting far into the process and
BGP must find some way to choose a
preferred path.
Availability Zone
[Link]/16
[Link]/15
VGW
Availability Zone
[Link]/15
Virtual Private Cloud Organization’s Data Center
146
Adjusting Weight increase the route for weight for a
The second method is adjusting the certain subnet, that will become the
weight (reference graphic below). primary path. We will use reduced
What does this mean? If you are on weight for the backup subnet. Should
the receiv ing end, as you take in a link fail traffic will use the backup
routes, you can in crease the weight path.
of specific subnets. If you
VPC
[Link]/16 Weight
35000 [Link]/16
Weight 32768
Availability Zone
[Link]/16 Weight
35000 [Link]/16
Weight 32768
VGW
Availability Zone
[Link]/15
Virtual Private Cloud Organization’s Data Center
Adjusting Weight
156
Local Preference change the local preference, then
Another method is using Local prefer increase it to 200. We do the same
ence. We could take these incoming thing on the bot tom link for the
routes, match them, and then raise [Link]/16 and raise the local
the local pref erence of one site for a preference for that specific subnet.
route that we want to take and do the We will keep the standard local
same thing for the oth er route. preference for the backup subnets.
Observe the diagram below. We take This way, the desired subnets will
our primary subnet on the top link, use the desired links. When one of
the [Link]/16 that we want to those links fails, your traffic will take
use, the less-preferred route for the
subnet.
VPC
VGW
Availability Zone
Availability Zone [Link]/16 Local Pref
200 [Link]/16 Local
Pref 100
200 [Link]/16 Local
Pref 100
[Link]/15
Virtual Private Cloud Organization’s Data Center
Local Preference
166
Prepending AS Path a link with a normal AS Path with a
Earlier, we discussed that BGP backup subnet with a longer AS
is a path vector protocol. As a Path. By doing so on both links, we
reminder, a path is added every time will have [Link]/16 on the top
we learn a route. In order to load link and [Link]/16 on the bottom
share without getting out link. Should either link fail, traffic will
of-order packets, we can prepend go on the backup link. If our AS is
(add) additional AS Paths to 64523, we add in or prepend another
deprioritize a route. Therefore, we 64523, as we did in the graphic
can send the desired subnet on below.
VPC
[Link]/16 AS Path
64523 [Link]/16 AS
Path 64523 64523
Availability Zone
[Link]/16 AS Path
64523 [Link]/16 AS
VGW Path 64523 64523
Availability Zone
[Link]/15
Virtual Private Cloud Organization’s Data Center
Prepending AS Path
176
Modifying MED
Realistically, we can lower the
MED and make a path more VPC
preferred. In the below diagram, we the MED for the [Link]/16 and
reduced the MED on the top link for kept the [Link]/16 at the
the [Link]/16 subnet and kept standard MED of 100. This means
[Link]/16 subnet at 100. the top link with be the preferred path
Conversely, on the bottom link we for the [Link]/16. On the bottom,
reduced the preferred subnet will be the
[Link]/16 subnet. Should either
link fail, all traffic will divert to the
available link.
[Link]/16 Med 50
[Link]/16 Med
100
Availability Zone
[Link]/16 Med 50
[Link]/16 Med
VGW
100
Availability Zone
[Link]/15
Virtual Private Cloud Organization’s Data Center
186
A quick overview of the BGP Path Selection process.
We hope you have enjoyed learning about BGP. BGP is critical knowledge
every cloud and networking professional must know. Elevating your BGP
competency will greatly enhance your career and beyond!
196
Glossary
We’ve covered a considerable amount of content about
BGP. Below is the associated terminology to make it
easy and efficient to understand.
206
Glossary (con’t)
We’ve covered a considerable amount of content about
BGP. Below is the associated terminology to make it
easy and efficient to understand.
•AS Path: A BGP attribute that identifies the different autonomous systems
a route has passed through.
•Next Hop: The Next Hop attribute defines the IP address that the router
should traffic to for the specified route.
•BGP Path Selection: The algorithm used to determine the best path to the destination.
216
Dedicated to your training.
Committed to your future.