41
Interdomain Routing and The Interdomain Routing and The Border Gateway Protocol (BGP) Border Gateway Protocol (BGP) Courtesy of Timothy G. Griffin Intel Research, Cambridge UK [email protected]

BGP Tutorial Simplified

Embed Size (px)

Citation preview

Page 1: BGP Tutorial Simplified

Interdomain Routing and The Interdomain Routing and The Border Gateway Protocol Border Gateway Protocol

(BGP)(BGP)

Courtesy of Timothy G. Griffin

Intel Research, Cambridge UK

[email protected]

Page 2: BGP Tutorial Simplified

How do you connect to the Internet?

Physical connectivity isjust the beginning of thestory….

Page 3: BGP Tutorial Simplified

Partial View of www.cl.cam.ac.uk (128.232.0.20) Neighborhood

AS 786 ja.net(UKERNA)

AS 1239 Sprint

AS 4373 Online Computer Library Center

Originates > 180 prefixes, Including 128.232.0.0/16

AS 3356Level 3

AS 6461AboveNet

AS 1213 HEAnet(Irish academic and research)

AS 7 UK Defense Research Agency

AS 5459 LINX

AS 702 UUNET

AS 20965 GEANT

Page 4: BGP Tutorial Simplified

Architecture of Dynamic Routing

AS 1

AS 2

EGP (= BGP)

EGP = Exterior Gateway Protocol

IGP = Interior Gateway Protocol

Metric based: OSPF, IS-IS, RIP, EIGRP (cisco)

Policy based: BGP

The Routing Domain of BGP is the entire Internet

IGP

IGP

Page 5: BGP Tutorial Simplified

• Topology information is flooded within the routing domain

• Best end-to-end paths are computed locally at each router.

• Best end-to-end paths determine next-hops.

• Based on minimizing some notion of distance

• Works only if policy is shared and uniform

• Examples: OSPF, IS-IS

• Each router knows little about network topology

• Only best next-hops are chosen by each router for each destination network.

• Best end-to-end paths result from composition of all next-hop choices

• Does not require any notion of distance

• Does not require uniform policies at all routers

• Examples: RIP, BGP

Link State Vectoring

Technology of Distributed Routing

Page 6: BGP Tutorial Simplified

The Gang of Four

Link State Vectoring

EGP

IGP

BGP

RIPIS-IS

OSPF

Page 7: BGP Tutorial Simplified

AS Numbers (ASNs)

ASNs are 16 bit values.64512 through 65535 are “private”

• Genuity: 1 • MIT: 3• JANET: 786• UC San Diego: 7377• AT&T: 7018, 6341, 5074, … • UUNET: 701, 702, 284, 12199, …• Sprint: 1239, 1240, 6211, 6242, …• …

ASNs represent units of routing policy

Page 8: BGP Tutorial Simplified

BGP Routing Tables

• Use “whois” queries to associate an ASN with “owner” (for example, http://www.arin.net/whois/arinwhois.html)

• 7018 = AT&T Worldnet, 701 =Uunet, 3561 = Cable & Wireless, …

show ip bgpBGP table version is 111849680, local router ID is 203.62.248.4Status codes: s suppressed, d damped, h history, * valid, > best, i - internalOrigin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path

. . .*>i192.35.25.0 134.159.0.1 50 0 16779 1 701 703 i*>i192.35.29.0 166.49.251.25 50 0 5727 7018 14541 i*>i192.35.35.0 134.159.0.1 50 0 16779 1 701 1744 i*>i192.35.37.0 134.159.0.1 50 0 16779 1 3561 i*>i192.35.39.0 134.159.0.3 50 0 16779 1 701 80 i*>i192.35.44.0 166.49.251.25 50 0 5727 7018 1785 i*>i192.35.48.0 203.62.248.34 55 0 16779 209 7843 225 225 225 225 225 i*>i192.35.49.0 203.62.248.34 55 0 16779 209 7843 225 225 225 225 225 i*>i192.35.50.0 203.62.248.34 55 0 16779 3549 714 714 714 i*>i192.35.51.0/25 203.62.248.34 55 0 16779 3549 14744 14744 14744 14744 14744 14744 14744 14744 i. . .

Thanks to Geoff Huston. http://www.telstra.net/ops on July 6, 2001

Page 9: BGP Tutorial Simplified

AS Graphs Can Be Fun

The subgraph showing all ASes that have more than 100 neighbors in fullgraph of 11,158 nodes. July 6, 2001. Point of view: AT&T route-server

Page 10: BGP Tutorial Simplified

AS Graphs Do Not Show “Topology”!

The AS graphmay look like this. Reality may be closer to this…

BGP was designed to throw away information!

Page 11: BGP Tutorial Simplified

How Many ASNs are there today?

Thanks to Geoff Huston. http://bgp.potaroo.net on October 24, 2003

15,981

Page 12: BGP Tutorial Simplified

How Many ASNs are there today?

Thanks to Geoff Huston. http://bgp.potaroo.net on October 26, 2004

18,217

Page 13: BGP Tutorial Simplified

How many prefixes today?

Thanks to Geoff Huston. http://bgp.potaroo.net on October 24, 2003

154,894

Note: numbersactually dependspoint of view…

Page 14: BGP Tutorial Simplified

How many prefixes today?

Thanks to Geoff Huston. http://bgp.potaroo.net on October 26, 2004

179,903

Note: numbersactually dependspoint of view…

Page 15: BGP Tutorial Simplified

15

BGP-4• BGP = Border Gateway Protocol

• Is a Policy-Based routing protocol

• Is the de facto EGP of today’s global Internet

• Relatively simple protocol, but configuration is complex and the

entire world can see, and be impacted by, your mistakes.

Page 16: BGP Tutorial Simplified

16

BGP Operations (Simplified)

Establish session on TCP port 179

Exchange all active routes

Exchange incremental updates

AS1

AS2

While connection is ALIVE exchangeroute UPDATE messages

BGP session

Page 17: BGP Tutorial Simplified

17

Four Types of BGP Messages

• Open : Establish a peering session.

• Keep Alive : Handshake at regular intervals.

• Notification : Shuts down a peering session.

• Update : Announcing new routes or withdrawing previously announced routes.

announcement = prefix + attributes values

Page 18: BGP Tutorial Simplified

Attributes are Used to Select Best Routes

192.0.2.0/24pick me!

192.0.2.0/24pick me!

192.0.2.0/24pick me!

192.0.2.0/24pick me!

Given multipleroutes to the sameprefix, a BGP speakermust pick at mostone best route

(Note: it could reject them all!)

Page 19: BGP Tutorial Simplified

19

ASPATH Attribute

AS7018135.207.0.0/16AS Path = 6341

AS 1239Sprint

AS 1755Ebone

AT&T

AS 3549Global Crossing

135.207.0.0/16AS Path = 7018 6341

135.207.0.0/16AS Path = 3549 7018 6341

AS 6341

135.207.0.0/16

AT&T Research

Prefix Originated

AS 12654RIPE NCCRIS project

AS 1129Global Access

135.207.0.0/16AS Path = 7018 6341

135.207.0.0/16AS Path = 1239 7018 6341

135.207.0.0/16AS Path = 1755 1239 7018 6341

135.207.0.0/16AS Path = 1129 1755 1239 7018 6341

Page 20: BGP Tutorial Simplified

20

Policy-Based vs. Distance-Based Routing?

ISP1

ISP2

ISP3

Cust1

Cust2Cust3

Host 1

Host 2

Minimizing “hop count” can violate commercial relationships thatconstrain inter-domain routing.

YES

NO

Page 21: BGP Tutorial Simplified

21

Why not minimize “AS hop count”?

Regional ISP1

Regional ISP2

Regional ISP3

Cust1Cust3 Cust2

National ISP1

National ISP2

YES

NO

Shortest path routing is not compatible with commercial relations

Page 22: BGP Tutorial Simplified

Customers and Providers

Customer pays provider for access to the Internet

provider

customer

IP trafficprovider customer

Page 23: BGP Tutorial Simplified

The “Peering” Relationship

peer peer

customerprovider

Peers provide transit between their respective customers

Peers do not provide transit between peers

Peers (often) do not exchange $$$trafficallowed

traffic NOTallowed

Page 24: BGP Tutorial Simplified

Peering Provides Shortcuts

Peering also allows connectivity betweenthe customers of “Tier 1” providers.

peer peer

customerprovider

Page 25: BGP Tutorial Simplified

Peering Wars

• Reduces upstream transit costs

• Can increase end-to-end performance

• May be the only way to connect your customers to some part of the Internet (“Tier 1”)

• You would rather have customers

• Peers are usually your competition

• Peering relationships may require periodic renegotiation

Peering struggles are by far the most contentious issues in the ISP world!

Peering agreements are often confidential.

Peer Don’t Peer

Page 26: BGP Tutorial Simplified

Implementing Customer/Provider and Peer/Peer relationships

• Enforce transit relationships – Outbound route filtering

• Enforce order of route preference– provider < peer < customer

Two parts:

Page 27: BGP Tutorial Simplified

Import Routes

Frompeer

Frompeer

Fromprovider

Fromprovider

From customer

From customer

provider route customer routepeer route ISP route

Page 28: BGP Tutorial Simplified

Export Routes

Topeer

Topeer

Tocustomer

Tocustomer

Toprovider

From provider

provider route customer routepeer route ISP route

filtersblock

Page 29: BGP Tutorial Simplified

The Border Gateway Protocol (BGP)

BGP = RFC 1771

+ “optional” extensionsRFC 1997 (communities) RFC 2439 (damping) RFC 2796 (reflection) RFC3065 (confederation) …

+ routing policy configurationlanguages (vendor-specific)

+ Current Best Practices in management of Interdomain Routing

BGP was not DESIGNED. It EVOLVED.

Page 30: BGP Tutorial Simplified

30

BGP Route Processing

Best Route Selection

Apply Import Policies

Best Route Table

Apply Export Policies

Install forwardingEntries for bestRoutes.

ReceiveBGPUpdates

BestRoutes

TransmitBGP Updates

Apply Policy =filter routes & tweak attributes

Based onAttributeValues

IP Forwarding Table

Apply Policy =filter routes & tweak attributes

Open ended programming.Constrained only by vendor configuration language

Page 31: BGP Tutorial Simplified

In fairness: could you do this “right” and still scale?

Exporting internalstate would dramatically increase global instability and amount of routingstate

Shorter Doesn’t Always Mean Shorter

AS 4

AS 3

AS 2

AS 1

Mr. BGP says that path 4 1 is better than path 3 2 1

Duh!

Page 32: BGP Tutorial Simplified

Routing Example 1

Page 33: BGP Tutorial Simplified

Routing Example 2

Page 34: BGP Tutorial Simplified

Tweak Tweak Tweak (TE)

• For inbound traffic– Filter outbound routes– Tweak attributes on

outbound routes in the hope of influencing your neighbor’s best route selection

• For outbound traffic– Filter inbound routes– Tweak attributes on

inbound routes to influence best route selection

outboundroutes

inboundroutes

inboundtraffic

outboundtraffic

In general, an AS has morecontrol over outbound traffic

Page 35: BGP Tutorial Simplified

35

Implementing Backup Links with Local Preference (Outbound Traffic)

Forces outbound traffic to take primary link, unless link is down.

AS 1

primary link backup link

Set Local Pref = 100for all routes from AS 1 AS 65000

Set Local Pref = 50for all routes from AS 1

Page 36: BGP Tutorial Simplified

36

Multihomed Backups (Outbound Traffic)

Forces outbound traffic to take primary link, unless link is down.

AS 1

primary link backup link

Set Local Pref = 100for all routes from AS 1

AS 2

Set Local Pref = 50for all routes from AS 3

AS 3provider provider

Page 37: BGP Tutorial Simplified

37

Shedding Inbound Traffic with ASPATH Prepending

Prepending will (usually) force inbound traffic from AS 1to take primary linkAS 1

192.0.2.0/24ASPATH = 2 2 2

customerAS 2

provider

192.0.2.0/24

backupprimary

192.0.2.0/24ASPATH = 2

Yes, this is a Glorious Hack …

Page 38: BGP Tutorial Simplified

38

… But Padding Does Not Always Work

AS 1

192.0.2.0/24ASPATH = 2 2 2 2 2 2 2 2 2 2 2 2 2 2

customerAS 2

provider

192.0.2.0/24

192.0.2.0/24ASPATH = 2

AS 3provider

AS 3 will sendtraffic on “backup”link because it prefers customer routes and localpreference is considered before ASPATH length!

Padding in this way is oftenused as a form of loadbalancing

backupprimary

Page 39: BGP Tutorial Simplified

39

COMMUNITY Attribute to the Rescue!

AS 1

customerAS 2

provider

192.0.2.0/24

192.0.2.0/24ASPATH = 2

AS 3provider

backupprimary

192.0.2.0/24ASPATH = 2 COMMUNITY = 3:70

Customer import policy at AS 3:If 3:90 in COMMUNITY then set local preference to 90If 3:80 in COMMUNITY then set local preference to 80If 3:70 in COMMUNITY then set local preference to 70

AS 3: normal customer local pref is 100,peer local pref is 90

Page 40: BGP Tutorial Simplified

What the heck is going on?

• There is no guarantee that a BGP configuration has a unique routing solution. – When multiple solutions exist, the (unpredictable) order

of updates will determine which one is wins.

• There is no guarantee that a BGP configuration has any solution!– And checking configurations NP-Complete [GW1999]

• Complex policies (weights, communities setting preferences, and so on) increase chances of routing anomalies.– … yet this is the current trend!

Page 41: BGP Tutorial Simplified

Larry Speaks

http://www.larrysface.com/

Is this any way to run an Internet?