Configure Per-Packet Load Balancing
For the active route, when there are multiple equal-cost paths to the same destination, by default, the JUNOS software chooses in a random fashion 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 chosen again, also in a random fashion.
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 is called per-packet load balancing. You can use load balancing to spread traffic across multiple paths between routers. The behavior of per-packet load balancing function varies, according to the version of the Internet Protocol ASIC in the router.
On routers with an Internet Processor ASIC, when per-packet load balancing is configured, traffic between routers with multiple paths is spread in a random fashion across the available interfaces. The forwarding table balances the traffic headed to a destination, transmitting packets 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 routers 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 recognize individual flows in the transit traffic, the router examines each of the following:
- Source IP address
- Destination IP address
- Protocol
- Source port number
- Destination port number
- Source interface index
- Type of service (ToS)
The router recognizes packets that have all of these parameters identical, and it 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.
The following steps shows how to configure per-packet load balancing:
- Define a load-balancing routing policy by including one or more
policy-statementstatements at the[edit policy-options]hierarchy level, defining an action ofload-balance per-packet:[edit]policy-options {policy-statementpolicy-name{from {match-conditions;route-filterdestination-prefix match-type<actions>;prefix-listname;}then {load-balance per-packet;}}}
- Apply the policy to routes exported from the routing table to the forwarding table. To do this, include the
exportstatement:[edit]routing-options {forwarding-table {exportpolicy-name;}}
You cannot apply the export policy to VRF routing instances.
For a list of hierarchy levels at which you can configure this statement, see the statement summary section for this statement.
Examples: Configure Per-Packet Load Balancing
Perform per-packet load balancing for all routes:
[edit]policy-options {policy statement load-balancing-policy {then {load-balance per-packet;}}}routing-options {forwarding-table {export load-balancing-policy;}}Perform per-packet load balancing for only a limited set of routes:
[edit]policy-options {policy-statement load-balancing-policy {from {route-filter 192.168.10/24 orlonger;route-filter 9.114/16 orlonger;}then {load-balance per-packet;}}}routing-options {forwarding-table {export load-balancing-policy;}}