Description

The hashing algorithm for EX Switches is fixed, not user-configurable, and is based on the type of traffic flowing through the LAG.

For instance:
 
     - For non-IP traffic it is hashed based on src/dst mac
     - For IP traffic it will be hashed based on src/dst L3 IP + src/dst L4 ports.

NOTE : This document has been replaced by KB22943 [juniper.net] and will be removed soon. Please update your subscriptions and bookmarks.


Symptoms

Review the EX Switch hashing algorithm to identify traffic flows and load balancing.


Solution


The following is the hash formula for TCP/IP traffic:
  • SIP[5:0]^[SIP[21:16]^DIP[5:0]^DIP[21:16]^L4_SrcPort[5:0]^L4_DstPort[5:0]^L4_SrcPort[8:13]^L4_DstPort[8:13]^MAC_SA[5:0]^MAC_DA[5:0]
  • Where ^ stands for 'exclusive OR'.
  • For IP traffic, if it's L2 bridged, it will be hashed based on (src/dst L2 mac + src/dst L3 IP + src/dst L4 ports); if it's L3 routed, it will be hashed based (src/dst L3 IP + src/dst L4 ports).

Algorithm for hash calculation:
  • Non-ip packet
6-bit hash = SMAC[5:0]
xor DMAC[5:0]
  • Ipv4 packet
6-bit hash = (6-bit hash from #1 above)
xor SIP[5:0]
xor SIP[21:16]
xor DIP[5:0]
xor DIP[21:16]
  • Ipv4 TCP/UDP packet
6-bit hash = (Hash from #2 above)
xor TCP/UDP src port[5:0]
xor TCP/UDP dst port[5:0]
xor TCP/UDP src port[8:13]
xor TCP/UDP dst port[8:13]