1 border gateway protocol (bgp). 2 contents internet connectivity and bgp connectivity services,...

47
1 Border Gateway Protocol (BGP)

Upload: shavonne-todd

Post on 17-Dec-2015

317 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

1

Border Gateway Protocol(BGP)

Page 2: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

2

Contents Internet connectivity and BGP

connectivity services, AS relationships

BGP Basics BGP sessions, BGP messages, BGP attributes

BGP Policy Control: Examples Cisco filtering mechanisms

BGP Misconfiguration

Page 3: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

3

Autonomous System

Multiple RoutersSame Routing policySingle Routing ProtocolSingle Ownership

Page 4: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

4

ASs & AS Numbers (ASNs)

64512 through 65535 are “private”

• Genuity: 1 • MIT: 3• Harvard: 11• Yale: 29 • UCLA: 52• AT&T: 7018, 5075, …, 6341, … • UUNET: 701, 702, 284, 12199, …• Sprint: 1239, 1240, 6211, 6242, …• …

ASNs represent units of routing policy

Currently over 30,000 in use.

Page 5: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

5

U of Minnesota Neighborhood

AS 1Genuity

AS 57 UMN GigaPoP

AS 7018 AT&T

AS 3908SuperNet (Qwest)

AS 217 UMN

AS 1998 State of Minnesota

128.101.0.0/16

Page 6: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

6

Having Internet Connectivity• To have complete Internet connectivity

you must be able to reach all destinations on the net.

• Your packets have to get delivered to every destination. This is easy (default routes).

• Packets from everywhere else have to “find you”. This is done by having your ISP(s) advertise routes for you.

Page 7: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

7

Forwarding Process

IP Forwarding Table Router

1. Remove a packet from an input queue

3. Match packet’s destination to a table entry

2. Check for sanity, decrement TTL field

4. Place packet on correct output queue

If queuesget full, just

drop packets!

If queuesget full, just

drop packets!

IP Forwarding Process

Page 8: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

8

Dynamic Routing: Intra- vs. Inter-AS

AS 1

AS 2

BGP

EGP = Exterior Gateway Protocol

IGP = Interior Gateway Protocol

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

Policy based:BGP

OSPF

EIGRP

Page 9: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

9

• To allow networks (ASs) to tell other networks (ASs) about “routes” (parts of the IP address space) that they are “responsible” for and how to reach them– Using “route advertisements”, or “promises” - also called

“NLRI” or “network-layer reachability information”– “Path-vector” routing protocol

• Policy-based: allow ISPs to richly express their routing policy, both in selecting outbound paths and in announcing internal routes – keep this in mind as we progress!

• Relatively “simple” protocol, but configuration is complex and the entire world can see, and be impacted by, your mistakes

BGP: The Glue of Internet

Page 10: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

10

BGP: Some BasicsBGP: Some Basics• BGP exchanges routes between ASs.• When routes are exchanged, ASNs are

stamped on the routes “on the way out” – adding one “AS hop” per network traversed -> AS path

• Routes are exchanged over “peering sessions”, which run on top of TCP, port 179.– The routes are “objects”, or “bags” of “attributes”

• BGP is actually two protocols – iBGP, designed for “internal” route exchange– eBGP, designed for “external” route exchange

• 1995: BGP-4 [RFC 1771] ; 2006: BGP-4 [RFC 4271]

Page 11: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

11

BGP: Net Prefixes, ASNs and Route BGP: Net Prefixes, ASNs and Route AdvertisementsAdvertisements

AS 4969

AS 5000

AS 6461

AS 701

AS 12001BGP route advertisement: Net prefix: 207.8.128.0/17 AS path: 4969 6461

207.8.128.0/17

Page 12: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

12

BGP Route AdvertisementBGP Route Advertisement • Think of a BGP route as a “promise”

– If I advertise 207.8.128.0/17, I promise that if you deliver traffic destined to any IP address within 207.8.128.0/17 to me, I know how to deliver it (at least as well as anyone else)

• By making sure these routes, or “promises”, are heard by all ASes, your provider ensures a return path for all of your packets– Sending routes out causes IP traffic to come in

Page 13: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

13

BGP Route Advertisements and IP BGP Route Advertisements and IP Address SpaceAddress Space

• If my customer has 207.8.140.0/24, I generally will not announce that route separately, if it is covered by my 207.8.128.0/17, aggregate route.

• Recall that routers use “longest prefix matching” to look up forwarding table– If one of my customers’ ISPs is advertising

207.8.240.0/24, all incoming traffic from other networks will start flowing in that pipe.

– so I must “punch a hole” in my aggregate announcement and advertise 207.8.128.0/17 and 207.8.240.0/24

Page 14: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

14

Autonomous Routing Domains Don’t Always Need BGP or an ASN

Qwest

Yale University

Nail up default routes 0.0.0.0/0pointing to Qwest

Nail up routes 130.132.0.0/16pointing to Yale

130.132.0.0/16

Static routing is the most common way of connecting anautonomous routing domain to the Internet. This helps explain why BGP is a mystery to many …

Page 15: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

15

Number of Used ASNs

Source: Geoff Huston, http://bgp.potaroo.net

Page 16: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

16

Growth of BGP Routes

Source: Geoff Huston, http://bgp.potaroo.net, Nov. 3, 2002

Percentage of IPv4 space advertised

Page 17: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

17

BGP Operations (Simplified)BGP Operations (Simplified)

Establish session on TCP port 179

Exchange all

active routes

Exchange incremental updates

While connection is ALIVE exchangeroute UPDATE messages

AS1

AS2

BGP session

router A129.213.1.2

router B129.213.1.1

Page 18: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

18

BGP (Peering) SessionsBGP (Peering) Sessions • BGP session set up over TCP

– When session set up, both sides flood the other end with all of their best BGP routes

– Over time, only incremental updates are exchanged– If session dies, all associated routes must be withdrawn

• BGP peers (neighbors) must be specified explicitly

• BGP session set-up: Cisco ExampleRouter A in AS 1 router bgp 1 neighbor 129.213.1.1 remote-as 2Router B in AS 2 router bgp 1 neighbor 129.213.1.2 remote-as 1

AS1

AS2

BGP session

router A129.213.1.2

router B129.213.1.1

Page 19: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

19

EBGP vs. IBGP SessionsEBGP vs. IBGP Sessions • EBGP: between (usually directly-connected) routers in

different ASs• IBGP: between (BGP-speaking) routers in same AS• Different (operational) rules and polices apply!

AS 7007XP

AS 1239

AS 6079

AS 701

AS 4006

Page 20: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

20

iBGPiBGP

AS 3847

• IBGP speakers are (usually) fully meshed•IBGP session set up: Router A in AS 3847

router bgp 3847 neighbor 129.213.1.1 remote-as 3847 neighbor 128.28.10.2 remote-as 3847

Router B in AS 3847 router bgp 3847 neigbhor 129.213.1.2 remote-as 3847 neighbor 127.101.1.1 remote-as 3847

Router C in AS 3847 router bgp 3847 neigbhor 128.28.10.1 remote-as 3847 neigbhor 127.101.1.2 remote-as 3847

B

A

c

Page 21: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

21

BGP Messages: Four TypesBGP Messages: Four Types

• 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.

route announcement = prefix + attributes values

Page 22: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

22

Page 23: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

23

                                                    

        

Page 24: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

24

                                                    

        

Page 25: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

25

                                                    

        

Page 26: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

26

What Is an Attribute?What Is an Attribute?

• Attribute encoded in a TLV (type-length-value) format.

• Attribute length is 4 bytes long• Attributes can be transitive (across ASs) or non-

transitive (between AS neighbors only) • Some are mandatory: e.g., AS Path, Next-Hop, etc.

Next Next HopHop

AS AS PathPath

............MEDMED......

Page 27: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

27

BGP Attributes

Value Code Reference----- --------------------------------- --------- 1 ORIGIN [RFC1771] 2 AS_PATH [RFC1771] 3 NEXT_HOP [RFC1771] 4 MULTI_EXIT_DISC [RFC1771] 5 LOCAL_PREF [RFC1771] 6 ATOMIC_AGGREGATE [RFC1771] 7 AGGREGATOR [RFC1771] 8 COMMUNITY [RFC1997] 9 ORIGINATOR_ID [RFC2796] 10 CLUSTER_LIST [RFC2796] 11 DPA [Chen] 12 ADVERTISER [RFC1863] 13 RCID_PATH / CLUSTER_ID [RFC1863] 14 MP_REACH_NLRI [RFC2283] 15 MP_UNREACH_NLRI [RFC2283] 16 EXTENDED COMMUNITIES [Rosen] ... 255 reserved for development

From IANA: http://www.iana.org/assignments/bgp-parameters

Mostimportantattributes

Not all attributesneed to be present inevery announcement

Page 28: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

28

AS Path 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 = 1755 1239 7018 6341

135.207.0.0/16AS Path = 1129 1755 1239 7018 6341

Page 29: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

29

•Sequence of AS(s) a route has traversed.

•Provides a mechanism for loop detection.

•Policies may be applied based on AS path.•Local AS added only when send to external peer.* Shortest AS path preferred

AS Path Attribute

AS3847207.240.0.0/16 AS1673

140.222.0.0/16

AS701192.67.95.0/24

AS3561204.70.0.0/15

192.67.95.0/24 3847 701 i140.222.0.0 3847 1673 i204.70.0.0/15 3847 3561 i207.240.0.0/16 3847 i

AS6201

E

C

FG

D

B

A

Page 30: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

30

Next Hop AttributeNext Hop Attribute

• Next-hop IP address to reach a network.• Router A will advertise

198.3.97.0/24 to router B with a next-hop of 207.240.24.202.

• With IBGP, the next-hop does not change.

• IGPs should carry route to next-hops, using intelligent forwarding decision (i.e., via IGP).

AS 6201

AS 3847

198.3.97.0/24A

B

207.240.24.200/30

.201

A

B

.202

C

Page 31: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

31

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 32: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

32

Route Selection Summary

Highest Local Preference

Shortest ASPATH

Lowest MED

i-BGP < e-BGP

Lowest IGP cost to BGP egress

Lowest router ID

traffic engineering

Enforce relationships(provider-customer, peer)

Throw up hands andbreak ties

Page 33: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

33

Local Preference AttributeLocal Preference Attribute• Local to AS

– transitive throughout your network. It is never advertised to an eBGP peer.

• Used to influence BGP path selection

AS 6201

208.1.1.0/24

A B

208.1.1.0/24 100Preferred by all AS3847 routers

208.1.1.0/24 80

AS 3847

GF E

C D

• Default 100– Highest local-pref preferred

• For example, you can express the policy “prefer private connect” by making the “local_pref” be 150 and leaving all other peers at 100.

Page 34: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

34

eBGP vs. iBGP RevisitedeBGP vs. iBGP RevisitedeBGP Rules:eBGP Rules:• By default, only talks to directly-connected

router.• Sends the one best BGP route for each

destination.• Sends all of the important “attributes”; omits

the “local preference” attribute.• Adds (prepends) the speaker’s ASN to the “AS-

Path” attribute.• Usually rewrites the “next-hop” attribute.

Page 35: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

35

eBGP vs. iBGP Revisited (cont’d)eBGP vs. iBGP Revisited (cont’d)

iBGP Rules:iBGP Rules:• Can talk to routers many hops away by default.• Sends all attributes.• Leaves the “as-path” attribute alone.• Doesn’t touch the “next hop” attribute. • With iBGP, next-hop is not a router directly

connected.– So a “recursive lookup” is needed.– After the next-hop is found, a second lookup is made

to figure out how to send the packet “in the direction” of the next-hop.

Page 36: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

36

iBGP and Next-Hop: ExampleiBGP and Next-Hop: ExampleIn AS 2828: • Router A: “next hop” for 170.10.0.0/16 will be

the serial interface on Router D in AS1239 router• This is true even in Router B’s and Router C’s

forwarding table.

AS 1239

AS 2828

A

B

C

170.10.0.0/16170.10.0.0/16

D E

Page 37: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

37

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 38: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

38

BGP Router - Processing RoutesBGP Router - Processing Routes

• For each route received:– If it’s a valid route AND passes any filters, it must be

put into the BGP routing table.– Then, unless it is replacing a duplicate, a best-path

computation must be run on all candidate BGP routes of the same prefix.

– Then, if the best route changed, the RIB and/or FIB must be updated.

– This process is done for ALL incoming BGP routes.

Page 39: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

39

BGP Policy ControlBGP Policy Control

• To decide what routes can and can’t go to various other routers, you can “filter” using:– “distribute lists” (“prefix filters”) - lists of routes– “filter lists” (“as-path filters”) - lists of regular

expressions matching or denying ASs– “route maps” (“BGP Basic programs”) that allow you

to match and change most BGP attributes

Page 40: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

40

Applying AS Path FilteringApplying AS Path Filtering

3847

6201

D

A

C

BE

701

F

6202

G

The following configuration could be used on router B to accept routes from AS6201 & 6202 and deny all others.

ip as-path access-list 10 permit ^6201$ip as-path access-list 10 permit ^6201_6202$ip as-path access-list 10 deny .*

Page 41: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

41

Misconfiguration of BGP

• The configuration errors of the routers that result in the unintended production or suppression of BGP routing announcements.

• Includes slips ( inadvertent errors) and mistakes (design errors) in human factors terminology.

• Emphasis on human operator error.20-70% of system failures

Page 42: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

42

Our Goal • How frequently do these

misconfigurations occur? • What is their impact on global

connectivity and routing load?• Why do the misconfigurations occur?• What can be done to reduce their

frequency and impact?

Page 43: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

43

Configuration Example

Router bgp 200Network 192.0.2.0Neighbor 1.1.1.1 remoter-as 100Neighbor 4.4.4.4 remoter-as 400Neighbor 4.4.4.4 route-map RMAP out!Route-map RMAP permit 10Match ip-address 1!Access-list 1 deny 192.0.2.0 0.0.0.255

Page 44: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

44

How frequently do these misconfigurations occur?

• 200-1200 prfixes, equivalent to 0.2-1% of the global table size, suffer from misconfiguration each day.

• Close to ¾ of the new route announcements per day are the result of misconifguration.

Page 45: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

45

The impact

• Increase routing load by generating unnecessary BGP updates.

• Can disrupt connectivity, either partially or globally.

• Violate the intended policy of the AS.

Page 46: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

46

Causes of Misconfiguration• Origin Misconfiguration(unintentional

insertion)Initialization bug, old config, redistribution, community, hijack, forgotten filter, incorrect summary, unknown config error, miscellaneous, unclassified

• Export Misconfiguration(an inadvertent export in violation of the exporter’s policy)prefix based config, old config, initialization bug, bad ACL or rout map, typo, forgotten filter, community, unknown config error, miscellaneous, unclassified

Page 47: 1 Border Gateway Protocol (BGP). 2 Contents  Internet connectivity and BGP  connectivity services, AS relationships  BGP Basics  BGP sessions, BGP

47

Resolution

• User Interface Design instead of CLI(comand line interfaces)safe defaults, the more serious the consequences of the error, consistency across versions, large edit distances btween correct and incorrect settings.

• High-level Languages and Checkingonnectivity, either partially or globally.

• Database Consistency and Registries.• Protocol Extensions.

S-BGP (Secure BGP )