Load balancing is used to evenly distribute traffic when the following conditions apply:
By default, when load balancing is used to help distribute traffic, the JUNOS Software employs a hash algorithm to select a next-hop address to install into the forwarding table. Whenever the set of next hops for a destination changes in any way, the next-hop address is reselected by means of the hash algorithm.
You can configure how the hash algorithm is used to load-balance traffic across a set of equal-cost LSPs. The hash algorithm can be configured to use the first MPLS label, the first two MPLS labels, the IP payload, or the first and second MPLS labels and the IP payload.
For more information about statements configured under the [edit forwarding-options] hierarchy level, see the JUNOS Policy Framework Configuration Guide.
The following sections describe how to configure load balancing for MPLS LSPs:
To use the first MPLS label in the hash key, include the label-1 statement at the [edit forwarding-options hash-key family mpls] hierarchy level:
To use the second MPLS label in the hash key, include both the label-1 and label-2 statements at the [edit forwarding-options hash-key family mpls] hierarchy level:
To use the third MPLS label in the hash key, include the label-1, label-2, and label-3 statements at the [edit forwarding-options hash-key family mpls] hierarchy level:
To use the MPLS packet’s IP payload (IP version 4 [IPv4] or IP version 6 [IPv6]) in the hash key, include the no-labels statement and the payload statement with the ip option at the [edit forwarding-options hash-key family mpls] hierarchy level:
![]() |
Note: The router determines if the MPLS payload is an IP packet by checking the byte containing the IP version number. If the IP version number is 4 (IPv4) or 6 (IPv6), the packet is assumed to be an IP packet. |
To use the first and second MPLS labels and the MPLS packet’s IP payload in the hash key, include the label-1 and label-2 statements and the payload statement with the ip option at the [edit forwarding-options hash-key family mpls] hierarchy level:
![]() |
Note: You can include this combination of statements on M320 and T Series Core Routers only. If you include them on an M Series Multiservice Edge Router, only the first MPLS label and the IP payload are used in the hash key. |
An LSP tends to load-balance its placement by randomly selecting one of the equal-cost next hops and using it exclusively. The random selection is made independently at each transit router, which compares IGP metrics alone. No consideration is given to bandwidth or congestion levels.