Log in to ask questions, share your expertise, or stay connected to content you value. Don’t have a login? Learn how to become a member.
I saw many examples showing qualified-next-hop with preference in static route, but I never seen using metric. Why?
Because we are running OSPF and also use static route qualified-next-hop metric for choosing the outbound next hop, it seems to work fine with the below example. But not sure if it works perfectly. Need some guidance.
set routing-options static route 10.192.1.1/32 qualified-next-hop 10.1.212.2 metric 100set routing-options static route 10.192.1.1/32 qualified-next-hop 10.1.212.6 metric 1000
- Also, can we configure it with two metrics? Because most example shows only one preference or metric configured is sufficient.
A metric is used to tell us how many hops that
are supposed to be exact. If this isn't known we
want to stay away from this. However if you can
get in the ballpark and don't go over you are
in good shape. A cost calculation, or similar
should be done to get a metric. Preferences in
the case of ospf are your internal(I think), but
that last hop does exit(if internet). But metric
isn't just ospf. I would say ospf likes to make
it's own decisions. So preference is needed.
metric is not so much for ospf I would say. It
is for general protocol.
Preference and metric in static routes have different uses. While preference will be used to select which next-hop will be preferred for the static route destination. While the metric parameter is defined to control the metric of the route when it is redistributed in OSPF.
In your scenario, as both the qualified next-hops have the same preference (default 5 for static routes), the next-hop 10.1.212.2 will be selected in the routing-table because of its lower metric value.
If you configure your static route with both metric and preference, then the preference value will decide which next-hop will be chosen for the destination. The metric associated with that next-hop will be the OSPF metric when redistributed into OSPF. If the lower preference next-hop route is withdrawn from the routing table (due to the egress next-hop being unavailable), the next-hop with the next lower preference value will be chosen. The OSPF metric for this route will now be according to the configured metric value for this next-hop, which is the 2nd best next-hop for the static route (due to higher preference value as compared to the first one).
Hope this helps. Let me know if you want to see the configuration with examples.