[j-nsp] Hash algorithms for LAG
Phil Mayers
p.mayers at imperial.ac.uk
Fri Jan 20 07:14:42 EST 2012
On 01/19/2012 04:08 PM, Thomas Eichhorn wrote:
> Dear all,
>
> I just had some discussions with our SE about the
> hashing algorithms used in different devices for
> packet distribution on LAG.
>
> This seems to be a horrible complexe topic, with
> much sensible information behind - the exact algorithm
> seems to be much of a secret.
>
> I just wonder why, maybe my idea ist just a little
> bit naive, but I hope somebody here can bring some clarification
> into it:
>
> If I were to implement such a distribution algorithm,
> I would just define a range of bits of the headers,
> and do a modulo (number of member links) with it.
>
> The range of bits could say: Only from Byte 9 to 20 for
> using the mac-adresses, or a longer part of the header
> if including MPLS-labels.
>
> Am I completely wrong and there is much more magic
> behind? Has somebody here an deep insight and might
> share it with us?
What are you asking here?
How does it work?
To which the answer is "much as you described". However, it normally is
"range of bits, pushed through a hash function to generate an N-bit
output, which is used as an index into an N-bucket output interface list"
E.g. if N==3 you can have a max of 8 links in a channel; but if you have
3 links in the channel, the output buckets will look like
11122233
...so link 3 will never have >25% of the traffic. Obviously larger N is
better but more expensive to implement.
Or:
Why don't they tell you how it works?
The answer to the latter is usually "because they did the cheapest thing
they could get away with, and don't want to tell you the product has
poor functionality in this area".
More information about the juniper-nsp
mailing list