The load-balance command enables the per-packet load balancing mode for IP packet forwarding.
The undo load-balance command restores the load balancing mode for IP packet forwarding to the default configuration.
By default, flow-based load balancing is used.
load-balance { flow | packet } [ all | slot slot-id ]
undo load-balance packet [ all | slot slot-id ]
Parameter | Description | Value |
---|---|---|
flow | Indicates flow-based load balancing. | - |
packet | Indicates packet-based load balancing. | - |
all | In a stack, the configuration is applied to all devices in the stack. On a stand-alone switch, the configuration is applied to the local device. |
- |
slot slot-id | Indicates that the configuration is applied to the device with the specified stack ID. |
The value is an integer. It has a fixed value of 0 in a non-stack scenario, and depends on the device configuration in a stack scenario. |
Usage Scenario
If flow-based load balancing is used, the hash algorithm is used to calculate a value for selecting a link to forward packets. The value is calculated based on the protocol type, source IP address, destination IP address, source port number, and destination port number.
If packet-based load balancing is used, packets are forwarded through different links. Packet-based load balancing can be implemented only for packets forwarded by the CPU such as protocol packets.
Precautions
The load-balance command takes effect for packets both delivered by the local device and processed by the CPU.
The load-balance command can also be used for MPLS packets.