Description

This article explains about the basic JUNOS route selection process and its hierarchy, when multiple routes are available for the same destination.

Solution

When a destination has multiple active routes (e.g., direct, static, and dynamic routes), Junos OS follows a specific route selection process based on route preference (administrative distance) and other attributes.

 

Following attributes will be taken into account to determine the best route:

 

1) Compare Route Preference (Administrative Distance) >> Lowest preference value is preferred.
2) Compare Route Metric (Cost) >> If two routes have the same preference, the route with the lower metric (cost) is selected.
3) Compare AS Path (For BGP Routes) >> Shorter AS Path is preferred.
4) Compare Next-Hop Reachability >> The next-hop must be reachable for the route to be installed in the forwarding table.
5) Load Balancing (ECMP) >> If multiple equal-cost routes exist (same preference, metric, and next-hop reachability), Junos may install multiple next-hops for load balancing.

 

Route selection hierarchy:

 

1) Directly Connected Routes (Interface Routes): 
                  
            These are the most preferred routes because they are directly connected to the router's interfaces. Preference value of zero (0).


2) Static Routes:

             

           Manually configured routes by the administrator, having preference value of 5.


3) Dynamic routes or routing protocol derived routes:


               Preference values varies based on the type of protocol that is configured on the network:
                       
                   BGP: 170 (External) / 200 (Internal)
                   OSPF: 10 (Internal) / 150 (External)
                   IS-IS: 15 (L1) / 18 (L2)

 

Example output: (* indicates active route in the routing table)

 

root@switch> show route 192.168.1.0/24

192.168.1.0/24     *[Direct/0] 00:00:05 
                    > via ge-0/0/0.0

root@switch> show route 192.168.1.0/24

192.168.1.0/24     *[Direct/0] 00:00:15
                    > via ge-0/0/0.0
                   [Static/5] 00:00:10
                    > via 10.1.1.1  >>   Though static was configured, direct route is preferred.

root@switch> show route 192.168.1.0/24

192.168.1.0/24     *[Direct/0] 00:00:30
                    > via ge-0/0/0.0
                   [Static/5] 00:00:20
                    > via 10.1.1.1
                   [OSPF/10] 00:00:15
                    > via 10.1.1.2

If the interface is down and direct route is removed, static route is installed as active.

 

root@switch> show route 192.168.1.0/24

192.168.1.0/24     *[Static/5] 00:00:05
                    > via 10.1.1.1
                   [OSPF/10] 00:00:15
                    > via 10.1.1.2


               

Modification History

2025-02-11: Categories added

2025-02-08 : Article Created

Related Information

https://www.juniper.net/documentation/us/en/software/junos/static-routing/topics/concept/protocol-independent-routing-overview.html