, , , , , , , ,

The BGP route Decision Algorithm

The BGP route selection algorithm in the JUNOS software uses a deterministic set of steps to select the active route for the routing table. This means that given the same set of route attributes, the algorithm makes the same selection every time. The steps of the algorithm are as follows:

1. The router first verifies that a current route exists in the inet.0 routing table that provides reachability to the address specified by the Next Hop attribute. Should a valid route not exist, the path advertisement is not usable by the router and the route is marked as hidden in the routing table.

2. The router checks the Local Preference value and prefers all advertisements with the highest value. This is the only step in the algorithm that prefers a higher value over a lower value.

3. The router evaluates the length of the AS Path attribute. A shorter path length is preferred over a longer path length. When the attribute contains an AS Set segment, designated by the { and } braces, this set of values is considered to have a length of 1. For example, the AS Path of 65010 {65020 65030 65040} has a path length of 2.

4. The router checks the value in the Origin attribute. A lower Origin value is preferred over a higher value.

5. The router checks the value of the MED attribute for routes advertised from the same neighboring AS. A lower MED value is preferred over a higher MED value.

6. The router checks the type of BGP peer the path advertisement was learned from. Adver-tisements from EBGP peers are preferred over advertisements from IBGP peers.

7. The router determines the IGP metric cost to each BGP peer it received a path advertise-ment from. Advertisements from the peer with the lowest IGP cost are preferred. For all IBGP advertisements, the router also selects a physical next hop (or multiple next hops) for the advertisements from the lowest-cost peer. These physical next hops are selected using the following criteria:

a. The router examines both the inet.0 and the inet.3 routing tables for the address of the BGP Next Hop. The physical next hop(s) associated with the lowest JUNOS software route preference is preferred. This often means that the router uses the inet.3 version of the next hop—a Multiprotocol Label Switching (MPLS)–label switched path.

b. Should the preference values in the inet.0 and the inet.3 routing tables be equal, the router uses the physical next hop(s) of the instance in inet.3.

c. Should the preference values be identical and the routes be in the same routing table, inet.0 for example, the router evaluates the number of equal-cost paths of each route instance. The instance with the larger number of paths is preferred and its physical next hops are installed. This situation might occur when the default preference values are mod-ified and the traffic-engineering bgp-igp MPLS configuration command is used.

8. The router determines the length of the Cluster List attribute. A shorter list length is pre-ferred over a longer list length.

9. The router determines the router ID for each peer that advertised a path to the route des-tination. A lower router ID value is preferred over a higher router ID value.

10. The router determines the peer ID for each peer that advertised a path to the router desti-nation. A lower peer ID value is preferred over a higher peer ID value. The peer ID is the IP address of the established BGP peering session.

When any step in the algorithm results in a single path advertisement, the router stops pro-cessing and installs that version of the route as the active route in the routing table.

About these ads