Display the specific port used in an etherchannel for given src/dst info

Display the specific port used in an etherchannel for given src/dst info

Etherchannel on Cisco switches uses a hashing algorithm to determine which interface within the bundle to send the data over i.e. The port choice is deterministic and will always be the same unless ports are added to the bundle or the hashing algorithm is changed. It also means that bundling up 8 * 1Gb/s wont give you the ability of having a single connection between two hosts across the etherchannel using any more than 1Gb/s. Any more than 1Gb/s would be dropped :( Its also useful to bare in mind that the hashing/distribution is purely a transmit function.

The algorithm can be changed to use additional criteria to allow for better load balancing though. Currently these are:

  dst-ip                 Dst IP Addr
  dst-mac                Dst Mac Addr
  dst-mixed-ip-port      Dst IP Addr and TCP/UDP Port
  dst-port               Dst TCP/UDP Port
  mpls                   Load Balancing for MPLS packets
  src-dst-ip             Src XOR Dst IP Addr
  src-dst-mac            Src XOR Dst Mac Addr
  src-dst-mixed-ip-port  Src XOR Dst IP Addr and TCP/UDP Port
  src-dst-port           Src XOR Dst TCP/UDP Port
  src-ip                 Src IP Addr
  src-mac                Src Mac Addr
  src-mixed-ip-port      Src IP Addr and TCP/UDP Port
  src-port               Src TCP/UDP Port

You can view the current load balancing alogrithm with the show etherchannel load-balance command. From the table below you can see that only having 2, 4 or 8 ports in the etherchannel results in the load being balanced "equally" (the actual load on any particular interface is not part of the hashing algorithm).

Number of Ports 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
Viewing the particular port calculated from the hashing algorithm can be invaluble. This is done using the command test etherchannel load-balance interface port-channel. Example below of displaying the interface the hashing alogrithm will use (Gi1/0/25).

 

m00nie_3750_Stack#test etherchannel load-balance ?
  interface  Port-channel interface

m00nie_3750_Stack#test etherchannel load-balance interface ?
  Port-channel  Ethernet Channel of interfaces

m00nie_3750_Stack#test etherchannel load-balance interface port-channel 1 ?
  ip    IP address
  ipv6  IPv6 address
  mac   Mac address

m00nie_3750_Stack#test etherchannel load-balance interface port-channel 1 mac ?
  H.H.H  Source MAC address

m00nie_3750_Stack#test etherchannel load-balance interface port-channel 1 mac beef.beef.beef ?
  H.H.H  Destination MAC address (egress value for routed unicast)

m00nie_3750_Stack#test etherchannel load-balance interface port-channel 1 mac beef.beef.beef feeb.feeb.feeb
Would select Gi1/0/25 of Po1

You can only test using the currently configured hashing algorithm.

m00nie_3750_Stack#test etherchannel load-balance interface port-channel 1 ip 192.168.1.1 10.10.10.1
Configured load-balance is "src-mac", cannot select member of Po1 based on IP address

More info can be found [here] (Cisco.com)

m00nie :)