I thought it will be useful as a quick reference for myself during troubleshooting BGP related issue.
BGP path decision in order
1. Prefer the path with the highest weight.
Weight is not a BGP attribute, it is Cisco’s proprietary. The weight will not be propagated to another BGP speaking router. Weight influences the outbound traffic from the BGP speaking router. This is useful if a router has two or more links connected to one or more ISP.
2. Prefer the highest local preference.
Local preference is local to AS only. Influences outbound traffic from a local AS to remote AS. Well-known mandatory update i.e. must be included in BGP update. default local preference command changes the local preference of the local AS, it can be applied using route-map in neighbor command.
3. Prefer the routes originated by the router locally, i.e. routes learned from IGP routers.
4. Prefer the shortest AS-paths.
AS path is similar to hop count which is used by RIP routers, the main difference is AS path describe a routing domain rather than a router. AS-path is the well known mandatory attribute which must be included in BGP updates.
5. Prefer the lowest origin code.
Origin is a well known mandatory attribute which must be included in BGP updates. Most preferred origin codes: i (IGP) < e (EGP) < ? (incomplete). You should not see e as EGP is obsolete, ? happens when there’s redistribution whereby the original routing protocol and metrics are lost.
6. Prefer the lowest MED.
Multi-exit discriminator is an optional transitive attribute. BGP routers that do not recognise this attribute will mark the update as partial and forward to the next router. MED influences inbound traffic from remote AS to local AS. MED is represented as Metric in show ip bgp command.
7. Prefer eBGP paths over iBGP paths.
Oldest eBGP path is preferred due to its stability. The closest iBGP path is preferred due to lowest IGP metric. Default AD for eBGP is 20, default AD for iBGP is 200.
8. For multiple iBGP paths, prefer non-reflected routes to route reflected routes.
9. For route reflected routes, prefer shorter cluster-list to long cluster-list.
Cluster-list is an optional non-transitive attribute, BGP router that does not recognise this attribute will drop the update.
10. Finally prefer BGP router with the lowest router-id.