Interfaces and Hardware Component Configuration Guide for Cisco 8000 Series Routers, Cisco IOS XR Releases

PDF

Interfaces and Hardware Component Configuration Guide for Cisco 8000 Series Routers, Cisco IOS XR Releases

Hashing for load balancing

Want to summarize with AI?

Log in

This topic describes hashing for load balancing on the Cisco 8000 Series Router, a technique that distributes traffic flows or packets efficiently across multiple available paths, links, or resources.


Hashing is a technique used by network devices such as routers and switches to distribute traffic flows or packets efficiently across multiple available paths, links, or resources. Hashing

  • ensures all packets from the same traffic flow (for example, TCP connection) follow the same path, avoiding out-of-order delivery

  • distributes multiple traffic flows across all paths, thus preventing overload of any single path, and

  • works automatically as paths or links are added or removed.

The hashing process involves these steps:

  1. Field extraction: The device extracts certain fields from the packet header, such as source and destination IP addresses, ports, and protocol.

  2. Hash function: These fields are combined and fed into a mathematical function called a hash function. This function produces a fixed-size output known as the hash value.

  3. Path selection: The resulting hash value is used to select one of several possible paths, links, or next hops. For example, if there are four links in a bundle, the device might use path = hash_value % 4, where % indicates the modulus operation.

If multiple routers use the same hash algorithm and field selection, the same flows might be mapped to the same paths on each router, resulting in polarization. This can lead to uneven traffic distribution and underused network capacity.

By increasing the variety of hash profiles using extended entropy profiles, each router hashes differently, thus reducing the chance of polarization while improving the overall load balancing. For more information, see Hashing functions for load balancing.


Configure hash rotation value

These configurations control the node-id (also referred to as HASH_ROTATE), which influences how the hashing algorithms process input fields, effectively reordering them to de-correlate flows. This is a mechanism to combat polarization.

Procedure

1.

Configure the hash rotation value using one of these options.

  • Set a specific node-id (hash rotation value) for the entire chassis. The node-id determines one of the 216 possible permutations of input fields for the hashing algorithm.

    Router# configure
    Router(config)# cef platform load-balancing algorithm adjust 10

    A specific value might be chosen to optimize load balancing for a known network topology or to address observed polarization issues.

  • Set a specific node-id (hash rotation value) for a particular NPU instance on a specific line card. Use location 0/0/CPU0 and instance 0 to identify the NPU. This node-id provides granular control, allowing different NPUs within the same chassis to use distinct hash rotation values.

    Router# configure
    Router(config)# cef platform load-balancing algorithm adjust 20 instance 0 location 0/0/CPU0

    This configuration can be useful in complex scenarios where traffic characteristics vary significantly across different NPU-handled interfaces.

  • Enable the system to automatically determine and set the node-id (hash rotation value) globally for the entire chassis. This configuration aims to dynamically select an optimal node-id to improve load balancing and minimize polarization without requiring manual intervention.

    Router# configure
    Router(config)# cef platform load-balancing algorithm adjust auto-global
  • Enable the system to automatically determine and set the node-id (hash rotation value) for each individual NPU instance across all NPUs in the chassis. This allows each NPU to independently optimize its hash rotation based on its specific traffic load and characteristics.

    Router# configure
    Router(config)# cef platform load-balancing algorithm adjust auto-instance
2.

Execute the show running-config command to view the node-id (hash rotation value) specified on the location 0/0/CPU0.

Example:

Router(config)# show running-config | incl cef platform load-balancing
Tue Nov 18 07:14:00.722 UTC
cef platform load-balancing algorithm adjust 20 instance 0 location 0/0/CPU0
Router(config)#

Hashing functions for load balancing

A hashing function is a network algorithm that

  • computes a hash value based on selected user-defined packet header fields such as source IP, destination IP, source port, destination port, and next header or protocol

  • enables efficient distribution of traffic flows across network paths, and

  • minimizes traffic polarization by supporting varied entropy profiles.

Table 1. Feature History Table

Feature Name

Release Information

Description

Enhanced hashing functions using extended entropy profiles

Release 25.4.1

Introduced in this release on: Fixed Systems (8200 [ASIC: Q200]); Modular Systems (8800 [LC ASIC: Q200])

This enhancement significantly reduces the risk of traffic polarization, thus ensuring more even and efficient distribution of traffic across multiple network paths in large-scale networks.

Load balancing hashing functions have been improved with extended entropy profiles that generate thousands of unique hash function selections on certain user-defined header fields.

This feature introduces these changes:

CLI:

  • A new keyword, extended-entropy , is added to the cef platform load-balancing command.

  • Two new keywords, ecmp-seed and spa-seed , are added to the cef platform load-balancing algorithm adjust command.

  • Two new keywords, hash and ip-field-duplication , are added to the hw-module cef command.

Addressing traffic polarization with extended entropy profiles: In large-scale networks, optimal load balancing is critical. Routers use hash algorithms to distribute traffic flows across multiple paths. However, if the hashing functions on consecutive routers are too similar, this can cause polarization, where many flows get mapped to the same path on multiple routers, reducing network efficiency and resilience.

Starting with Cisco IOS XR Release 25.4.1, load balancing hashing functions have been improved with extended entropy profiles. These profiles use specific packet header fields, such as IP addresses and port numbers, to generate thousands of unique hash function combinations. This feature introduces the extended-entropy keyword in the cef platform load-balancing command to configure the extended entropy.

Configuring ECMP and SPA seed values: You can configure 16-bit seed values for ECMP and SPA (System port aggregate), which is an internal load balancing component. Seed values introduce an additional element of randomness into the hashing process, further helping to de-correlate flows and prevent polarization. To set the seed values for ECMP and SPA, use the cef platform load-balancing algorithm adjust ecmp-seed and cef platform load-balancing algorithm adjust spa-seed commands, respectively.

Enabling ASIC property for single IP header traffic: We recommend that you enable the hw-module profile cef hash ip-field-duplication command when using cef platform load-balancing extended-entropy . This setting activates an ASIC property that enhances load balancing for traffic with a single IP header. Without this configuration, certain devices might not detect all varying bits in IPv4 or IPv6 plain traffic, potentially causing traffic polarization on some nodes.


How enhanced hashing functions for load balancing work

Summary

The key components involved in the process are:

  • Algorithm adjustments: Modify the load balancing algorithms to use additional entropy from inner header fields during hash calculation.

  • Extended entropy profiles: Define two sets of offsets and widths for fields within IPv4 or IPv6 inner headers, increasing the available entropy for hashing.

    The cef platform load-balancing extended-entropy configuration leverages the variation or entropy used in the inner header fields and incorporates this information into the outer header's hash calculation. This approach is beneficial when the inner headers have sufficient entropy, but the outer header does not vary.

  • ECMP and SPA seed values: Use specific seed values to further diversify the hash results, ensuring unique traffic distribution across routers.

Enhanced hashing functions for load balancing optimize how traffic is distributed across network paths by incorporating greater entropy from packet headers. This process leverages extended entropy profiles, algorithm adjustments, and specific ECMP and SPA seed values to create highly diversified hash results, minimizing the risk of traffic collisions while promoting balanced network utilization.

Workflow

These stages describe the enhanced hashing functions for load balancing:

  1. Profile selection: The system selects one of 256 available extended-entropy profiles, each specifying which fields within the inner packet header are used for entropy.
  2. Hash input extraction: The selected profile identifies two sets of offsets and widths in the IPv4 or IPv6 inner header, and extracts these field values as hash input.
  3. Algorithm application: The load balancing algorithm incorporates the extracted entropy, along with ECMP and SPA seed values, into the hash calculation.
  4. Hash calculation: The router computes a hash value based on the combined entropy from the inner header and the seed values.
  5. Traffic distribution: The computed hash value determines how each packet flow is distributed across available network paths, ensuring varied and balanced load sharing.

Result

The enhanced hashing process produces highly unique hash inputs, enabling routers to split traffic flows more effectively and consistently achieve balanced utilization of all network paths, even when outer packet headers lack sufficient variability.


Benefits of enhanced hashing functions

These are some benefits of the enhanced hashing functions using extended entropy profiles:

  • Improves traffic distribution across paths and devices, even with random node-id assignments.

  • Suitable for very large, multi-router, multi-path networks.

  • Supports a range of configurations and traffic types.


Configuration guidelines for enhanced hashing functions

Follow these configuration guidelines for enhanced hashing functions:

  • Do not configure both cef platform load-balancing extended-entropy and cef platform load-balancing fields user-data at the same time. These configurations are mutually exclusive.

  • When using cef load-balancing algorithm adjust auto-instance on adjacent devices with small and symmetric topologies, use cef load-balancing algorithm adjust auto-global to avoid uneven load balancing.

  • Do not configure the same seed value on adjacent devices or within the same topology.

  • Enable cef platform load-balancing extended-entropy before enabling hw-module profile cef hash ip-field-duplication .


Restrictions for enhanced hashing functions

The following restriction applies to enhanced hashing functions:

  • Only Cisco Silicon One Q200-based systems support the enhanced hashing functions for load balancing.


Configure ECMP and SPA seed values

By default, the hashing algorithm uses a 16-bit seed from the router ID, providing differentiation across devices.

You can customize ECMP or SPA seeds to introduce randomness into the hash function. To avoid load-balancing issues, configure different seed values on adjacent devices or within the same topology.

Procedure

1.

Set a specific hexadecimal ECMP seed value (0xaa in this example) for the chassis to ensure that the traffic is distributed consistently and without bias across multiple equal-cost paths, preventing polarization.

Example:

Router# configure
Router(config)# cef platform load-balancing algorithm adjust ecmp-seed 0xaa
Router(config)# commit
2.

Set a specific hexadecimal SPA seed value (0xbb in this example) for the chassis so that the seed is incorporated into the hashing calculation to add an element of uniqueness, which can help distribute traffic more evenly across multiple paths.

Example:

Router# configure
Router(config)# cef platform load-balancing algorithm adjust spa-seed 0xbb
Router(config)# commit
3.

Set a specific hexadecimal ECMP seed value (0xdd in this example) on a particular NPU instance to provide NPU-specific control over the ECMP hashing randomness, which can be beneficial in complex network designs.

Example:

Router# configure
Router(config)# cef platform load-balancing algorithm adjust ecmp-seed 0xdd instance 0 location 0/0/CPU0
Router(config)# commit
4.

Set a specific hexadecimal SPA seed value (0xcc in this example) on a particular NPU instance. This seed allows for fine-grained control, enabling different NPUs to use distinct SPA seed values if their traffic patterns or load-balancing requirements differ.

Example:

Router# configure
Router(config)# cef platform load-balancing algorithm adjust spa-seed 0xcc instance 0 location 0/0/CPU0
Router(config)# commit
5.

Verify the ECMP and SPA seed value configurations with the show running-config command.

Example:

Router# show running-config | include cef platform load-balancing
Tue Nov 18 07:08:56.704 UTC
cef platform load-balancing algorithm adjust spa-seed 0xcc instance 0 location 0/0/CPU0
cef platform load-balancing algorithm adjust ecmp-seed 0xdd instance 0 location 0/0/CPU0
Router#

Configure extended entropy profile

This procedure allows you to configure cef platform load-balancing extended-entropy . This configuration increases the number of uncorrelated hash selection algorithms by modifying how input fields are processed.

Before you configure the extended entropy profile, ensure that you have configured the ECMP and SPA seed values and algorithm adjustments so that the enhanced hashing functions for load balancing work correctly.

Procedure

1.

Configure the extended entropy profile using one of these commands.

  • Enable the system to automatically select the most suitable extended entropy profile globally for the entire chassis. This is the recommended option.

    Router# configure
    Router(config)# cef platform load-balancing extended-entropy auto-global
  • Enable the system to automatically select the most suitable extended entropy profile for each individual NPU instance across all NPUs in the chassis. This provides NPU-level optimization, allowing each NPU to dynamically choose a profile that best suits the traffic it is processing, further enhancing load balancing and polarization avoidance.

    Router# configure
    Router(config)# cef platform load-balancing extended-entropy auto-instance
  • Select a specific extended entropy profile (identified by profile-index 10 in this example) to be used for hashing across the entire chassis. These profiles define how the hashing functions are applied to various header fields, such as inner source or destination IP, and TCP or UDP ports, to maximize entropy and de-correlation. This allows an administrator to explicitly choose a profile optimized for a particular traffic mix or to address specific polarization issues.

    Router# configure
    Router(config)# cef platform load-balancing extended-entropy profile-index 10
2.

(Optional) Enable the ASIC property using the hw-module profile cef hash ip-field-duplication command. Enabling the ASIC property improves load balancing for traffic with a single IP header. Without this configuration, some devices might not capture the varying bits in IPv4 or IPv6 plain traffic, which results in polarization on certain nodes.

Example:

Router# configure
Router(config)# hw-module profile cef hash ip-field-duplication
Router(config)# commit
Router(config)# exit
Router# reload location all
3.

Execute the show running-config command to view the running configuration.

Example:

Router# show running-config | incl cef platform load-balancing
Mon Nov 17 08:16:06.749 UTC
cef platform load-balancing extended-entropy auto-global
Router(config)#