Border Gateway Protocol (BGP) W.lilakiatsakun BGP Basics • BGP is the protocol which is used to make core routing decisions on the Internet • It involves a table of IP networks or "prefixes" which designate network reachability among autonomous systems (AS). • RFC 4271 • BGP version 4 is a De facto standard for exterior gateway protocol • Run over TCP port 179 BGP Operations • Learns multiple paths via internal and external BGP speakers • Picks the best path and installs in the forwarding table • Best path is sent to external BGP neighbors • Policies applied by influencing the best path selection eBGP & iBGP • BGP used internally (iBGP) and externally (eBGP) • iBGP used to carry some/all Internet prefixes across ISP backbone ISP’s customer prefixes • eBGP used to exchange prefixes with other Ases implement routing policy External BGP Peering (eBGP) • Between BGP speakers in different AS • Should be directly connected • Never run an IGP between eBGP peers Configuring eBGP Internal BGP (iBGP) • BGP peer within the same AS • Not required to be directly connected – IGP takes care of inter-BGP speaker connectivity • iBGP speakers need to be fully meshed – they originate connected networks – They do not pass on prefixes learned from other iBGP speakers Internal BGP peering Configuring iBGP BGP Attributes • • • • • • • Origin AS-Path Next Hop Multi_Exit_Disc Local Preference Atomic_aggregrate Aggregrator Origin • The ORIGIN attribute is generated by the speaker that originates the associated routing information AS_Path • This attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. AS_Path Loop Detection Next Hop • The NEXT_HOP defines the IP address of the router that SHOULD be used as the next hop to the destinations listed in the UPDATE message Next Hop -eBGP Next Hop -iBGP Multi_Exit_Disc (1) • The MULTI_EXIT_DISC is an optional nontransitive attribute that is intended to be used on external (inter-AS) links to discriminate among multiple exit or entry points to the same neighboring AS. • The value of the MULTI_EXIT_DISC attribute is a four-octet unsigned number, called a metric. • All other factors being equal, the exit point with the lower metric SHOULD be preferred. Multi_Exit_Disc (2) Multi_Exit_Disc (3) Local Preference (1) • LOCAL_PREF is an attribute that BGP speaker SHALL calculate the degree of preference for each external route based on the locallyconfigured policy, and include the degree of preference when advertising a route to its internal peers. • The higher degree of preference MUST be preferred. Local Preference (2) Local Preference (3) • Local to an AS – non-transitive – Default local preference is 100 (IOS) • Used to influence BGP path selection – determines best path for outbound traffic • Path with highest local preference wins Local Preference (4) Atomic_aggregrate • • • • Conveys the IP address of the router/BGP Speaker generating the aggregate route Useful for debugging purposes Does not influence best path selection Path Selection (1) • If the NEXT_HOP attribute of a BGP route depicts an address that is not resolvable, or if it would become unresolvable if the route was installed in the routing table, the BGP route MUST be excluded from the decision function. • If the AS_PATH attribute of a BGP route contains an AS loop, the BGP route should be excluded from the decision function. – AS loop detection is done by scanning the full AS path (as specified in the AS_PATH attribute), and checking that the autonomous system number of the local system does not appear in the AS path. Path Selection (2) • Criteria for path selection a) the highest degree of preference of any route to the same set of destinations, or b) is the only route to that destination, or c) is selected as a result of the Phase 2 tie breaking rules Algorithm for remove path (1) • a) Remove from consideration all routes that are not tied for having the smallest number of AS numbers present in their AS_PATH attributes. • b) Remove from consideration all routes that are not tied for having the lowest Origin number in their Origin attribute. Algorithm for remove path (2) • c) Remove from consideration routes with less-preferred MULTI_EXIT_DISC attributes. – MULTI_EXIT_DISC is only comparable between routes learned from the same neighboring AS (the neighboring AS is determined from the AS_PATH attribute). – Routes that do not have the MULTI_EXIT_DISC attribute are considered to have the lowest possible MULTI_EXIT_DISC value. Algorithm for remove path (3) • d) If at least one of the candidate routes was received via EBGP, remove from consideration all routes that were received via IBGP. • e) Remove from consideration any routes with less-preferred interior cost. – The interior cost of a route is determined by calculating the metric to the NEXT_HOP for the route using the Routing Table. Algorithm for remove path (4) • f) Remove from consideration all routes other than the route that was advertised by the BGP speaker with the lowest BGP Identifier value. • g) Prefer the route received from the lowest peer address.