[j-nsp] Hash algorithms for LAG

Jonathan Lassoff jof at thejof.com
Thu Jan 19 22:07:05 EST 2012


On Thu, Jan 19, 2012 at 8:08 AM, Thomas Eichhorn <te at te3networks.de> 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?

That's usually what I've seen.

Devices construct a bitfield from one or more headers that can be
picked out in hardware quickly, then apply your hash, modulo the
number of "links" and map that to a next-hop.

However, there's some differences in picking the "links" part (does it
include configured next-hops that might be unreachable), the fields
(mac, mpls, {src,dst} ip, {src,dst} L4 port, etc.), and whether or not
there's a way to reverse the hash->next hop mapping.

--j


More information about the juniper-nsp mailing list