---
title: ECMP
slug: aidc/ecmp
createdAt: 2025-12-01T11:11:07.000Z
---

## <font color="#1d50a2">Load Balance Hash Key</font>

<font color="#1d05a2">Table 1 Load Balance Hash Key</font>

| **Command**                                                                    | **Purpose**                         |
| ------------------------------------------------------------------------------ | ----------------------------------- |
| **hash mode** \{**ipv4**\|**ipv6\|non\_ip\|ipv4-rdma\|ipv6-rdma**} *hash\_key* | Set load-balance mode and hash key. |

### <font color="#1d50a2">hash mode \{ipv4|ipv6|non\_ip|ipv4-rdma|ipv6-rdma\} *hash\_key*</font>

**\[Command]**
**hash mode** \{**ipv4|ipv6|non-ip|ipv4-rdma|ipv6-rdma**} *hash\_key*

**\[Purpose]**
Set load-balance and hash key.

**\[Parameters]**

| **Parameter** | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *hash\_key*   | The configurable hash key varys in different modes. Keys **vlan\_id/ip-protocol/src-ip/dst-ip/l4-src-port/l4-dst-port/in-port** are supported for type IPv4.Keys **vlan-id/src-ipv6/dst-ipv6/l4-src-port/l4-dst-port/in-port/nextheader/flow-label** are supported for type IPv6.Keys **src-mac/dst-mac/ethertype/vlan-id/in-port** are supported for NON-IP type.Keys **vlan\_id/ip-protocol/src-ip/dst-ip/l4-src-port/l4-dst-port/in-port/bth-dest-qp** supported for ipv4-rdma type.Keys **vlan-id/src-ipv6/dst-ipv6/l4-src-port/l4-dst-port/in-port/nextheader/ flow-label/bth-dest-qp** supported for ipv6-rdma type. |

**\[View]**
Global Configuration View

**\[Notes]**
Set this parameter to modify the LAG and ECMP hash key.
CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2 devices currently do not support configuring flow label fields for ipv6 types, which is enabled by default.
Only CX864E-N device currently supports **ipv4-rdma** and **ipv6-rdma** type.
Run command **no hash mode** \{**ipv4|ipv6|non-ip|ipv4-rdma|ipv6-rdma**} to delete the configured custom load balancing and restore it to the default configuration.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# hash mode ipv4 src-ip dst-ip
sonic(config)# hash mode ipv6 src-ipv6 nextheader in-port
sonic(config)# hash mode non-ip src-mac dst-mac vlan-id
```

## <font color="#1d50a2">Hash Configuration</font>

<font color="#1d05a2">Table 2 Hash Configuration</font>

| **Command**                      | **Purpose**                                           |
| -------------------------------- | ----------------------------------------------------- |
| **hash seed** *value*            | Set hash seed.                                        |
| **hash enhancement**             | Enable Hash Enhancement                               |
| **hash outer-fields gre enable** | Enable hash based on the outer fields of GRE packets. |

### <font color="#1d50a2">hash seed *value*</font>

**\[Command]**
**hash seed** *value*

**\[Purpose]**
Set hash seed.

**\[Parameters]**

| **Parameter** | **Description**             |
| ------------- | --------------------------- |
| *value*       | The range is 0\~4294967295. |

**\[View]**
Global Configuration View

**\[Notes]**
Configure this parameter to modify the LAG and ECMP hash seed.
Run command **no hash seed** to restore to default value 10.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# hash seed 1000
```

### <font color="#1d50a2">hash enhancement</font>

**\[Command]**
**hash enhancement**

**\[Purpose]**
Enable Hash Enhancements.

**\[View]**
Global Configuration View

**\[Notes]**
Configure this parameter to automatically modify the hash Seed of LAG and ECMP, eliminating ECMP polarization phenomenon.
Run command **hash enhancement to** disable hash enhancement.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# hash enhancement
```

### <font color="#1d50a2">hash outer-fields gre enable</font>

**\[Command]**
**hash outer-fields gre enable**

**\[Purpose]**
Enable hash based on the outer fields of GRE messages.

**\[View]**
Global Configuration View

**\[Notes]**
By default, the switch performs hashing based on the inner field of GRE packets. After this configuration, the switch will hash based on the outer field of GRE packets instead of the inner field.
Run command **no hash outer-fields gre enable** to disable the outer field hash function of GRE messages.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# hash outer-fields gre enable
```

