BGP Overview1
BGP Overview1
Page 1 of 10
BGP Overview
The Border Gateway Protocol (BGP) is an exterior gateway protocol (EGP) used primarily to establish point-to-point connections and transmit data between peer ASs. Unlike the IGPs RIP, OSPF and IS-IS, BGP must explicitly advertise the routes between its peers. The route advertisements determine prefix reachability and the way packets are routed between BGP neighbors. Because BGP uses the packet path to determine route selection, it is considered a pathvector protocol. This overview contains the following topics: Point-to-Point Connections BGP Messages for Session Establishment BGP Messages for Session Maintenance IBGP and EBGP Route Selection Local Preference AS Path Origin Multiple Exit Discriminator Scaling BGP for Large Networks
Point-to-Point Connections
To establish point-to-point connections between peer ASs, you configure a BGP session on each interface of a point-to-point link. Figure 59 shows an example of a BGP peering session. Figure 59: BGP Peering Session
In Figure 59, Router A is a gateway router for AS 3, and Router B is a gateway router for AS 10. For traffic internal to either AS, an IGP (OSPF, for instance) is used. To route traffic between peer ASs, a BGP session is used.
http://www.juniper.net/techpubs/software/junos-security/junos-security95/junos-security... 2/9/2012
Page 2 of 10
After it detects a start event, the BGP host sends TCP request packets to its configured BGP neighbors. These packets are directed only to neighboring interfaces that have been explicitly configured as BGP neighbors. Upon receipt of the TCP request packet, the neighboring host generates a TCP response to complete the three-way handshake and establish a TCP connection between the peers. While this handshake is taking place, the BGP state for the connection is Connect. If a TCP timeout occurs while the originating host is waiting for a TCP response packet, the BGP state for the connection is Active. The Active state indicates that the router is actively listening for a TCP response and the TCP retry timer has been initiated. Once a TCP connection has been established between both ends of a BGP session, the BGP session state is OpenSent, indicating that the originating router has generated an open message. The open message is an initial BGP handshake that must occur before any route advertisement can take place. Upon receipt of the open message, the neighboring router generates a keepalive message. Receipt of the keepalive message establishes a point-to-point connection, and the BGP session state transitions to Established. While the originating host waits for the keepalive response packet, the BGP session state is OpenConfirm.
http://www.juniper.net/techpubs/software/junos-security/junos-security95/junos-security... 2/9/2012
Page 3 of 10
network be modified to account for the new addition. To combat these scaling problems, BGP uses route reflection and BGP confederations. For information about route reflection, see Scaling BGP for Large Networks. For information about routing confederations, see Scaling BGP for Large Networks.
Route Selection
The BGP route selection process compares BGP attributes to select a single best path or active route for each prefix in the routing table. The attributes are compared in a particular order. A local BGP router uses the following criteria, in the order presented, to select a route from the routing table for the forwarding table: 1. Next-hop accessibilityIf the next hop is inaccessible, the local router does not consider the route. The router must verify that it has a route to the BGP next-hop address. If a local route to the next hop does not exist, the local route does not include the router in its forwarding table. If such a route exists, route selection continues. 2. Highest local preferenceThe local router selects the route with the highest local preference value. If multiple routes have the same preference, route selection continues. (For more information, see Local Preference.) 3. Shortest AS pathThe local router selects the route with the fewest entries in the AS path. If multiple routes have the same AS path length, route selection continues. (For more information, see AS Path.) 4. Lowest originThe local router selects the route with the lowest origin value. If multiple routes have the same origin value, route selection continues. (For more information, see Origin.) 5. Lowest MED valueThe local router selects the route with the lowest multiple exit discriminator (MED) value, comparing the routes from the same AS only. If multiple routes have the same MED value, route selection continues. For more information, see Multiple Exit Discriminator. 6. Strictly external pathsThe local router prefers strictly external (EBGP) paths over external paths learned through interior sessions (IBGP). If multiple routes have the same strictly external paths, route selection continues. 7. Lowest IGP route metric The local router selects the path for which the next hop is resolved through the IGP route with the lowest metric. If multiple routes have the same IGP route metric, route selection continues. 8. Maximum IGP next hopsThe local router selects the path for which the BGP next hop is resolved through the IGP route with the largest number of next hops. If multiple routes have the same number of next hops, route selection continues. 9. Shortest route reflection cluster listThe local router selects the path with the shortest route reflection cluster list. Routes without a cluster list are considered to have a cluster list of length 0. If multiple routes have the same route reflection cluster list, route selection continues. 10. Lowest router IDThe local router selects the route with the lowest IP address value for the BGP router ID. By default, the router IDs of routes received from different ASs are not compared. You can change this default behavior. For more information, see the JUNOS Routing Protocols Configuration Guide. 11. Lowest peer IP addressThe local router selects the path that was learned from the neighbor with the lowest peer IP address. You can change the default behavior of some attributes (such as MED and router ID) used in the route selection process. For more information, see the JUNOS Routing Protocols Configuration Guide.
http://www.juniper.net/techpubs/software/junos-security/junos-security95/junos-security... 2/9/2012