Configuring Load-Balance Per-Packet Action
By default, when there are multiple equal-cost paths to the same destination for the active route, the JUNOS software uses a hash algorithm to choose one of the next-hop addresses to install into the forwarding table. Whenever the set of next hops for a destination changes in any way, the next-hop address is rechosen, also at using the hash algorithm.
You can configure the JUNOS software so that, for the active route, all next-hop addresses for a destination are installed in the forwarding table. This feature is called per-packet load balancing. You can use load balancing to spread traffic across multiple paths between routers. The behavior of the load-balance per-packet function depends on the version of the Internet Processor application-specific integrated circuit (ASIC) in your routing platform.
On routing platforms with an Internet Processor ASIC, when per-packet load balancing is configured, traffic between routers with multiple paths is spread using the hash algorithm across the available interfaces. The forwarding table balances the traffic headed to a destination, transmitting it in round-robin fashion among the multiple next hops (up to a maximum of eight equal-cost load-balanced paths). The traffic is load-balanced on a per-packet basis.
On routing platforms with the Internet Processor II ASIC, when per-packet load balancing is configured, traffic between routers with multiple paths is divided into individual traffic flows (up to a maximum of 16 equal-cost load-balanced paths). Packets for each individual flow are kept on a single interface.
To configure the load-balance per-packet action, include the
load-balance per-packetaction in athenstatement or aroute-filteroption in afromstatement in a routing policy.You must apply the routing policy to routes exported from the routing table to the forwarding table to complete the configuration. To do this, include the
exportstatement.You must apply the routing policy to routes exported from the routing table to the forwarding table, include the
exportstatement:[edit routing-options forwarding-table]export;You can include this statement at the following hierarchy levels:
[edit routing-options forwarding-table][edit routing-instancesrouting-instance-namerouting-options forwarding-table][edit logical-routerslogical-router-namerouting-options forwarding-table][edit logical-routerslogical-router-namerouting-instancesrouting-instance-namerouting-options forwarding-table]You can also configure additional information about flows, such as source and destination port number and ingress interface information, to further identify them. By default, the software ignores port data when determining flows. To enable per-flow load balancing, you must set the
load-balance per-packetaction in the routing policy configuration; for more information about this action, see Routing Policy Configuration.
To include port data in the flow determination, include thefamily inetstatement at the[edit forwarding-options hash-key]hierarchy level:[edit forwarding-options hash-key]family inet {layer-3;layer-4;}You must include the
layer-3statement. If you omit thelayer-3statement, the management process removes thehash-keystatement from the configuration and the router behaves as if you specifiedlayer-3.If you include both the
layer-3andlayer-4statements, the router uses the following Layer 3 and Layer 4 information to load-balance:
- Source IP address
- Destination IP address
- Protocol
- Source port number
- Destination port number
- Incoming interface index
The router recognizes packets in which all of these
layer-3andlayer-4parameters are identical, and ensures that these packets are sent out through the same interface. This prevents problems that might otherwise occur with packets arriving at their destination out of their original sequence.This is appropriate behavior for Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) packets. For Internet Control Message Protocol (ICMP) packets, the field location offset is the checksum field, which makes each ping packet a separate "flow." There are other protocols that can be encapsulated in IP that may have a varying value in the 32-bit offset. This may also be problematic because they are seen as a separate flow.
By default, or if you specify only the
layer-3statement, the router uses the incoming interface index as well as the following Layer 3 information in the packet header to load balance: