ECMP hash algorithm inquiry

Hi Folks,

I was testing the bond ECMP, and the load sharing behavior and factors. According to the Docs and the output of cat /proc/net/bonding/bondx output, it shows that hash is based on layer3+4.

Then I tested the traffic with different DMAC addresses and same layer3 and layer4 factors. In that, I was expecting no load-sharing in the bond.

But the result is that only Dmac change could also achieve load balance on the usable paths.

And the more samples of the traffic (mac address varies more but keeps the layer 3 and 4 info consistent), the better even result we got.

This makes me believe that the Hash algorithm may involve more factors than the docs mentioned.

e.g, incoming port id? or other factors that not elaborated on the Doc...

I appreciate Cumulus Gurus could share me more on the topic.


4 replies

Userlevel 3
The doc does mention source and destination ports are used in the hashing algorithm if it's for TCP or UDP frames. If the docs are missing anything here, I'll be happy to update.
Pete B wrote:


Userlevel 3
Hi Paul, The term ECMP implies layer-3 multipath hashing. When discussing bonds, it is just a hash across physical members. The difference is subtle, but using both terms to describe the same thing is a little confusing. 🙂

Now, in Cumulus Linux, the bond-hashing command in the interfaces file, should set the hashing policy used for kernel-generated traffic out of the switch via the bond. However it will not change the way the ASIC hashes the traffic from port-to-port. This is pre-defined to hash using layer1-4 information, thus providing the most entropy to the hashing algorithm, and resulting in balanced LAG-member utilization.

If you are having any problems with the LAG hashing, I would recommend opening a Cumulus Support case, and let us have a look to see what is happening. It may be a bug.
Jason Guy wrote:

Hi Paul, The term ECMP implies layer-3 multipath hashing. When discussing bonds, it is just a has...

Thank you Jason Guy, it is helpful. Once in need, I could open a case with the support team.