Ethernet Switching
Reply
Trusted Contributor
IOS2JunOS
Posts: 92
Registered: ‎10-17-2008
0

how do i change ospf route metrics??

hello all- I have two Ex4200 switches connected to each other and running ospf. I would like to change metric on few routes when sent from switch1 to switch2 and while keeping default metrics on all other routes. I tired export policy from the  advertising switch but it did not work..then i tried import policy on the receiveing switch..which also did not work. How can i accomplish this. I tried the following policy

 

policy-statement test-subnets {
    term test-subnets {
        from {
            route-filter 10.1.0.0/23 exact;
            route-filter 10.1.16.0/23 exact;
        }
        then {
            metric 5;
            accept;
        }
    }
    then accept;
}

 

applied it as export and then also tried it as import on the receving switch...TIA

Recognized Expert
Dominik
Posts: 392
Registered: ‎01-05-2008
0

Re: how do i change ospf route metrics??

Hi,

 

you must not alter OSPF metrics with the help of policies because that would break the SPF algorithm. The metric is calculated based on the costs of a specific interface by dividing the reference bandwidth (100 MBit) by the interface bandwidth with always rouding up to 1. So Gigabit interfaces get a cost of 1.

 

In case that these two /23 routes come from directly connected interfaces, you can modify the interface cost (metric) by using this command:

 

set protocols ospf area x interface ge-a/b/c.0 metric y

 

You can also modify the reference bandwidth by "set protocols ospf reference-bandwidth".

 

Regards,

Dominik

JNCIE et al.

--
The Axiom of Choice is obviously true, the well-ordering principle obviously false, and who can tell about Zorn's lemma?
Trusted Expert
SSHSSH
Posts: 601
Registered: ‎11-21-2009
0

Re: how do i change ospf route metrics??

Hi  Dominik , but what if he wanted to chage the metric for specific routes ? your method will change metric for all routes

Recognized Expert
Dominik
Posts: 392
Registered: ‎01-05-2008
0

Re: how do i change ospf route metrics??

Hi,

 

this came also to my mind, but after submitting my post. :smileyhappy: As he also posted the question under the Routing topic I did not supplement a clarification.

 

Regards,

Dominik

JNCIE et al.

--
The Axiom of Choice is obviously true, the well-ordering principle obviously false, and who can tell about Zorn's lemma?
Copyright© 1999-2013 Juniper Networks, Inc. All rights reserved.