About BGP
BGP is an inter and intra autonomous system routing protocol. An autonomous system is a network or group of networks under a common administration and with common routing policies. BGP is used to exchange routing information for the Internet and is the protocol used between Internet service providers (ISP).
When to Use BGP
Customer networks, such as universities and corporations, usually employ an Interior Gateway Protocol (IGP) such as OSPF for the exchange of routing information within their networks. Customers connect to ISPs, and ISPs use BGP to exchange customer and ISP routes. When BGP is used between autonomous systems (AS), the protocol is referred to as External BGP (EBGP). If a service provider is using BGP to exchange routes within an AS, then the protocol is referred to as Interior BGP (IBGP).
BGP can also be used for carrying routing information for IPv6 prefix over IPv6 networks.
Note |
When a BGPv6 device joins the cluster, it generates a soft traceback when logging level 7 is enabled. |
Routing Table Changes
BGP neighbors exchange full routing information when the TCP connection between neighbors is first established. When changes to the routing table are detected, the BGP routers send to their neighbors only those routes that have changed. BGP routers do not send periodic routing updates, and BGP routing updates advertise only the optimal path to a destination network.
Note |
AS loop detection is done by scanning the full AS path (as specified in the AS_PATH attribute), and checking that the AS number of the local system does not appear in the AS path. By default, EBGP advertises the learned routes to the same peer to prevent additional CPU cycles on the ASA in performing loop checks and to avoid delays in the existing outgoing update tasks. |
Routes learned via BGP have properties that are used to determine the best route to a destination, when multiple paths exist to a particular destination. These properties are referred to as BGP attributes and are used in the route selection process:
-
Weight—This is a Cisco-defined attribute that is local to a router. The weight attribute is not advertised to neighboring routers. If the router learns about more than one route to the same destination, the route with the highest weight is preferred.
-
Local preference—The local preference attribute is used to select an exit point from the local AS. Unlike the weight attribute, the local preference attribute is propagated throughout the local AS. If there are multiple exit points from the AS, the exit point with the highest local preference attribute is used as an exit point for a specific route.
-
Multi-exit discriminator—The multi-exit discriminator (MED) or metric attribute is used as a suggestion to an external AS regarding the preferred route into the AS that is advertising the metric. It is referred to as a suggestion because the external AS that is receiving the MEDs may also be using other BGP attributes for route selection. The route with the lower MED metric is preferred.
-
Origin—The origin attribute indicates how BGP learned about a particular route. The origin attribute can have one of three possible values and is used in route selection.
-
IGP—The route is interior to the originating AS. This value is set when the network router configuration command is used to inject the route into BGP.
-
EGP—The route is learned via the Exterior Border Gateway Protocol (EBGP).
-
Incomplete—The origin of the route is unknown or learned in some other way. An origin of incomplete occurs when a route is redistributed into BGP.
-
-
AS_path—When a route advertisement passes through an autonomous system, the AS number is added to an ordered list of AS numbers that the route advertisement has traversed. Only the route with the shortest AS_path list is installed in the IP routing table.
-
Next hop—The EBGP next-hop attribute is the IP address that is used to reach the advertising router. For EBGP peers, the next-hop address is the IP address of the connection between the peers. For IBGP, the EBGP next-hop address is carried into the local AS. However, when the next hop is in the same subnet as the peering address of the eBGP peer, the next hop is not modified. This behavior is referred to as the third party next hop.
Use the next-hop-self command when redistributing VPN-advertised routes to iBGP peers to ensure that the routes are redistributed with the correct next hop IP.
-
Community—The community attribute provides a way of grouping destinations, called communities, to which routing decisions (such as acceptance, preference, and redistribution) can be applied. Route maps are used to set the community attribute. The predefined community attributes are as follows:
-
no-export—Do not advertise this route to EBGP peers.
-
no-advertise—Do not advertise this route to any peer.
-
internet—Advertise this route to the Internet community; all routers in the network belong to it.
-
BGP Path Selection
BGP may receive multiple advertisements for the same route from different sources. BGP selects only one path as the best path. When this path is selected, BGP puts the selected path in the IP routing table and propagates the path to its neighbors. BGP uses the following criteria, in the order presented, to select a path for a destination:
-
If the path specifies a next hop that is inaccessible, drop the update.
-
Prefer the path with the largest weight.
-
If the weights are the same, prefer the path with the largest local preference.
-
If the local preferences are the same, prefer the path that was originated by BGP running on this router.
-
If no route was originated, prefer the route that has the shortest AS_path.
-
If all paths have the same AS_path length, prefer the path with the lowest origin type (where IGP is lower than EGP, and EGP is lower than incomplete).
-
If the origin codes are the same, prefer the path with the lowest MED attribute.
-
If the paths have the same MED, prefer the external path over the internal path.
-
If the paths are still the same, prefer the path through the closest IGP neighbor.
-
Determine if multiple paths require installation in the routing table for BGP Multipath.
-
If both paths are external, prefer the path that was received first (the oldest one).
-
Prefer the path with the lowest IP address, as specified by the BGP router ID.
-
If the originator or router ID is the same for multiple paths, prefer the path with the minimum cluster list length.
-
Prefer the path that comes from the lowest neighbor address.
BGP Multipath
BGP Multipath allows installation into the IP routing table of multiple equal-cost BGP paths to the same destination prefix. Traffic to the destination prefix is then shared across all installed paths.
These paths are installed in the table together with the best path for load-sharing. BGP Multipath does not affect best-path selection. For example, a router still designates one of the paths as the best path, according to the algorithm, and advertises this best path to its BGP peers.
In order to be candidates for multipath, paths to the same destination need to have these characteristics equal to the best-path characteristics:
-
Weight
-
Local preference
-
AS-PATH length
-
Origin code
-
Multi Exit Discriminator (MED)
-
One of these:
-
Neighboring AS or sub-AS (before the addition of the BGP Multipaths)
-
AS-PATH (after the addition of the BGP Multipaths)
-
Some BGP Multipath features put additional requirements on multipath candidates:
-
The path should be learned from an external or confederation-external neighbor (eBGP).
-
The IGP metric to the BGP next hop should be equal to the best-path IGP metric.
These are the additional requirements for internal BGP (iBGP) multipath candidates:
-
The path should be learned from an internal neighbor (iBGP).
-
The IGP metric to the BGP next hop should be equal to the best-path IGP metric, unless the router is configured for unequal-cost iBGP multipath.
BGP inserts up to n most recently received paths from multipath candidates into the IP routing table, where n is the number of routes to install to the routing table, as specified when you configure BGP Multipath. The default value, when multipath is disabled, is 1.
For unequal-cost load balancing, you can also use BGP Link Bandwidth.
Note |
The equivalent next-hop-self is performed on the best path that is selected among eBGP multipaths before it is forwarded to internal peers. |