Junos per packet load balancing

If you have two multiple equal cost paths to the same destination, JunOS behavior is to pick up one of the next-hops and use that one. For example in the following scenario, Junos keeps sending the packets via the ge-0/0/0.41 interface.

root@R4> show route

inet.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both      *[Static/5] 01:01:06
                    > to via ge-0/0/0.41
                      to via ge-0/0/0.40

but you can change this behavior ;

1) Write a policy statement

root@R4# show policy-options
policy-statement load_balance_per_packet {
    then {
        load-balance per-packet;

2) Export this statement

[edit routing-options]
root@R4# show
forwarding-table {
    export load_balance_per_packet;

and here how it works;

root@R4> traceroute no-resolve
traceroute to (, 30 hops max, 40 byte packets
 1  3.825 ms  3.986 ms  3.997 ms
 2  3.992 ms  3.974 ms  4.001 ms
 3  5.963 ms  6.071 ms  3.974 ms

root@R4> traceroute no-resolve
traceroute to (, 30 hops max, 40 byte packets
 1  3.956 ms  3.986 ms  3.933 ms
 2  3.999 ms  4.073 ms  5.929 ms
 3  8.011 ms  7.949 ms  7.992 ms

I won’t lie it didn’t work this way when I tried this traceroute command first time. It worked actually but instead of IP address on the first hop I was seeing address which surprised me. Then I noticed that Junos is using the lowest IP address ( on the configured interface as the source address and to change this behavior I type the following command on the other router ;

#set interfaces ge-0/0/1 unit 40 family inet address primary

This command made this IP address primary because of which the expected output above displayed.

About: rtoodtoo

Worked for more than 10 years as a Network/Support Engineer and also interested in Python, Linux, Security and SD-WAN // JNCIE-SEC #223 / RHCE / PCNSE

3 thoughts on “Junos per packet load balancing”

  1. Hi,

    I am not really sure if per packet load balancing is being supported on SRX devices.
    It looks like what you have achieved here is “per flow load balancing”.

    Please refer the doc link and supported platforms, as M,T & PTX series.


    Your blog has really good articles, appreciate your hardwork ! 🙂

    Can you please confirm the above query ?



  2. Hi Sandeep,
    I think you are right on that. Because configuration says it is per packet I always do this. I should have done the test with a TCP traffic to show that it is actually flow based. Thanks for pointing it out.

  3. does this type of configuration work for dual ISP ? A single SRX have two different ISPs, ISP A and ISP B. Will this configuration load balance the internet traffic destioned for 0.0.0/0 network with single source network say,

You have a feedback?

Discover more from RtoDto.net

Subscribe now to keep reading and get access to the full archive.

Continue reading