1

Let's say, that a Juniper router learns a 10.10.10.46/31 prefix from two different OSPF routers:

root@r1> show route 10.10.10.46/31 protocol ospf

inet.0: 10037 destinations, 50063 routes (10034 active, 0 holddown, 3 hidden)
+ = Active Route, - = Last Active, * = Both

10.10.10.46/31   *[OSPF/10] 03:28:51, metric 300
                    >  to 10.10.10.51 via ge-0/0/0.2
                       to 10.10.10.52 via ge-0/0/0.2

root@r1>

Load-balancing is not enabled and according to show route forwarding-table destination 10.10.10.46/31 table default the next hop in FIB is indeed 10.10.10.51:

root@r1> show route forwarding-table destination 10.10.10.46/31 table default
Routing table: default.inet
Internet:
Destination        Type RtRef Next hop           Type Index    NhRef Netif
10.10.10.46/31   user     0 10.10.10.51      ucst      601     6 ge-0/0/0.2

root@r1>

Why did router pick 10.10.10.51 and not 10.10.10.52? Does the router pick the next hop by random?

2
  • If you can post the output of "show route forwarding-table ..." I can provide an answer. The > is... cosmetic in a sense. Commented Jun 13 at 18:10
  • @JordanHead I added the output of "show route forwarding-table ...".
    – Martin
    Commented Jun 14 at 7:44

2 Answers 2

2

When there are multiple routes for a destination with the same prefix length and cost/metric, the one with the lower interface index is selected. If the same interface is used, the route with the lower gateway IP address is selected.

If you want all equal-cost routes to be used you need to enable equal-cost multi-path routing (ECMP). Make sure that you understand the impact on your traffic (packets may arrive out of order) and on the reverse traffic and its policies.

1

Okay, multiple things to consider here for Junos.

In order to load balance, Junos requires you to configure a forwarding-policy. When this is not configured, next-hop is selected using a hashing algorithm that looks at certain aspects of the packet header. It varies slightly per version, platform, and traffic type (i.e., IP, MPLS, GRE, etc.)

If you look at your example output of the forwarding table, you'll see the "Type" set as "ucst" (unicast). This basically means that for that destination there is a single next-hop that is used (as expected in your case).

Now, with that said I have literally never seen a deployment where you don't want to use ECMP, so if you configure something like:

set policy-options policy-statement LB-ECMP then load-balance per-packet
set routing-options forwarding-table export LB-ECMP

The result of your output will change the next-hop type to "ulst" (unicast list) with all available next-hops under it. At that point (despite the "per-packet" nomenclature) traffic flows will hash across the links.

Another thing to consider is that even after you configure such a policy, the "show route" command will still only show a single > but it will actually be using all of the paths. In essence, don't be alarmed if the > doesn't change as you run the command for different destinations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.