Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Configuring Per-Packet Load Balancing

In Junos OS, you enable per-flow load balancing by setting the load-balance per-packet action in the routing policy configuration. The naming may be counter-intuitive, because in Junos, per-packet load balancing is functionally equivalent to what other vendors may term per-flow load balancing.

To configure 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 logical-systems logical-system-name routing-options forwarding-table]

By default, Junos ignores port data when determining flows. 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 device 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

When all of the layer 3 and layer 4 parameters are identical, the device sends packets in the flow through the same interface, which in turn helps prevent out of order delivery for TCP and UDP flows..

Internet Control Message Protocol (ICMP) packets are handled differently because 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:

To configure per-packet random spray load balancing, include the load-balance random statement 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 at the [edit routing-options forwarding-table] hierarchy level