First of all.. I think myself along with any new engineer will automatically assume that data/frames/packets are distributed equally amongst every link in the bundle.. Unfortunately this is NOT the case at all! There is actually a very simple algorithm taking place in the background of that EtherChannel bundle, making use of our sub-netting mathematical prowess.
The process taking place depends on the type of load-balancing used on your device.
Setting the load-balancing method:
(Config)#port-channel load-balance method
There are several load-balancing techniques available on the EtherChannel.... these options include:
src-mac - Source MAC Address
dst-mac - Destination MAC Address
src-dst-mac - Source AND Destination MAC Address
src-ip - Source IP Address
dst-ip - Destination IP Address
src-dst-ip - Source AND Destination IP Address
src-port - Source TCP/UDP Port
dst-port - Destination TCP/UDP Port
src-dst-port - Source AND Destination Port number
You MUST be wondering at this point, how is this converting into a load-balancing algorithm? Well, I will share that with you now.
If you are using only ONE address or port number to load-balance, the algorithm is incredibly simple. Let's say for example you are using EIGHT ports in your EtherChannel (the protocol isn't important at this point) and using a load-balancing method of "src-ip" with a source IP address of 172.16.0.30.
1. The first step is finding out how many bits are important to the hashing algorithm used for load-balancing. The way we can discover this is by converting EIGHT (the number of links in our bundle) into binary.. Eight in binary is... 00000111 (Don't forget about ZERO being a number) The only thing that WE care about are those LAST three bits.. You will never care about more than 3 bits in ANY EtherChannel. In a 4-link Etherchannel, you will care about 2 bits.. in a 2-link EtherChannel you will only care about 1 bit. (Remember this!)
2. Now that we have these final three bits.. we add them up! 1 + 2 + 4 = 7 .... The load balancing algorithm will use Link 7 to send this packet!!! It is that simple! (Valid links in this case are: 0,1,2,3,4,5,6,7)
3. Now verify the load-balancing algorithm via the "show etherchannel load" command. This will (SORTA) help you discover which links in each bundle are being used, and how often.
So a question for you, if all of the EtherChannel traffic was sourced as this IP address - how would the load-balancing look? Your gut reaction is absolutely correct, Link 7 will be used over.. and over.. and over... and the only benefit of your EtherChannel will be redundancy in case one link were to fail.. However the distribution of traffic is practically non-existent.
Quick factoid, relevant to this topic.. If you were to use ANY other Layer 3 protocol while the load balancing method was set to "src-ip" , what would happen? Well there would be no IP address to source the packet from, and the switch would automatically fall back to the next-best load-balancing method - which would be "src-mac" in this case.
Well that is it for load-balancing via Etherchannel.. have a good....... wait... what if we were to use 2 addresses as our load-balancing technique (such as src-dst-ip).. this would throw off our entire way of thinking!
In this situation we use a slightly modified algorithm - although it uses the same basic methodology.
Lets pretend our source IP Address = 172.16.0.30 again and that our destination IP address - 192.168.0.200.
1. First step will be again to conver that to Binary... we are using an 8-link bundle again, therefor only really care about those final 3 bits.
172.16.0.30 = 10101100.00010000.00000000.00011110 (Final three bits = 110)
192.168.0.200 = 11000000.10101000.00000000.11001000 (Final three bits = 000)
2. Step two is to perform an exclusive-or (XOR) on these last three bits!
110
XOR = 110
000
XOR Rule = If bits are same = 0 - If bits are different = 1
Following our XOR operation, we are left with 110. This is the link we will use for this packet! (110 = 6) The packet will be placed on link 6 and be on its merry way. As you can see, this has a better chance of evenly distributing traffic - as there will most likely be a difference source IP address if not a different destination IP address.
It is important to get your time and money's worth when deploying an aggregated link, you do not want 6 idle links and 1 link completely overloaded with traffic.. it is a failed design.
My final word of caution is when using a mac as destination or source address for an etherchannel. Any router will use its BIA (burned-in-address) as its source of ethernet frames. This will likely throw off the distribution load-balancing of any EtherChannel...
Hope this will help you discover the most efficient way of load-balancing your EtherChannel links in order to make full use of your bandwidth!
Kyle