Showing results for 
Search instead for 
Did you mean: 

How to configure a Giga EtherChannel with the XOR algorithm on a switch in order to achieve load balancing



If an XOR mathematical operation is performed on the last two bits of the source MAC address and the destination MAC address, the operation yields one of four results:

  • (0 0)
  • (0 1)
  • (1 0)
  • (1 1)

Each of these values points to a link in the Fast EtherChannel bundle. In the case of a two-port Fast EtherChannel, only a single bit is used in the XOR operation.

In order to distribute frames across the links in a channel, the EtherChannel reduces part of the binary pattern that the addresses in the frame form to a numerical value that selects one of the links in the channel. EtherChannel frame distribution uses a Cisco-proprietary hash algorithm. The algorithm is deterministic. If the same addresses and session information are used, the same port in the channel is always hashed. This method prevents out-of-order packet delivery.

The Cisco-proprietary hash algorithm computes a value in the 0-7 range. With this value as a basis, a particular port in the EtherChannel is chosen. The port setup includes a mask which indicates which values the port accepts for transmission. With the maximum number of eight ports in a single EtherChannel, each port accepts only one value. If the EtherChannel has four ports, each port accepts two values, and so on.

Note: The hash algorithm cannot be configured or changed to load balance the traffic among the ports in an EtherChannel.

Three Link EtherChannel Scenario

If the hash is perfect, when a port channel has three links, the flows are divided as 3/3/2. What the hash is based on determines the flow. For example, the hash can be based on one of these:

  • src-dst-ip (default)  
  • src-dst-mac  
  • src-dst-port  

If the default is used, each distinct src/dst IP pair constitutes a flow. Then, it is necessary to factor in how fat each flow is since this can change the picture dramatically.

If the hash is perfect and all flows are equal, the three-link channel traffic is unevenly balanced at 3/3/2. In this scenario, in order to achieve perfect load-balancing, create a channel with two, four, or eight links.

Refer to these documents for more information: