Cisco IOS BGP Path Selection

Specifically in Cisco IOS, BGP chooses the best routes available using these few steps.

1. Next Hop.

NEXT_HOP attribute is a BGP well-known mandatory attribute. This attribute is included in any BGP updates. When seeing a route the router checks whether the NEXT_HOP attribute is reachable. This NEXT_HOP is not necessarily a directly connection but can also be several hops away which can be reach via IGP. If the NEXT_HOP is not reachable, then the route will not be considered to be the best route candidate.

2. Highest WEIGHT.

This attribute is Cisco-specific BGP Parameter and is not advertised to other peering.

If 1 router has two exit points for the same route, the router will check which one of these exit points has the highest WEIGHT. The WEIGHT number is between 0 – 65535. By default, all routes learned from a peer will have WEIGHT of 0 and all routes generated by local router have a WEIGHT of 32,768

3. Highest LOCAL PREFERENCE.

LOCAL_PREF is short for LOCAL PREFERENCE. This is a BGP well-known discretionary attribute and used only in updates between internal BGP peers. It is not passed to other autonomous systems. The routers in the same autonomous system will get all of the routes with LOCAL_PREF attribute value and choose one of the highest LOCAL_PREF attribute value to the best route. A path without LOCAL_PREF is considered to have had the value set with the bgp default local-preference command, or to have a value of 100 by default. LOCAL_PREF attribute affects only for traffic leaving the AS

4. Locally originated prefixes.

The router will look for route that is locally generated. That is, prefer the route that was learned from an IGP on the same router using network, aggregate, or redistribute. In Cisco, locally generated routes have WEIGHT of 32,768. Therefore making this selection superfluous.

5. Shorter AS_PATH.

AS_PATH is a BGP well-know mandatory attribute that uses a sequence os AS numbers to describe the inter-AS path, or route, to the destination . This attribute is included in all BGP updates. The router checks the routes which has the shorter AS_PATH sequence and use it as the best path.

6. Lowest numerical value of the Origin code (IGP<EGP<Imcomplete).

The router chosses the route with the lowest origin code. That is, IGP has lower (better) value than EGP, EGP has lower (better) value than INCOMPLETE.

IGP means the routes are generated using network or aggregate command. This appears as “i” in BGP table output.

EGP means the routes were received from EGP peers.

“INCOMPLETE” means the source could not be determined

7. Lowest MED.

MED, also know as MULTI_EXIT_DISC (Multi Exit Discriminator) is a BGP optional-nontransitive attribute. This attribute is not necesarrily known by peers. BGP peers can ignore the update in which it is included and not advertise the path to its other peers.

To influence incoming traffic, the MED is used to inform another AS of its preferred ingress point. MED works by modifying the outgoing updates to another AS. Once received, the next AS will see that there is a recommended path based on its MED. This MED would only be included in the local receiving AS and would not go beyond its AS.

Router will choose to use the lowest MED value (also known as METRIC) between available routes.

8. Prefer eBGP over iBGP.

Router will choose eBGP routes over iBGP. If there are more than one eBGP routes then go to step 8b. However, if non eBGP routes were available and there are more than one iBGP routes then go to step 8a.

8a. Smallest IGP metric to reach the NEXT_HOP IP Addr
8b. When more than 1 routes are external, prefer the oldest path
9. Path originated from the routers with the lowest BGP Router ID

Note about path attributes.

Well-known mandatory attribute. Must be included in all BGP updates.

Well-know discretionary attribute. May or may not be sent in a specific updates.

Optional transitive. BGP implementation is not required to support this attribute. a BGP process should accept the path in which it is included, even if ti doesn’t support the attribute, and it should pass the path on to its peers.

Optional nontransitive. BGP implementation is not required to support this attribute. a BGP process that doesn not recognize the attribute can quitely ignore the Update in which it is included and not advertise the path to its other peers.

ORIGIN – Well-known mandatory

AS_PATH – Well-known mandatory

NEXT_HOP – Well-known mandatory

LOCAL_PREF – Well-known discretionary

ATOMIC_AGGREGATE – Well-known discretionary

AGGREGATOR – Optional transitive

COMMUNITY – Optional transitive

MULTI_EXIT_DISC (MED) – Optional nontransitive

ORIGINATOR_ID – Optional nontransitive

CLUSTER_LIST – Optional nontransitive

Resources.

BGP Best Path Selection Algorithm

Routing TCP/IP, Volume II (CCIE Professional Development)

How BGP Selects Paths

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>