Routing

Expand all | Collapse all

route preference and route metric ?

  • 1.  route preference and route metric ?

    Posted 12-31-2011 10:04

    what is the difference between a route metric and a route preference in Junos and does metric has any effect choosing the active route ?



  • 2.  RE: route preference and route metric ?

     
    Posted 12-31-2011 19:47

    Hi,

     

    The routes advertised by a protocol are associated with route preference. This value helps in choosing the route from most reliable protocol. For instance say you have 200.3.56.8/32 route being received by OSPF (internal) as well as by RIP.

     

    In this case, theoretical OSPF would be the obvious choice. In JUNOS, a route from OSPF(internal) would have preference of 10 while the same route from RIP would have 100. The lowest preference would be used as active route in routing table.

    Refer below for preference values of all protocols:

    http://www.juniper.net/techpubs/software/junos/junos94/swconfig-routing/default-route-preference-values.html

     

    Now, in case if you still have same routes coming from different neighbors but with same protocol, then you will select the route based on the route metric. The one with least metric would be active in routing table.

     

    Regards

    Surya Prakash



  • 3.  RE: route preference and route metric ?

    Posted 02-07-2012 06:42

    Hi,

     

    On route metric,

     

    A) set routing-instances To_Z routing-options static route 0.0.0.0/0 qualified-next-hop 172.16.0.1 metric 6
    B) set routing-instances To_Z routing-options static route 0.0.0.0/0 qualified-next-hop 172.16.0.2 metric 5

     

    Which will take a higher priority? B) right?

     

     

     

     

     



  • 4.  RE: route preference and route metric ?

    Posted 02-07-2012 08:24

    The answer is "it depends" Smiley Happy

    if 172.16.0.1 and 172.16.0.2 are both reachable via direct routes, then routeB wins.

    If one or both next-hop IPs are not reachable via direct routes and "resolve" knob is not configured (it isn't if the config below is the complete one), then it could be A or B or none.

    HTH

    Rgds
    Alex



  • 5.  RE: route preference and route metric ?

    Posted 02-08-2012 18:31
    Hi aarseniev,

    Thanks for the advise.
    Can check with you what is "resolve" knob.
    Is there a kb document link on this?


  • 6.  RE: route preference and route metric ?

    Posted 02-09-2012 07:49

    The "resolve" knob is used when your specified next hop is not directly reachable (indirect next-hop) - by default that route would not be considered. If you append your route with that option (route xx.xx.xx.xx next-hop xx.xx.xx.xx resolve) AND if there is another route that will allow traffic to get to that next hop then it is an a valid route entry.

     



  • 7.  RE: route preference and route metric ?

    Posted 01-07-2014 18:32

    Hello,

     

    Please, help me, the documentation says:

     

    --

    Metric The metric is a preference number, with the lowest number having the
    highest priority.All directly connected networks have a metric of zero. All static
    routes have a default metric of one.There may be cases in which you need to add
    the same route twice, the preferred route with the lower metric and the less preferred
    route with the higher metric. If the first route is unavailable, the firewall will
    use the next route.

    --

     

    "If the first route is unavailable...", how does Juniper know this? Just if the interface is down?

     

    I want it to use the next route(metric 1 to metric 2) if the gateway is unavailable.

    (In my case, when the gateway is unavailable, the interface is not down)

     

     

    I already read about track IP, but it's for HW failover, and not route. So I can't use it to ping the gateway, and disable the route when it's not responding.

     

    I don't believe that the only way to do this is configuring a tunnel interface.

     



  • 8.  RE: route preference and route metric ?

    Posted 12-11-2019 06:16

    I'd say that the right process follow the RIB in order to store the active path in the FIB.

    1) Select the lowest Route Preference.

    2) If we have 2 routes with same route preference, Junos will check the secondary route preference:

    example: " set routing-options static route 192.168.47.0/24 qualified-next-hop 192.168.2.2 preference <value>"

    3) If we have 2 routes with same route preference, let's check the metric.

     

    Best regards,