Configuring Per-Packet Load Balancing
To configure per-packet load balancing as described in Overview of Per-Packet Load Balancing, include the load-balance per-packet statement either as an option of the route-filter statement at the [edit policy-options policy-statement policy-name term term-name from] hierarchy level:
or at the [edit policy-options policy-statement policy-name term term-name then] hierarchy level:
To complete the configuration you must apply the routing policy to routes exported from the routing table to the forwarding table, by including the policy name in the list specified by the export statement:
You can include this statement at the following hierarchy levels:
- [edit routing-options forwarding-table]
- [edit routing-instances routing-instance-name routing-options forwarding-table]
- [edit logical-systems logical-system-name routing-options forwarding-table]
- [edit logical-systems logical-system-name routing-instances routing-instance-name routing-options forwarding-table]
By default, the software ignores port data when determining flows. To enable per-flow load balancing, you must set the load-balance per-packet action in the routing policy configuration.
To include port data in the flow determination, include the family inet statement at the [edit forwarding-options hash-key] hierarchy level:
If you include both the layer-3 and layer-4 statements, 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
- IP type of service
The router recognizes packets in which all of these layer-3 and layer-4 parameters 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 these protocols are seen as a separate flow.
With M Series (with the exception of the M120 router) and T Series routers, the first fragment is mapped to the same load-balanced destination as the unfragmented packets. The other fragments can be mapped to other load-balanced destinations.
For the M120 router only, all fragments are mapped to the same load-balanced destination. This destination is not necessarily the same as that for unfragmented packets.
By default, or if you include only the layer-3 statement, the router uses the incoming interface index as well as the following Layer 3 information in the packet header to load balance traffic:
- Source IP address
- Destination IP address
- Protocol
By default, IP version 6 (IPv6) packets are automatically load-balanced based on the following Layer 3 and Layer 4 information:
- Source IP address
- Destination IP address
- Protocol
- Source port number
- Destination port number
- Incoming interface index
- Traffic class
Per-Packet Load Balancing Examples
Perform per-packet load balancing for all routes:
Perform per-packet load balancing only for a limited set of routes: