Question: how bgp choose best path?
Answer: Prefer the highest local-preference value. Prefer the shortest AS-path length. Prefer the lowest origin value. Prefer the lowest MED value. Prefer routes learned from an EBGP peer over an IBGP peer. Prefer best exit from AS. For EBGP-received routes, prefer the current active route.