You should be familiar with the sequence of characteristics (attributes) that BGP uses for path selection, as follows :
-
The highest weight that is local on the router
-
The highest local preference throughout the AS
-
The route originated by the router
-
The shortest AS_PATH attribute
-
The lowest origin code
-
The lowest MED from another AS
-
The EBGP path over an IBGP path
-
The path through the closest IGP peer
-
The oldest route for EBGP paths
-
The path with the lowest neighbor BGP router ID
-
The path with the lowest neighbor IP address