Routing
Reply
Contributor
abdullah_marji@emitac.com.jo
Posts: 39
Registered: ‎12-21-2010
0

route preference and route metric ?

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

Trusted Expert
Surya
Posts: 302
Registered: ‎08-25-2009

Re: route preference and route metric ?

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-val...

 

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

Trusted Contributor
michael.saw
Posts: 1,048
Registered: ‎09-26-2011
0

Re: route preference and route metric ?

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?

 

 

 

 

 

Thanks!

Michael
JNCIA-JUNOS, JNCIS-ENT/SEC, JNCIP-ENT
(CCNA, ACMP, ACFE, CISE)
"http://www.thechampioncommunity.com/"
CONNECT EVERYTHING. EMPOWER EVERYONE.
Share & Learn. Knowledge is Power.

"If there's a will, there's a way!"
Distinguished Expert
aarseniev
Posts: 1,679
Registered: ‎08-21-2009
0

Re: route preference and route metric ?

The answer is "it depends" :smileyhappy:

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

___________________________________
Accept as Solution = cool !
Accept as Solution+Kudo = You are a Star !
Trusted Contributor
michael.saw
Posts: 1,048
Registered: ‎09-26-2011
0

Re: route preference and route metric ?

Hi aarseniev,

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

Michael
JNCIA-JUNOS, JNCIS-ENT/SEC, JNCIP-ENT
(CCNA, ACMP, ACFE, CISE)
"http://www.thechampioncommunity.com/"
CONNECT EVERYTHING. EMPOWER EVERYONE.
Share & Learn. Knowledge is Power.

"If there's a will, there's a way!"
Distinguished Expert
muttbarker
Posts: 2,372
Registered: ‎01-29-2008
0

Re: route preference and route metric ?

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.

 

Kevin Barker
JNCIP-SEC
JNCIS-ENT, FWV, SSL, WLAN
JNCIA-ER, EX, IDP, UAC, WX
Juniper Networks Certified Instructor
Juniper Networks Ambassador

Juniper Elite Reseller
J-Partner Service Specialist - Implementation

If this worked for you please flag my post as an "Accepted Solution" so others can benefit. A kudo would be cool if you think I earned it.
New User
dlalaina
Posts: 4
Registered: ‎01-07-2014
0

Re: route preference and route metric ?

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.

 

Copyright© 1999-2013 Juniper Networks, Inc. All rights reserved.