Configuring Per-Prefix Load Balancing
By default, Junos OS uses a hashing method based only on the destination address to elect a forwarding next hop when multiple equal-cost paths are available. As a result, when multiple routers or switches share the same set of forwarding next hops for a given destination, they can elect the same forwarding next hop.
You can enable router-specific or switch-specific load balancing by including a per-prefix hash value. However, this method applies only to indirect next hops. In other words, when we have a route with a protocol next hop that is not directly connected, it can be resolved over a set of equal-cost forwarding next hops. Only in this case, we use the hashing algorithm to elect a forwarding next hop. An example of this is routes learned from an IBGP neighbor. The protocol next hop for those routes might not be directly reachable and would be resolved through some IGP or static routes. The result could be a set of equal-cost forwarding next hops to reach that protocol next hop. Per-prefix load balancing thus leads to better utilization of the available links.
To configure per-prefix load balancing, include the load-balance
statement at the [edit forwarding-options]
hierarchy
level:
[edit forwarding-options] load-balance { indexed-load-balance; per-prefix { hash-seed number; } }
To enable per-prefix load balancing, you must include the hash-seed number
statement. The range
that you can configure is 0 (the default) through 65,535.
If no hash seed is configured, the elected forwarding next hop is
the same as in previous releases.
If you notice an issue with the load-balance
distribution, try including the indexed-load-balance
statement
at the [edit forwarding-options load-balance]
hierarchy
level. This statement causes the creation of a nexthop structure that
is both a function of the hash, and a function of the low-order bits
of the IP address.
For MPC line cards in MX routers, indexed-load-balance
has been superseded by an internal hash-rotation mechanism to reduce
polarization.
Including the indexed-load-balance
statement
causes an increase in memory usage on the device.
indexed-load-balance;