1.01k likes | 1.31k Vues
Border Gateway Protocol. Chapter 8. Learning Objectives. Explain when and where you would use BGP, and how you can avoid using BGP Describe how BGP operates Explain how BGP aggregates routes. BGP Background. An Exterior Gateway Protocol (EGP) Routes packets between Autonomous systems
E N D
Border Gateway Protocol Chapter 8
Learning Objectives • Explain when and where you would use BGP, and how you can avoid using BGP • Describe how BGP operates • Explain how BGP aggregates routes
BGP Background • An Exterior Gateway Protocol (EGP) • Routes packets between Autonomous systems • Based on distance-vector routing protocols • Does not require hierarchical design • Current version BGP-4 contains enhancements, is more stable, and uses less bandwidth and CPU time
IBGP and EGBP • May be used both inside and outside Autonomous System • Used inside, it is called Internal BGP (IBGP) • Exchanges information about external Autonomous Systems • Can exchange routing information between different portions of very large Autonomous System • Used outside, it is called External BGP (EBGP)
Routing Between Autonomous Systems • Autonomous System is cohesive unit with clear definition of routes it contains • EGP will be unable to route packets to all sections in Autonomous System if it is not contiguous • BGP uses Autonomous System numbers to avoid routing loops • Internet Assigned Numbers Authority (IANA) ultimately responsible for allocating numbers • IANA delegated responsibility to number of regional organizations
Autonomous System Numbers • Autonomous System numbers are limited • AS Number field is 16 bits long • Maximum of 65,535 possible AS numbers • Some ranges of numbers have been set aside • From 64,512 to 65,535 • BGP called path vector routing protocol because it stores routes that AS passes through
Using BGP • BGP adds complexity to routing • Consider carefully before using BGP • Reasons to use BGP • Your AS is multihomed (has multiple connections to other Autonomous Systems) • Other Autonomous Systems use your AS as a transit AS • You need to control traffic entering and leaving your AS
Reasons to Avoid BGP • Your AS has a lone connection to the Internet or to another AS • Your routers do not have enough memory or a CPU to handle thousands of routes • You do not need to worry about routing policy or controlling traffic as it enters and leaves your AS • You do not have much bandwidth between Autonomous Systems • You do not understand BGP well
How to Avoid Using BGP • Use static or default routes and redistribute them • See Figure 8-1 • Customer uses default route propagated through its OSPF AS with the default-information originate always command • ISP uses static route to get to customer’s AS
Using Two Simultaneous Internet Connections • Two routers may connect to two different Internet Service Providers • See Figure 8-2 • Disadvantage is asymmetric routing • Packets take different routes to same destination • Some applications cannot handle packets arriving out of order • Makes troubleshooting more difficult
Avoiding Asymmetric Routing • Use one ISP as primary ISP and other as back-up ISP • Use floating static route • May not provide enough flexibility • Cannot do load balancing • Can use BGP to get around limitations
BGP Protocol Operation • BGP routers must communicate with each other • Establish neighbor relationships • Exchange routing information • When routers exchange information, they are called neighbors or peers
BGP Neighbor Relationships • BGP routers, also known as BGP speakers, use TCP port 179 to communicate • All communication between two BGP speakers will be reliable • Different types of messages used to exchange BGP peer routing information
BGP Messages • Each BGP message has header • 16-byte Marker field used to authenticate messages from other routers • 2-byte Length field indicates length of entire message, from 19 bytes to maximum of 4096 bytes • 1-byte Type field indicates message type • See Figure 8-3
Four Types of BGP Messages • Open messages used to initiate neighbor relationships and negotiate BGP parameters • Notification messages used to reset peer relationships between two routers • Update message used to send information about a single route • Keepalive messages used to indicate that router accepted an open message and to make sure neighbors are still responding; similar to a hello packet
Establishing Neighbor Relationships • BGP router opens TCP connection and sends open message to find potential BGP peer • IBGP Peers can be anywhere within the AS • EBGP are typically adjacent to each other • If not adjacent, they require additional configuration • See Figure 8-4
Fields in Open Message • Version - 1-byte field identifying version of BGP • My AS number - 2-byte field containing AS number of sending router • Hold time - maximum time in seconds that router waits between keepalive or update packets • BGP Identifier - 4-byte field identifying BGP router • Optional parameter length field - 1-byte field containing length of optional parameters field or set to 0 indicates no optional parameters • Optional parameters - only current one is authentication; more may be added in future
States During Neighbor Negotiation • BGP routers pass through several states during process of becoming neighbors • Idle - BGP router refuses all incoming until a Start event is initiated • Connect - Waits for TCP connection to complete • Active - Attempts to initiate connection with peer • OpenSent - Has sent message; waits for reply • OpenConfirm - Waits for keepalive or notification message from neighbor • Established - Has completed negotiations with its peer
BGP Neighbors • If router jumps between Connect and Active states, it usually means two routers have a communication problem • BGP does not allow for dynamic discovery of neighbors • Must manually configure them • Prevents unwanted routers from injecting routes into BGP routing tables • Makes Internet more stable
Notification Messages • If BGP router encounters error while establishing peer relationships, it may send a notification message • Router closes TCP connection to peer • Notification message is 1-byte Error Code field and variable-length Data field • See Figure 8-5 for format of notification message • See Table 8-1 for BGP error codes
BGP Error Codes continued
Exchanging Routing Information • BGP peers exchange full routing tables only when they first become peers • Afterwards, they send incremental routing updates
Update Messages • May contain information about single route or withdrawn route(s) that are no longer reachable • May contain Network Layer Reachability Information (NLRI) • 1-byte field shows length of prefix followed by prefix with trailing bits to end on octet boundary • See Figure 8-6 • May contain path attributes • Various information about a route such as NEXT_HOP
Update and Withdrawal Messages • Withdrawal Routes Message has 1-byte Length field followed by route prefix • Length field must also include length field of path attributes • If Length field of path attributes is set to 0, it indicates no path attributes • In theory, minimum size of update message packet is 23 bytes • 19 bytes for header • 2 bytes for each length field
Path Attributes • Path attributes determine which routes to include in routing tables and which routes to filter • Numerous path attributes • All BGP-4 routers agree on some path attributes • See Figure 8-7 for format of path attributes within an update message
Attribute Flags Field • Attribute Flags field indicate four possible classes of each attribute • Well-known mandatory attributes • Well-known discretionary attributes • Optional transitive attributes • Optional nontransitive attributes • See Table 8-2
Path Attributes • Three parts for each attribute • Attribute type—contains 1-byte attribute flag and 1-byte attribute type code • See Table 8-3 • Attribute length • Attribute value
BGP Table • BGP router tracks various protocol-specific parameters in BGP table • Includes information about attributes of each path • BGP table version increases by one each time the table changes • Provides some indication of stability of BGP sessions • May change frequently because of Internet changes
Types of Path Attributes • BGP routers make routing decisions and filter routes based on path attributes • Some common attributes include • ORIGIN Attribute • AS_PATH Attribute • NEXT_HOP Attribute • MED Attribute • Weight Attribute
ORIGIN Attribute • Mandatory attribute that indicates source of particular route • Three possible values • EGP - route learned from another AS through Exterior Gateway Protocol; indicated with “e” • IGP - route learned from same AS through Interior Gateway Protocol; indicated with “I” • Incomplete - route’s source is unknown or learned through another means; indicated with “?”
AS_PATH Attribute • Indicates path a particular route took to reach router • Shows whether route is loop free • Each AS prepends or places its own AS number at beginning of route’s AS_PATH attribute • If router sees its own AS number in AS_PATH attribute, route is a loop and will be rejected • Also contains information about summarized routes • See Figure 8-8
NEXT_HOP Attribute • In EBGP, indicates next hop router • Several factors affect this attribute • EBGP routers consider next hop peer that sent update about route • IBGR routers must keep NEXT_HOP attribute for routes learned from EBGP, even when advertising them to IBGR peers • See Figure 8-9
Third-party Next Hop • Third-party next hop specifies the destination router on multiaccess network to avoid extra hop • See Figure 8-10
MED Attribute • MULTI_EXIT_DISC attribute helps routers distinguish between multiple connections to same external AS • Optional nontransitive attribute; also called the BGP metric • Propagated to neighboring Autonomous Systems but not beyond • Used by routers outside AS to decide how to enter AS • Controls how traffic leaves AS • Must be configured manually • See Figure 8-11
Other Attributes • LOCAL_PREF – discretionary attribute used by routers inside an AS to choose an exit path • ATOMIC_AGGREGATE – discretionary attribute used in BGP’s handling of CIDR address blocks • AGGREGATOR – optional transitive attribute router may add to summarized routes
COMMUNITY Attribute • COMMUNITY Attribute – gives BGP routers a mechanism to filter routes by tagging a group of routes into a BGP community • Optional transitive attribute defined in RFC 1997 • Consists of one or more community values consisting of 32-bit fields • Values may be well known or private