Note
The dynamic AS number prefix peer configuration overrides the individual AS number configuration that is inherited from a BGP template.
To establish BGP sessions between peers, BGP must have a router ID, which is sent to BGP peers in the OPEN message when a BGP session is established. The BGP router ID is a 32-bit value that is often represented by an IPv4 address. You can configure the router ID. By default, Cisco NX-OS sets the router ID to the IPv4 address of a loopback interface on the router. If no loopback interface is configured on the router, the software chooses the highest IPv4 address configured to a physical interface on the router to represent the BGP router ID. The BGP router ID must be unique to the BGP peers in a network.
Cisco NX-OS also supports some advanced functionality related to the configuration of BGP peers, which allows for better flexibility. These options include:
• BGP peer templates: constructs, which allow to create BGP configuration for the peers and re-use it across similar BGP peers. There are two sub-types of peer templates – the peer-session template, which defines session attributes, timers and AS, and peer-policy templates, which define address-family related dependent options, such as inbound and outbound policies, filter-lists, prefix-lists. Additionally, the peer-session and the peer-policy templates can be combined in one peer template which can be re-used in the configuration.
• BGP interface peering via IPv6 link-local for IPv4/6 address families: this feature allows instead of specifying an IP address, or prefix for the neighbor, to define an interface to be used for an automatic neighbor discovery. This is possible because of the ICMPv6 neighbor discovery (ND) route advertisement (RA) for automatic neighbor discovery and on the ability of sending IPv4 routes with IPv6 next hop, described in RFC 5549.
Note
If BGP does not have a router ID, it cannot establish any peering sessions with BGP peers.
The best-path algorithm runs each time a path is added or withdrawn for a given network. The best-path algorithm also runs if you change the BGP configuration. BGP selects the best path from the set of valid paths available for a given network.
Cisco NX-OS implements the BGP best-path algorithm in the following steps.
Step 1: Comparing Pairs of Paths
This first step in the BGP best-path algorithm compares two paths to determine which path is better. The following sequence describes the basic steps that Cisco NX-OS uses to compare two paths to determine the better path:
1. Cisco NX-OS chooses a valid path for comparison. (For example, a path that has an unreachable next-hop is not valid.)
2. Cisco NX-OS chooses the path with the highest weight.
3. Cisco NX-OS chooses the path with the highest local preference.
4. If one of the paths is locally originated, Cisco NX-OS chooses that path.
5. Cisco NX-OS chooses the path with the shorter AS-path.
Note
When calculating the length of the AS-path, Cisco NX-OS ignores confederation segments and counts AS sets as 1.
6. Cisco NX-OS chooses the path with the lower origin. Interior Gateway Protocol (IGP) is considered lower than EGP.
7. Cisco NX-OS chooses the path with the lower multi-exit discriminator (MED).
You can configure a number of options that affect whether this step is performed. In general, Cisco NX-OS compares the MED of both paths if the paths were received from peers in the same autonomous system; otherwise, Cisco NX-OS skips the MED comparison.
You can configure Cisco NX-OS to always perform the best-path algorithm MED comparison, regardless of the peer autonomous system in the paths. Otherwise, Cisco NX-OS will perform a MED comparison that depends on the AS-path attributes of the two paths being compared:
a. If a path has no AS-path or the AS-path starts with an AS_SET, the path is internal, and Cisco NX-OS compares the MED to other internal paths.
b. If the AS-path starts with an AS_SEQUENCE, the peer autonomous system is the first AS number in the sequence, and Cisco NX-OS compares the MED to other paths that have the same peer autonomous system.
c. If the AS-path contains only confederation segments or starts with confederation segments followed by an AS_SET, the path is internal and Cisco NX-OS compares the MED to other internal paths.
d. If the AS-path starts with confederation segments followed by an AS_SEQUENCE, the peer autonomous system is the first AS number in the AS_SEQUENCE, and Cisco NX-OS compares the MED to other paths that have the same peer autonomous system.