Hi friend!
When a BGP device obtains multiple routes with the same destination address but different next hops from different IBGP peers, the BGP device preferentially selects the route with the highest Local_Pref attribute value. The Local_Pref attribute is valid only between IBGP peers and is not advertised to other ASs.
When a BGP device obtains multiple routes with the same destination address but different next hops from different EBGP peers, other conditions are the same, The route with a smaller MED value is preferentially selected as the optimal route.
Hope to help you!