When you enable ECMP on the system and multiple equal-cost paths exist for a prefix, the following selection criteria are used to pick up the set of next hops to program in the data path:
for a destination = tunnel-endpoint (including external prefixes with tunnel-endpoint as the next hop):
select tunnel with lowest tunnel-index (ip next hop is never used in this case)
for a destination != tunnel-endpoint:
exclude LSPs with metric higher than underlying IGP cost between the endpoint of the LSP
prefer tunnel next hop over ip next hop
within tunnel next hops:
select lowest endpoint to destination cost
if same endpoint to destination cost, select lowest endpoint node router-id
if same router-id, select lowest tunnel-index
within ip next hops:
select lowest downstream router-id
if same downstream router-id, select lowest interface-index
Although no ECMP is performed across both the IP and tunnel next hops, the tunnel endpoint lies in one of the shortest IGP paths for that prefix. As a result, the tunnel next hop is always selected as long as the prefix cost using the tunnel is equal or lower than the IGP cost.
The ingress IOM sprays the packets for a prefix over the set of tunnel next hops and IP next hops based on the hashing routine currently supported for IPv4 packets.