In an MPLS network, load balancing is generally configured on an ingress router. The load-balancing configuration distributes traffic equally across LSPs with a hash algorithm that selects the next-hop destination and installs it into the forwarding table for the active route of the LSP. Whenever the next hop changes in any way, the hash algorithm changes the next-hop address.
Use load balancing when you have many LSPs with equal-cost next hops going out different interfaces to the same destination. For example, ingress router R1 has four LSPs configured to egress router
R3, transiting R2. All four LSPs have the same metric from R2 toR3, but exit R2 from different interfaces. Without load balancing configured, one of the LSPs is selected at random and all traffic is forwarded over it. With load balancing configured, traffic is balanced evenly across all four LSPs.Depending on the version of the Internet Processor ASIC in the routing platform, a different method is used to load-balance traffic. Routing platforms with an Internet Processor I ASIC use a round-robin method, sending each packet over a different link. The round-robin method results in a good traffic balance at the cost of potential out-of-order packet arrival, which is not good for TCP.
Routing platforms with the Internet Processor II ASIC divide traffic into individual traffic flows across up to 16 next hops, keeping each individual flow on a single interface. A flow is comprised of packets with the following identical parameters:
- Source IP address
- Destination IP address
- Protocol
- Source port number
- Destination port number
- Source interface index
- Type of service (ToS)
For example, if there are 60,000 prefixes in a routing table, and 6 links between two routers, 10,000 prefixes will go across each link. In the core of the network, the law of averages produces good traffic load balancing. However, at the edge of the network, where there may not be a large number of prefixes, traffic may not be well balanced.
To summarize, an Internet Processor I ASIC spreads packets with the same parameters across multiple equal-cost next hops; while an Internet Processor II ASIC sends packets with the same parameters to the same next hop, since they are in the same flow. The JUNOS software command to turn on load balancing uses the action
load-balance per-packet, which is misnamed in relation to the Internet Processor II ASIC. On the Internet Processor II ASIC, this command actually enables per-flow load balancing.To configure load balancing, include a policy statement at the
[edit policy-options]hierarchy level. This policy statement must be applied as an export policy at the[edit forwarding-options]hierarchy level. For more information, see Configuring and Verifying Load Balancing.Load-Balancing Options
After you configure load balancing, if the outbound traffic across equal-cost next hops is not balanced to your satisfaction, you can provide additional information to identify traffic flows and balance traffic more evenly or unevenly, depending on your requirements. You can provide additional information to alter the way load balancing works in the following ways:
- Include MPLS labels and IP payload statements in the hash-key configuration at the
[edit forwarding-options hash-key]hierarchy level to evenly balance traffic across LSPs and aggregated interfaces. For more information, see Configuring MPLS Labels and IP Payload to Load-Balance LSP Traffic.- Include the IPv4 address family (INET) in the hash-key configuration at the
[edit forwarding-options hash-key]hierarchy level to ensure that traffic is evenly load-balanced across LSPs and interfaces, and that packets in the same flow are sent out through the same interface. For more information, see Configuring the IPv4 Address Family to Load-Balance LSP Traffic.- Include bandwidth at the
[edit protocols mpls label-switched-pathlsp-name]and the[edit protocols rsvp]hierarchy levels to change the number of prefixes carried by an LSP and thereby create an uneven load balance for different LSPs. For more information, see Using Bandwidth to Unevenly Load-Balance RSVP LSPs.