When examining layer 3 LACP hashing, we need to analyze how switches process packet headers to determine link selection. The critical components are:
struct lacp_hash_input {
uint32_t src_ip; // Last 5 bits used
uint32_t dst_ip; // Last 5 bits used
uint16_t src_port; // TCP/UDP ports included
uint16_t dst_port;
};
The key distinction lies in whether the hashing algorithm uses:
- End-to-end destination IP (client's public IP)
- Next-hop IP (router's interface IP)
Modern enterprise switches (like Cisco Nexus or Arista) typically implement end-to-end IP hashing. This means traffic to different clients will hash across different links, even when passing through the same router.
To test your specific switch's behavior:
# Capture LACP hash decisions
tcpdump -i eth0 -nn -v 'ip and (host client_ip or host router_ip)'
Then analyze which IP appears in the hash calculation by observing traffic distribution patterns.
For HP ProCurve switches, the hash mode can sometimes be adjusted:
# On HP 2910al series
configure terminal
trunk 1/1,1/2 trk1 lacp
lacp-trunk load-balance ip-sa-da
When hardware limitations prevent optimal hashing:
- Implement ECMP routing with multiple /30 subnets
- Use policy-based routing to force specific paths
- Consider VLAN-based load balancing
Be aware that more granular hashing (including ports) may cause:
- Higher CPU utilization on switches
- Potential reordering of TCP packets
- Reduced effective bandwidth for single-flow scenarios
Layer 3 LACP destination address hashing operates at a fundamental level by creating a deterministic mapping between network flows and physical links. The algorithm typically uses these components:
hash = (src_ip XOR dest_ip) MOD number_of_links
The key distinction lies in which destination IP gets hashed:
- Next-hop hashing: Uses the immediate next device's IP (router's IP in your topology)
- End-to-end hashing: Uses the ultimate client IP address
Most enterprise switches (including Cisco and HP ProCurve series) implement next-hop hashing for L3 LACP:
// Typical switch ASIC pseudocode
uint8_t calculate_lacp_hash(packet_t pkt) {
return (pkt.ip_src.last_byte ^ pkt.ip_dst.last_byte) % link_count;
}
For your HP ProCurve 2510G-24, verify the exact hashing behavior with:
# CLI command to check LACP hashing
show lacp hash-algorithm
Your current xmit_hash_policy=1 setting is correct for L3+L4 hashing. Alternative policies include:
# Available xmit_hash_policy values:
# 0 - layer2 (default)
# 1 - layer3+4
# 2 - layer2+3
# 3 - encap2+3
# 4 - encap3+4
For single-server/multi-client scenarios, these statistics show typical distribution:
Hashing Method | Link Utilization Variance |
---|---|
Layer 2 (MAC-based) | 100%/0% (worst case) |
Layer 3 (IP-based) | 55%/45% (typical) |
Layer 3+4 (IP+Port) | 52%/48% (optimal) |
When evaluating 2910al vs 2510G-24, consider these hardware specs:
- 2910al uses full 32-bit IP XOR operation
- 2510G-24 may only use last octet
- Newer switches support dynamic load threshold adjustment
These diagnostic commands help verify actual traffic distribution:
# On HP ProCurve switches
show lacp counters
show interface ethernet X/Y throughput
# On Linux servers
cat /proc/net/bonding/bond0
ethtool -S eth0 | grep packets
If LACP limitations persist, consider:
- ECMP routing with BGP
- VLAN-based traffic separation
- Application-level sharding