# How do we determine bit index in Etherchannel

Sep 26th, 2010

Hi all,

what is bit index  in etherchannel  and if example we have 2 links or 3 links or 4  or 5 links in etherchannel bundle

what would be the bit index and how it is calculated.?

Many thanks

Mahesh

Overall Rating: 0 (0 ratings)

## Replies

mahesh18 Sun, 09/26/2010 - 10:15

Also on this switch where we have 2  kinks in etherchannel

Index   Load   Port     EC state        No of bits
------+------+------+------------------+-----------
0     55     Gi1/1    Desirable-Sl    4   ***********************what does this mean?
1     AA     Gi1/2    Desirable-Sl    4

Thanks

Mahesh

krahmani323 Sun, 09/26/2010 - 13:24

Hello Mahesh,

Depending on the load-balancing method (check with "show etherchannel load-balancing"), the Cisco hash takes the MAC, IP address, or IP TCP/UDP port number and generates a 3-bit hash value.

This process occurs separately for both the Source address and Destination address. An XOR operation is then used with the results in order to generate another 3-bit value (range 0 to 7).

With these 3-bits, 8 possible values are useable .

Index corresponds to a pointer to the bundle member  In other words it determines which port in the channel is used to forward the packet.

In your case with 2 links the hash load-balances between 2 index (0 and 1) ..If there were for example 3 links it would give an output like this :

Index   Port   EC state       No of bits
------+------+------------+-----------
0     Fa0/0    on                 3
1     Fa0/1    on                 3
2     Fa0/2    on                 2

And so on Index (0, 1, 2, 3......and 7 when using maximum of 8 links).

===========

As the hash value is made by 3 bits, 8 values are possible to distribute along the different links. In your case as there is 2 links, 8 (3 bits) is divided by two => So 4 bits for the first link and 4 for the second one (=> Exact equal load-balancing)....

When the number of links increases, the number of index increases and the "N° of bits" changes according to the following table :

http://www.cisco.com/en/US/tech/tk389/tk213/technologies_tech_note09186a0080094714.shtml#cat6k

 Number of Ports in the                 EtherChannel Load Balancing 8 1:1:1:1:1:1:1:1 7 2:1:1:1:1:1:1 6 2:2:1:1:1:1 5 2:2:2:1:1 4 2:2:2:2 3 3:3:2 2 4:4

=> We can only achieve perfect load balancing, even       with random addresses, if we have two, four, or eight ports in the port       channel.

Hope it helps.

kind regards.

Karim

mahesh18 Wed, 09/29/2010 - 07:53

hi karim,

thanks for eply

here is output of

src-dst-ip
mpls label-ip

Non-IP: Source XOR Destination MAC address
IPv4: Source XOR Destination IP address
IPv6: Source XOR Destination IP address
MPLS: Label or IP

also here is other output

Port-channel: Po1
------------

Age of the Port-channel   = 127d:08h:32m:23s
Logical slot/port   = 14/1          Number of ports = 2
GC                  = 0x00010001      HotStandBy port = null
Port state          = Port-channel Ag-Inuse
Protocol            =   PAgP

Ports in the Port-channel:

Index   Load   Port     EC state        No of bits
------+------+------+------------------+-----------
0     55     Gi1/1    Desirable-Sl    4
1     AA     Gi1/2    Desirable-Sl    4

so in this case we have 2 ports my question is how from 2links we calculate 3-bit hash value.??

thanks

mahesh

krahmani323 Wed, 09/29/2010 - 09:20

Hello Mahesh,

You are welcome.

The 3-bit hash is not calculated from the number of links but from the MAC(s), IP address(es), or IP TCP/UDP port(s) of the flow.

In 6500, It is a seventeenth-degree polynomial that is implemented in hardware. In all cases, the hash takes the MAC, IP address, or IP TCP/UDP port number and applies the algorithm in order to generate a 3-bit value (value in the range 0 to 7).

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 ports in a single EtherChannel, which is eight ports, each port accepts only one value.

If you have four ports in the EtherChannel, each port accepts two values (in your case you have two ports in the EtherChannel, thus each port accepts four values), and so forth (see table for the distribution ratio)

#######################

In your case (for IP) it is a combinaison of source and destination ip @ (src-dst-ip) : So when an IP flow (let's say src=10.1.1.2 dst=10.1.1.5) is coming the Switch takes the source IP address and generate a hash. And do the same for the destination address.

If we follow the Cisco documentation concepts :

src= 10.1.1.2 =====hash====> result (illustration) = 110 (volontary not 010)

dst= 10.1.1.5 =====hash====> result (illustration) = 011 (volontary not 101)

Then 110 XOR 011 = 101 is the 3 bit hash value which determines which port in the channel is used to forward the packet

As the ports in the bundle are being given a mask indicating which value the port access, we could imagine in your 2 ports scenario for exemple that values (000 - 001 - 010 - 011) will be forwarded to Index 0 associated link (Gi1/1) and other values (100 - 101 - 110 -111) to Index1 - link (Gi1/2)

The same concept applies for bundles using more links (check table values). Note :This table only lists the number of values, which the hash algorithm calculates, that a particular port accepts. You cannot control the port that a particular flow uses. You can only influence the load balance with a frame distribution method that results in the greatest variety.

There is also a commad which help us to determine which interface in the EtherChannel forwards traffic, with the frame distribution policy as a basis =>

Sources :

http://www.cisco.com/en/US/products/hw/switches/ps700/products_white_paper09186a00801b49a4.shtml#cg6

http://www.cisco.com/en/US/tech/tk389/tk213/technologies_tech_note09186a0080094714.shtml#topic1

#######################

Otherwise you maybe quote me with an explanation approach given in the Bcmsn/Switch Cisco Press book about the hashing concept and link selection =>

For a two-link EtherChannel, a 1-bit XOR is performed on the rightmost address bit: 1 XOR 0 = 1, causing Link 1 in the bundle to be used. A four-link EtherChannel produces a 2-bit XOR: 01 XOR 10 = 11, causing Link 3 in the bundle to be used. Finally, an eight-link EtherChannel requires a 3-bit XOR: 001 XOR 110 = 111, where Link 7 in the bundle is selected.

It seems to contradict with Cisco Web documentation (or maybe my understanding is not correct), but this has also been noticed at this following discussion : https://supportforums.cisco.com/message/576827#576827

Anyway the EtherChannel frame distribution being a Cisco-proprietary hashing algorithm it would be great if someone having the infos could clarify on this !

Thanks and regards.

Karim