IOS to Junos (I2J) Tips
IOS to Junos (I2J) Tips

Static routes with different metrics

‎03-29-2012 09:16 AM

As many of us have been sucked on how to configure static routes with different metrics on Junos as it was quite natural on IOS you have to search deep in the documentation to do it on JUNOS:

 

The equivalent of IOS:

ip route 20.0.0.0 255.255.255.0 10.0.0.1 10
ip route 20.0.0.0 255.255.255.0 10.0.0.5 20

 

Is in JUNOS:

 

set routing-options static route 20.0.0.0/24 qualified-next-hop 10.0.0.1 metric 10
set routing-options static route 20.0.0.0/24 qualified-next-hop 10.0.0.5 metric 20

 

 

Be careful the following will not do what you initially think and will not work as expected

 

 

so do not type this:

set routing-options static route 20.0.0.0/24 next-hop 10.0.0.1 metric 10

set routing-options static route 20.0.0.0/24 next-hop 10.0.0.5 metric 20

 

that leads to this:

set routing-options static route 20.0.0.0/24 next-hop 10.0.0.1
set routing-options static route 20.0.0.0/24 next-hop 10.0.0.5
set routing-options static route 20.0.0.0/24 metric 20

 

this lead to load sharing (by default only one address will be used) but not two different static routes with different metric

 

Hope this will help some of you guys

4 REPLIES 4
IOS to Junos (I2J) Tips

Re: Static routes with different metrics

[ Edited ]
‎04-03-2012 07:44 AM

Hi Loup2.

 

  Your configuration is not going to work as you believe.

 

  The qualified next hop dosnt have the effect you think.

 

   You will see in your configuration both routes with different configuration, under the "show route 20.0.0.0/24" you will see 1 active route (> route). Both will be used, but not at the same time because of your metric configuration.

 

   But, the secondary route will never be used because have highest metric, and both have next hop under the same next hop network or interface. If interface goes down both routes will be hidden. If next hop interface remains up, only primary route (lowest metric) will be used, so you will not have a backdoor or backup route.

 

   Also in the forwarding table (show route forwarding-table family inet destination-address 20.0.0.0/24" , the best metric route will be choosed as best path, so the lowest metric will be hidden and never used.

 

 

   This way you dont have a backup route, only a cosmetic configuration that looks like to have both routes.

 

 

   Your cisco configuration, dont use metric configuration, uses Administrative Distance. This is the same that Preference under Junos, but in your configuration you use Junos metrics.

 

 

   If you want ot use only 1 route at the same time, and through same outgoing interface your configuration have to be more complex.

  For example, as next hop will have to use some dynamically learned route through that next hop, and use the resolve option for your static routes.

 

   With this configuration you dont need qualified next hop, and will work as you expected.

 

   CISCO :

   interface gigabitethernet 0/0

    ip address 10.0.0.1 255.255.255.0

 

   router ospf 1

      network 10.0.0.0 0.0.0.255 area 0.0.0.0

 

   !

   ! next hops 11.11.11.11 and 12.12.12.12 will be learnd through ospf and different ospf neighbors.

   !

   ip route 20.0.0.0 255.255.255.0 11.11.11.11 10

   ip route 20.0.0.0 255.255.255.0 12.12.12.12 20

 

 

   JunOS :

 

   set interface ge-0/0/0 family inet address 10.0.0.1/24

   set routing-options protocols ospf area 0.0.0.0 interface ge-0/0/0

   set routing-options static route 20.0.0.0/24 next-hop 11.11.11.11 resolve

   set routing-options static route 20.0.0.0/24 next-hop 12.12.12.12 resolve

 

 

   For backup static routes, you have to be sure the primary route will be deleted from routing table. This is why it will be better to use a dynamic next hop under ethernet interfaces. The local ethernet could be up, but the next hop could be down and you will not detect this (a failing switch, port misconfiguration, trunk failure, etc). If not you will have to configure RPM, automation, etc, that will detect the next hop is not reachable and will modify the static route.

 

   Under serial interfaces, frame relay, pos, etc. Usually when the next hop, or neighbor router is down, the local receives a "remote alarm" or some type of indication of the remote status, so local interface goes down.

 

   Under ethernet, there is no this behaviour, you could not know if a next hop is active or not, so will always use the primary static route and will never use the backup route.

 

 

Br
Alex

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you want to say thanks, the word is Kudos!!.

Thx.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

JNCIA-JUNOS, JNCIS-ENT, JNCIS-SP, JNCIP-SP.
CCNA, CCNP, Written CCIE.
IOS to Junos (I2J) Tips

Re: Static routes with different metrics

‎04-03-2012 08:01 AM

Hi Alex,

 

thanks for your analysis,

 

I didn't gave you some information's, the next-hops 10.0.0.1 and 10.0.0.5 are on two different interfaces on two different networks:

10.0.0.0/30 and 10.0.0.4/30

 

 

I just wanted to give some information's for guys that just want to have diferent static routes with different metric.

This works and of course I know it works only if the first outgoing interface is down.

 

I know it's simple to do it with OSPF or with some other routing-protocols but the goal was presicely not to use one.

 

In many cases dynamic protocols don't scale and static routes don't consumes any resources

 

Thanks

Alain

 

IOS to Junos (I2J) Tips

Re: Static routes with different metrics

‎04-03-2012 08:39 AM

Okkkkk.

 

If you want to keep resources but have dynamic next hop, then could use rip, from each neighbor send only the next hop route (apply outgoing filtering), this way you will have a a better solution at the best price. Unlike ospf or any other protocol will not use memory or cpu.

 

 

Br
Alex

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you want to say thanks, the word is Kudos!!.

Thx.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

JNCIA-JUNOS, JNCIS-ENT, JNCIS-SP, JNCIP-SP.
CCNA, CCNP, Written CCIE.
IOS to Junos (I2J) Tips

Re: Static routes with different metrics

‎04-03-2012 08:48 AM

Hi Alex,

 

I still follow you , but when you have an hub an spoke topology with at least Thousands of spokes it's less expensive (saying you have interfaces that are able to be monitored i.e. down) to use static route than to use a routing protocol.

 

I know that RIP is still an interesting protocol especially in that topology (hub and spoke).

 

Kind regards

Alain