Configuring Load Balancing Based on MPLS Labels on DPC I-Chip-Based Hardware
Juniper Networks routers can load-balance on a per-packet basis in MPLS. Load balancing can be performed on information in both the IP header and on up to three MPLS labels, providing a more uniform distribution of MPLS traffic to next hops. This feature is enabled on supported platforms by default and requires no configuration.
![]() | Note: MPC cards do not support the regular hash key configuration. For the MPC-based hash key configuration to be effective, you need an enhanced-hash-key configuration. |
Load balancing is used to evenly distribute traffic when the following conditions apply:
- There are multiple equal-cost next hops over different interfaces to the same destination.
- There is a single next hop over an aggregated interface.
By default, when load balancing is used to help distribute traffic, Junos OS 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 label switched paths (LSPs).
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 Interior Gateway Protocol (IGP) metrics alone. No consideration is given to bandwidth or congestion levels.
To load-balance based on the MPLS label information, configure the family mpls statement:
You can include this statement at the following hierarchy levels:
- [edit forwarding-options hash-key]
This feature applies to aggregated Ethernet and aggregated SONET/SDH interfaces as well as multiple equal-cost MPLS next hops. In addition, on the T Series, MX Series, M120, and M320 routers only, you can configure load balancing for IPv4 traffic over Layer 2 Ethernet pseudowires. You can also configure load balancing for Ethernet pseudowires based on IP information. The option to include IP information in the hash key provides support for Ethernet circuit cross-connect (CCC) connections.
Table 1 provides detailed information about all of the possible MPLS LSP load-balancing options.
Table 1: MPLS LSP Load Balancing Options
Statement | Supported Platforms | MPLS LSP Load Balancing Options |
---|---|---|
all-labels | PTX Series | Up to eight MPLS labels are included in the hash key to identify the uniqueness of a flow in the Packet Forwarding Engine. This value is set by default. |
label-l | M Series, MX Series, T Series | Include the first label in the hash key. Use this option for single label packets. |
label-2 | M Series, MX Series, T Series | Include the second label in the hash key. You must also configure the label-1 option. The entire first label and the first 16 bits of the second label are used in the hash key. |
label-3 | M Series, MX Series, T Series | Include the third label in the hash key. You must also configure the label-1 option and the label-2 option. |
no-labels | All | Excludes MPLS labels from the hash key. |
no-label-1-exp | M Series, MX Series, T Series | Excludes the EXP bit of the top label from the hash key. You must also configure the label-l option. For Layer 2 VPNs, the router could encounter a packet reordering problem. When a burst of traffic pushes the customer traffic bandwidth to exceed its limits, the traffic might be affected in mid flow. Packets might be reordered as a result. By excluding the EXP bit from the hash key, you can avoid this reordering problem. |
payload | All | Allows you to configure which parts of the IP packet payload to include in the hash key. For the PTX Series Packet Transport Switch, this value is set by default. |
disable | PTX Series | Exclude IP payload from the hash key. |
ether-pseudowire | M120, M320, MX Series, T Series | Load-balance IPv4 traffic over Layer 2 Ethernet pseudowires. |
ip | All | Include the IPv4 or IPv6 address in the hash key. You must also configure either label-l or no-labels. |
layer-3-only | All | Include only the Layer 3 IP information in the hash key. Excludes all of the port-data bytes from the hash key. |
port-data | M Series, MX Series, T Series | Include the source and destination port field information. By default, the most significant byte and least significant byte of the source and destination port fields are used in the hash key. To select specific bytes to use in the hash key, include one or more of the source-msb, source-lsb, destination-msb, and destination-lsb options at the [edit forwarding-options hash-key family mpls payload ip port-data] hierarchy level. To prevent all four bytes from being hashed, include the layer-3-only statement at the [edit forwarding-options hash-key family mpls payload ip] hierarchy level. |
destination-lsb | M Series, MX Series, T Series | Include the least significant byte of the destination port in the hash key. Can be combined with any of the other port-data options. |
destination-msb | M Series, MX Series, T Series | Include the most significant byte of the destination port in the hash key. Can be combined with any of the other port-data options. |
source-lsb | M Series, MX Series, T Series | Include the least significant byte of the source port in the hash key. Can be combined with any of the other port-data options. |
source-msb | M Series, MX Series, T Series | Include the most significant byte of the source port in the hash key. Can be combined with any of the other port-data options. |
The following examples illustrate ways in which you can configure MPLS LSP load balancing:
- To include the IP address as well as the first label in
the hash key:
- For M Series, MX Series, and T Series routers,
configure the label-1 statement and the ip option
for the payload statement at the [edit forwarding-options hash-key family mpls] hierarchy level:[edit forwarding-options hash-key family mpls]label-1;payload {ip;}
- For PTX Series Packet Transport Switches, the all-labels and ip payload options are configured by default, so no configuration is necessary.
- For M Series, MX Series, and T Series routers,
configure the label-1 statement and the ip option
for the payload statement at the [edit forwarding-options hash-key family mpls] hierarchy level:
- (M320 and T Series routers only) To include the IP address
as well as both the first and second labels in the hash key, configure
the label-1 and label-2 options and the ip option for the payload statement at the [edit forwarding-options hash-key family mpls] hierarchy
level:[edit forwarding-options hash-key family mpls]label-1;label-2;payload {ip;}
Note: You can include this combination of statements on M320 and T Series 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.
- For T Series routers, ensure proper load balancing by
including the label-1, label-2, and label-3 options at the [edit forwarding-options hash-key family mpls] hierarchy level:[edit forwarding-options hash-key family mpls]label-1;label-2;label-3;
- (M Series, MX Series, and T Series routers
only) For Layer 2 VPNs, the router could encounter a packet reordering
problem. When a burst of traffic pushes the customer traffic bandwidth
to exceed its limits, the traffic might be affected in mid flow. Packets
might be reordered as a result. By excluding the EXP bit from the
hash key, you can avoid this reordering problem. To exclude the EXP
bit of the first label from the hash calculations, include the no-label-1-exp statement at the [edit forwarding-options hash-key family mpls] hierarchy level:[edit forwarding-options hash-key family mpls]label-1;no-label-1-exp;payload {ip;}