N WLLA OMNI
N = next hop reachability
W = weight, bigger is better
L = local preference, bigger is better
L = locally injected preferred over BGP learned
A = AS path length, shorter is better
O = origin, (igp is better than egp is better than incomplete)
M = MED, lower is better
N = neighbor type, ebgp better than ibgp
I = IGP metric to BGP next-hop, lower is better
Plus there are some additional steps. This where it’s tricky.
For eBGP, select the oldest route. If “bgp compare router-id” is enabled, skip this step.
For iBGP and eBGP with “bgp compare router-id”, lowest RID wins.
If it’s still a tie, prefer neighbor with shortest RR cluster list length (only applies to iBGP RRs)
If it’s still a tie, compare neighbor IP addresses, lowest wins.