cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1454
Views
10
Helpful
10
Replies

Fundamental question on etherchannel hashing.

nikhil.kulkarni
Level 1
Level 1

Folks,

I had some very basic questions on the way hashing takes place on Cisco switches connected to each other over a port channel.

Considering that 2 links are used between the switch, namely port Gi 0/1 and Gi 0/2.

1) By default I understand that this could be a L2 etherchannel or L3 etherchannel, the default mode of hashing is still the Source and destination MAC id, am I correct?

2) So now if the source IP of 1.1.1.1 needs to reach to 1.1.1.2 how would the hashing calculation take place? Again I understand that this is on the basis of the last 3 bits from the IP address field. 001 and 010 come to 011 which is 3. So based on the number of ports it will select which interface to assign.

 

I still do not understand what has the below output got to do with the selection:

 

Core-01#sh interfaces port-channel 40 etherchannel
Age of the Port-channel   = 204d:07h:40m:10s
Logical slot/port   = 14/3          Number of ports = 2
GC                  = 0x00000000      HotStandBy port = null
Passive port list   = Te1/4 Te2/4
Port state          = Port-channel L3-Ag Ag-Inuse
Protocol            =    -
Port security       = Disabled
Fast-switchover     = disabled
Fast-switchover Dampening = disabled
Load share deferral = disabled

Ports in the Port-channel:

Index   Load      Port          EC state       No of bits
------+------+------------+------------------+-----------
 0      E4            Te1/4                 On   4
 1      1B            Te2/4                 On   4

Time since last port bundled:    204d:07h:19m:44s    Te2/4
Time since last port Un-bundled: 204d:07h:19m:54s    Te1/4

Core-01#

 

What does that load-value mean? and how is that calculated? and does that have a role to play in the selection of the port?

 

 

Thanks,

Nik

 

10 Replies 10

Bilal Nawaz
VIP Alumni
VIP Alumni

Hi Nik,

Please review the links here, possibly answers your questions.

http://www.cisco.com/c/en/us/support/docs/lan-switching/etherchannel/12023-4.html

http://www.cisco.com/c/en/us/support/docs/switches/catalyst-6500-virtual-switching-system-1440/109638-vss-pf-tshoot.html#eclb

hth

Bilal

Please rate useful posts & remember to mark any solved questions as answered. Thank you.

Cisco Freak
Level 4
Level 4

Hi Nik,

6500#show interface port-channel 1 etherchannel 
Port-channel1   (Primary aggregator) 
Age of the Port-channel   = 0d:01h:05m:54s
Logical slot/port   = 14/1          Number of ports = 2 
HotStandBy port = null 
Port state          = Port-channel Ag-Inuse 
Protocol            =   LACP 
Fast-switchover     = disabled 
Ports in the Port-channel: 

Index   Load   Port     EC state        No of bits

------+------+------+------------------+-----------

  0     49     Gi3/1    Active    3 
  1     92     Gi3/2    Active    3 
  2     24     Gi3/3    Active    2

 

How is 49 92 and 24 are found out. Here is how:

Total 8 bits. This has to be distributed among 3 candidates(switchport).

1

10

100

One round over for each 3.Next starts.

1001

10010

100100

2nd round over. Moving to 3rd round. The 3rd one will not get 1 bit here.(3+3+2=8)

Convert the values to hex:

01001001 - 49

10010010 - 92

00100100 - 24

 

CF

Guess I am not able to understand this well...

The bits should be as follows:

1) 000

2) 001

3) 010

4) 011

5) 100

6) 101

7) 110

8) 111

 

These should be divided evenly like, 000, 011 and 110 to the first port channel, correct? i.e. 1st, 4th and 8th combination in a 3 port port-channel?

 

or am I getting it wrong?

Please keep in mind that total 8 bits to be distributed between the total number of switchport participating in the portal channel.

For example a 2 port etherchannel will have this value:

01010101

10101010

For example a 3 port etherchannel will have this value:

01001001 - 49

10010010 - 92

00100100 - 24

 

CF

 

Hi Chris,

This started to sink in to some extent :-)

So it looks like how to divide the bits is decided by the switch.

In my case I have a port channel which shows Load values of 56 and A9 on one of the port channels(each port channel shows different value though.).

So, in this case the switch has decided to divide the bits like below:

01010110
10101001

 

Now, how does this related to the actual traffic distribution?

 

Thanks,

Nik

 

 

 

 

 

 

 

Disclaimer

The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.

Liability Disclaimer

In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.

Posting

So it looks like how to divide the bits is decided by the switch.

Ah, yea, reread my original post for answer to your second question.  ;)

An actual hashing algorithm can be rather complicated.  What they try to do is to "fairly" divide the input value across the number of hash buckets.  For example, if you have two Etherchannel links, they will try to hash the hash attribute such that 50% goes to one link and 50% to the other link.

For example, assuming you hash on source IP, how do you hash 192.168.1.1, .2, .3 and .4?  A very simple hash algorithm could just go "odd"/"even", but what if your IPs were .2, .4, .6 and .8?  A more complex algorithm would try to still hash these IPs equally across your two links.

Again, hashing algorithms can get complex, search the Internet on the subject, and you may better appreciate this.

Because of the possibility of such complexity, one vendor's hashing might be better than another vendor's, so they often will keep their actual algorithm secret.

No matter, though, how good a hashing algorithm might be, they all will hash the same attribute to the same bucket.  For example, if you're still using source IP, and only source IP, as your hash attribute, all traffic from the same host is going to use the same link.  This is why what attributes are used are important.  Choices vary per Cisco platform.  Normally, you want the hash attributes to differ between every different traffic flow.

Etherchannel does not analyze actual link loading.  If there are only two active flows, and both hash to the same link, that link might become saturated, while another link is completely idle.

Short term Etherchannel usage, unless you're dealing with lots of flows, is often not very balanced.  Longer term Etherchannel usage, should be almost balanced.  If not, most likely you're not using the optimal hash attributes for your traffic.

Thanks for the detailed explanation Joseph.

I got the concept of hashing but just to take an example if the source IP is 1.1.1.1 and the destination IP is 2.2.2.2 then would the hashing be like take the last 3 bits from 1.1.1."1" and 2.2.2."2"? In this case 001 and 010, so the computed hash is 011 which is 3(in binary). Then based on this it selects the link?

or have I messed up my understanding?

And also what would is there a some correlation between the RBH value and the Load value?

 

Thanks,

Nik

 

Hi Nik,

I think you have misunderstood the concept.

The IP address will not directly participate the RBH value. Two IP addresses when parsed to into a hashing algorithm and it will result in a RBH.

Now how the RBH is found out?

As I mentioned earlier, RBH is linked to the number of interfaces participating in the port channel. It is not found from the actual IP addresses/MAC address/Port. It simply depends on the number of physical interfaces.

CF

 

Disclaimer

The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.

Liability Disclaimer

In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.

Posting

Again, how the hashing algorithm operates varies.

Yes, one could just take just the last 3 bits of an IP, but that's very unlikely.

I just saw another posting on this question, and Jon Marshall provided a nice reference link.  The other posting is: https://supportforums.cisco.com/discussion/12457481/etherchannel-hash-calculation which references: https://supportforums.cisco.com/document/69496/etherchannel-loadbalancing-catalyst-switches

[edit]

PS:

Again, standard etherchannel doesn't monitor or use link loading.

Joseph W. Doherty
Hall of Fame
Hall of Fame

Disclaimer

The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.

Liability Disclaimer

In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.

Posting

#1 default hashing algorithm often varies per platform.

#2 the exact hashing algorithm, I believe, is considered proprietary.  All we "know" is what values are used to compute the hash.  (I believe there might be a command to find out what bundle link a specific hash source values will use.)

Re: load-value - not 100% certain, but that might just show link's current traffic load.  If so, it's a moving average - and it doesn't have anything to do with link selection.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco