1© 2017 ThousandEyes Inc. All Rights Reserved.
How BGP Works
Young Xu, Product Marketing Manager
2© 2017 ThousandEyes Inc. All Rights Reserved.
About ThousandEyes
Network Intelligence platform
that gives you a complete
picture from users to internal
and cloud-based applications
Routing!
User
 App
End-to-End Performance Data
App
Performance!
User
Experience!
Network
Topology!
Routing
Topology!
Enterprise, Endpoint and Cloud Agents
Network
Connectivity!
And Route Monitors!
Surface insights from
a global data set
Lightweight, flexible
data collection
Unified view of diverse
performance data
Solve issues across
shared infrastructure
See any network like
it’s your own
3© 2017 ThousandEyes Inc. All Rights Reserved.
Border Gateway Protocol
BGP-4 RFC4271
Where do I forward traffic to reach an IP
address in an external network?
How can I control the route and composition
of inbound traffic to my network?
4© 2017 ThousandEyes Inc. All Rights Reserved.
•  Autonomous System
–  Collection of IP prefixes
–  Common routing policy
to other ASes
–  Registered by an RIR
(regional Internet registry)
–  Denoted by a name and number
•  A Private AS can be used when
a single upstream exists
–  External routing policy is identical
IP Blocks and Autonomous Systems
AS 200
2.2.2.0/24
2.2.3.0/24
Autonomous
System
5© 2017 ThousandEyes Inc. All Rights Reserved.
•  Inter-Network – Used for routing
between networks (Autonomous
Systems), or within large networks
•  Reachability – BGP defines how one AS
can reach another, described as a path
vector (AS Path)
•  Policy-Based – BGP makes it possible
for an AS to apply policies (e.g. multi-
homing, failover, commercial terms)
•  Decentralized – Each AS makes policy
decisions autonomously, using BGP to
coordinate and share routes
Key BGP Concepts
6© 2017 ThousandEyes Inc. All Rights Reserved.
•  Neighboring
routers, within or
between ASes,
establish a TCP
connection on
port 179.
•  BGP messages
include:
–  Open
–  Update
–  Notification
–  Keep Alive
BGP the Protocol
AS 100
1.1.1.0/24
AS 300
3.3.3.4/22
AS 400
4.4.0.0/16
AS 200
2.2.2.0/24
Border Router
Origin
Autonomous
System
Internal
Router
BGP peers exchange
routes, within and
among ASes
7© 2017 ThousandEyes Inc. All Rights Reserved.
•  An update message may advertise
routes, withdraw routes, or both
•  Any number of routes may be
withdrawn
•  Any number of routes may be
advertised
–  They must all share the same attributes
–  These attributes include AS Path and
Origin
•  Therefore, you’ll expect at least one
Update message for each Origin AS
BGP Update Message
BGP Header
Withdrawn Routes
(n Prefix/Length tuples)
Path Attributes
7 well-known attributes:
Origin, AS Path, Next Hop, MED,
Local Pref, Atomic Aggregate, Aggregate
Optional attributes:
Community, Originator
Network Layer Reachability Info
(n Prefix/Length tuples)
8© 2017 ThousandEyes Inc. All Rights Reserved.
AS 300
3.3.3.4/22
•  Describes available
routes using a path
vector
•  Each AS will
prepend itself onto
the AS Path
•  Associated with an
origin AS and prefix
•  Avoids routing loops
by rejecting any AS
Path containing the
local AS
AS Path
AS 100
1.1.1.0/24
AS 400
4.4.0.0/16
AS 200
2.2.2.0/24
Origin
Autonomous
System
300 100
100100
200 100
9© 2017 ThousandEyes Inc. All Rights Reserved.
The Update Process
Loc-RIB
Routes with policies
applied
Adj-RIB-In
Unprocessed routes
Adj-RIB-Out
Routes to advertiseNewly
learned
routes
Newly
advertised
routes
FIB
Routes with next-hop
and interfaces
IP Routing Table
Routes aggregated
across protocols
Next-hops resolved
Interfaces calculated
Locally learned
routes added
1.  Preference calculated (PIB)
2.  Route selection
•  Ensure resolvability
•  Break ties
3.  Route
dissemination
•  Aggregation
Incorporated with IS-IS, OSPF,
etc. by Administrative Distance
10© 2017 ThousandEyes Inc. All Rights Reserved.
The routing application builds a Routing Information Base (RIB) to map
learned prefixes and routes
Example of the routing table for AS100 (show ip bgp)
* = valid; > = best
Routing Tables (RIBs)
Network
 Next Hop
 Metric (MED)
 Local Pref
 Weight
 Path
*> 1.1.1.0/24 10.1.12.2
 0
 0
 i
*>
 2.2.2.0/24
 10.1.14.4
 0
 0
 200 i
*>
 2.2.3.0/24
 10.1.14.4
 0
 0
 200 i
*>
 3.3.3.4/22 10.1.16.6
 0
 0
 300 i
*>
 4.4.0.0/16
 10.1.16.6
 0
 32768
 300 400 i
*
 4.4.0.0/16
 10.1.14.4
 0
 0
 200 400 i
11© 2017 ThousandEyes Inc. All Rights Reserved.
•  Highest weight (de facto standard)
–  Set by the local router
•  Highest local preference
–  Set by the local AS, typically based on commercial relationships
•  Shortest AS Path
–  The route that traverses the fewest ASes
•  Origin type
–  Internal-learned (IGP) routes preferred
•  Multi-Exit Discriminator (MED)
–  A preference set by the origin AS
•  Additional tiebreaking and multipath criteria…
Route Selection
12© 2017 ThousandEyes Inc. All Rights Reserved.
•  Match the most specific prefix
–  If none available, then the prefix is not reachable
•  Forward traffic to the correct interface
–  Based on information placed in the FIB, learned from BGP (and
other protocols)
•  Thus, a forwarding decision is influenced by:
–  Specificity of IP prefix
–  Internal routes
–  BGP routes, their attributes and the local routing policy
Making Forwarding Decisions
13© 2017 ThousandEyes Inc. All Rights Reserved.
•  Generally, BGP speakers within an AS must communicate with one
another in a full mesh, each updating one another
•  But this can be hard to scale in large ASes
•  Alternatives to full meshes exist, including:
Coordinating Within an AS
Route reflection (hub-spoke) Confederations (AS subdomains)
14© 2017 ThousandEyes Inc. All Rights Reserved.
•  Communities
–  Communicate to neighbors how to
advertise routes they learn from you,
and vice versa
–  ISPs publish community definitions on how advertisements will be handled
–  Often used for local preference, no-export, prepending, geographic or peering
limitations
•  MED (Multi-Exit Discriminator)
–  Communicate preferred inbound paths to a neighbor
•  Prepending
–  Inserting the local AS to the AS Path multiple times to lengthen the path and
reduce its preference by others
Coordinating Between ASes
15© 2017 ThousandEyes Inc. All Rights Reserved.© 2017 ThousandEyes Inc. All Rights Reserved.
Demo
16© 2017 ThousandEyes Inc. All Rights Reserved.
BGP Route Visualization Shows Preferred Routes
WV Fiber
Switch
Level 3
17© 2017 ThousandEyes Inc. All Rights Reserved.
Routes Are Reflected in Traffic Paths
WV Fiber
Switch
Level 3
18© 2017 ThousandEyes Inc. All Rights Reserved.© 2017 ThousandEyes Inc. All Rights Reserved.
Watch the webinar:


www.thousandeyes.com/webinars/how-bgp-works

How BGP Works

  • 1.
    1© 2017 ThousandEyesInc. All Rights Reserved. How BGP Works Young Xu, Product Marketing Manager
  • 2.
    2© 2017 ThousandEyesInc. All Rights Reserved. About ThousandEyes Network Intelligence platform that gives you a complete picture from users to internal and cloud-based applications Routing! User App End-to-End Performance Data App Performance! User Experience! Network Topology! Routing Topology! Enterprise, Endpoint and Cloud Agents Network Connectivity! And Route Monitors! Surface insights from a global data set Lightweight, flexible data collection Unified view of diverse performance data Solve issues across shared infrastructure See any network like it’s your own
  • 3.
    3© 2017 ThousandEyesInc. All Rights Reserved. Border Gateway Protocol BGP-4 RFC4271 Where do I forward traffic to reach an IP address in an external network? How can I control the route and composition of inbound traffic to my network?
  • 4.
    4© 2017 ThousandEyesInc. All Rights Reserved. •  Autonomous System –  Collection of IP prefixes –  Common routing policy to other ASes –  Registered by an RIR (regional Internet registry) –  Denoted by a name and number •  A Private AS can be used when a single upstream exists –  External routing policy is identical IP Blocks and Autonomous Systems AS 200 2.2.2.0/24 2.2.3.0/24 Autonomous System
  • 5.
    5© 2017 ThousandEyesInc. All Rights Reserved. •  Inter-Network – Used for routing between networks (Autonomous Systems), or within large networks •  Reachability – BGP defines how one AS can reach another, described as a path vector (AS Path) •  Policy-Based – BGP makes it possible for an AS to apply policies (e.g. multi- homing, failover, commercial terms) •  Decentralized – Each AS makes policy decisions autonomously, using BGP to coordinate and share routes Key BGP Concepts
  • 6.
    6© 2017 ThousandEyesInc. All Rights Reserved. •  Neighboring routers, within or between ASes, establish a TCP connection on port 179. •  BGP messages include: –  Open –  Update –  Notification –  Keep Alive BGP the Protocol AS 100 1.1.1.0/24 AS 300 3.3.3.4/22 AS 400 4.4.0.0/16 AS 200 2.2.2.0/24 Border Router Origin Autonomous System Internal Router BGP peers exchange routes, within and among ASes
  • 7.
    7© 2017 ThousandEyesInc. All Rights Reserved. •  An update message may advertise routes, withdraw routes, or both •  Any number of routes may be withdrawn •  Any number of routes may be advertised –  They must all share the same attributes –  These attributes include AS Path and Origin •  Therefore, you’ll expect at least one Update message for each Origin AS BGP Update Message BGP Header Withdrawn Routes (n Prefix/Length tuples) Path Attributes 7 well-known attributes: Origin, AS Path, Next Hop, MED, Local Pref, Atomic Aggregate, Aggregate Optional attributes: Community, Originator Network Layer Reachability Info (n Prefix/Length tuples)
  • 8.
    8© 2017 ThousandEyesInc. All Rights Reserved. AS 300 3.3.3.4/22 •  Describes available routes using a path vector •  Each AS will prepend itself onto the AS Path •  Associated with an origin AS and prefix •  Avoids routing loops by rejecting any AS Path containing the local AS AS Path AS 100 1.1.1.0/24 AS 400 4.4.0.0/16 AS 200 2.2.2.0/24 Origin Autonomous System 300 100 100100 200 100
  • 9.
    9© 2017 ThousandEyesInc. All Rights Reserved. The Update Process Loc-RIB Routes with policies applied Adj-RIB-In Unprocessed routes Adj-RIB-Out Routes to advertiseNewly learned routes Newly advertised routes FIB Routes with next-hop and interfaces IP Routing Table Routes aggregated across protocols Next-hops resolved Interfaces calculated Locally learned routes added 1.  Preference calculated (PIB) 2.  Route selection •  Ensure resolvability •  Break ties 3.  Route dissemination •  Aggregation Incorporated with IS-IS, OSPF, etc. by Administrative Distance
  • 10.
    10© 2017 ThousandEyesInc. All Rights Reserved. The routing application builds a Routing Information Base (RIB) to map learned prefixes and routes Example of the routing table for AS100 (show ip bgp) * = valid; > = best Routing Tables (RIBs) Network Next Hop Metric (MED) Local Pref Weight Path *> 1.1.1.0/24 10.1.12.2 0 0 i *> 2.2.2.0/24 10.1.14.4 0 0 200 i *> 2.2.3.0/24 10.1.14.4 0 0 200 i *> 3.3.3.4/22 10.1.16.6 0 0 300 i *> 4.4.0.0/16 10.1.16.6 0 32768 300 400 i * 4.4.0.0/16 10.1.14.4 0 0 200 400 i
  • 11.
    11© 2017 ThousandEyesInc. All Rights Reserved. •  Highest weight (de facto standard) –  Set by the local router •  Highest local preference –  Set by the local AS, typically based on commercial relationships •  Shortest AS Path –  The route that traverses the fewest ASes •  Origin type –  Internal-learned (IGP) routes preferred •  Multi-Exit Discriminator (MED) –  A preference set by the origin AS •  Additional tiebreaking and multipath criteria… Route Selection
  • 12.
    12© 2017 ThousandEyesInc. All Rights Reserved. •  Match the most specific prefix –  If none available, then the prefix is not reachable •  Forward traffic to the correct interface –  Based on information placed in the FIB, learned from BGP (and other protocols) •  Thus, a forwarding decision is influenced by: –  Specificity of IP prefix –  Internal routes –  BGP routes, their attributes and the local routing policy Making Forwarding Decisions
  • 13.
    13© 2017 ThousandEyesInc. All Rights Reserved. •  Generally, BGP speakers within an AS must communicate with one another in a full mesh, each updating one another •  But this can be hard to scale in large ASes •  Alternatives to full meshes exist, including: Coordinating Within an AS Route reflection (hub-spoke) Confederations (AS subdomains)
  • 14.
    14© 2017 ThousandEyesInc. All Rights Reserved. •  Communities –  Communicate to neighbors how to advertise routes they learn from you, and vice versa –  ISPs publish community definitions on how advertisements will be handled –  Often used for local preference, no-export, prepending, geographic or peering limitations •  MED (Multi-Exit Discriminator) –  Communicate preferred inbound paths to a neighbor •  Prepending –  Inserting the local AS to the AS Path multiple times to lengthen the path and reduce its preference by others Coordinating Between ASes
  • 15.
    15© 2017 ThousandEyesInc. All Rights Reserved.© 2017 ThousandEyes Inc. All Rights Reserved. Demo
  • 16.
    16© 2017 ThousandEyesInc. All Rights Reserved. BGP Route Visualization Shows Preferred Routes WV Fiber Switch Level 3
  • 17.
    17© 2017 ThousandEyesInc. All Rights Reserved. Routes Are Reflected in Traffic Paths WV Fiber Switch Level 3
  • 18.
    18© 2017 ThousandEyesInc. All Rights Reserved.© 2017 ThousandEyes Inc. All Rights Reserved. Watch the webinar:
 www.thousandeyes.com/webinars/how-bgp-works