Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

Configuring the Fields in the Algorithm Used To Hash LAG Bundle and ECMP Traffic (CLI Procedure)

Juniper Networks EX Series and QFX Series switches use a hashing algorithm to determine how to forward traffic over a Link Aggregation group (LAG) bundle or to the next-hop device when equal-cost multipath (ECMP) is enabled.

The hashing algorithm makes hashing decisions based on values in various packet fields, as well as on some internal values like source port ID and source device ID. You can configure some of the fields that are used by the hashing algorithm.

Configuring the fields used by the hashing algorithm is useful in scenarios where most of the traffic entering the bundle is similar and the traffic needs to be managed in the LAG bundle. For instance, if the only difference in the IP packets for all incoming traffic is the source and destination IP address, you can tune the hashing algorithm to make hashing decisions more efficiently by configuring the algorithm to make hashing decisions using only those fields.

Configuring the Hashing Algorithm to Use Fields in the Layer 2 Header for Hashing

To configure the hashing algorithm to use fields in the Layer 2 header for hashing:

  1. Configure the hash mode to Layer 2 header:
    [edit forwarding-options enhanced-hash-key]
    user@switch# set hash-mode layer2-header

    The default hash mode is Layer 2 payload. Therefore, this step must be performed if you have not previously configured the hash mode.

  2. Configure the fields in the Layer 2 header that the hashing algorithm uses for hashing:
    [edit forwarding-options enhanced-hash-key]
    user@switch# set layer2 {no-destination-mac-address | no-ether-type | no-source-mac-address | vlan-id}

    By default, the hashing algorithm uses the values in the destination MAC address, Ethertype, and source MAC address fields in the header to hash traffic on the LAG. You can configure the hashing algorithm to not use the values in these fields by configuring no-destination-mac-address, no-ether-type, or no-source-mac-address.

    You can also configure the hashing algorithm to include the VLAN ID field in the header by configuring the vlan-id option.

    If you want the hashing algorithm to not use the Ethertype field for hashing:

    [edit forwarding-options enhanced-hash-key]
    user@switch# set layer2 no-ether-type

Configuring the Hashing Algorithm to Use Fields in the IP Payload for Hashing

To configure the hashing algorithm to use fields in the IP payload for hashing:

  1. Configure the hash mode to Layer 2 payload:
    [edit forwarding-options enhanced-hash-key]
    user@switch# set hash-mode layer2-payload

    The IP payload is not checked by the hashing algorithm unless the hash mode is set to Layer 2 payload. The default hash mode is Layer 2 payload.

  2. Configure the fields in the IP payload that the hashing algorithm uses for hashing:
    [edit forwarding-options enhanced-hash-key]
    user@switch# set inet {no-ipv4-destination-address | no-ipv4-source-address | no-l4-destination-port | no-l4-source-port | no-protocol | vlan-id}

    For instance, if you want the hashing algorithm to ignore the Layer 4 destination port, Layer 4 source port, and protocol fields and instead hash traffic based only on the IPv4 source and destination addresses:

    [edit forwarding-options enhanced-hash-key]
    user@switch# set inet no-l4-destination-port no-l4-source-port no-protocol

Configuring the Hashing Algorithm to Use Fields in the IPv6 Payload for Hashing

To configure the hashing algorithm to use fields in the IPv6 payload for hashing:

  1. Configure the hash mode to Layer 2 payload:
    [edit forwarding-options enhanced-hash-key]
    user@switch# set hash-mode layer2-payload

    The IPv6 payload is not checked by the hashing algorithm unless the hash mode is set to Layer 2 payload. The default hash mode is Layer 2 payload.

  2. Configure the fields in the IPv6 payload that the hashing algorithm uses for hashing:
    [edit forwarding-options enhanced-hash-key]
    user@switch# set inet6 {no-ipv6-destination-address | no-ipv6-source-address | no-l4-destination-port | no-l4-source-port | no-next-header | vlan-id}

    For instance, if you want the hashing algorithm to ignore the Layer 4 destination port, Layer 4 source port, and the Next Header fields and instead hash traffic based only on the IPv6 source and IPv6 destination address fields only:

    [edit forwarding-options enhanced-hash-key]
    user@switch# set inet6 no-l4-destination-port no-l4-source-port no-next-header

Published: 2014-07-23