Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

OSPF metric problem

R1 s0---OSPF---s0 R2

r1 has two loopbacks, 192.168.1.0/24 192.168.2.0/24

redistribute the two lookbacks to OSPF, right now R2 get two external OSPF routes with SAME metric, how can I give the two routes two different metrics?

I tried the below way, it doesn't work.

access-list 1 permit 192.168.1.0

access-list 2 permit 192.168.2.0

route-map net1 permit 10

match ip addr 1

set metric 100

route-map net1 permit 20

match ip addr 2

set metric 50

router ospf 100

redistribute connected route-map net1 subnet

thanks

8 REPLIES
Silver

Re: OSPF metric problem

try

redistribute connected metric-type 1 route-map net1 subnet

New Member

Re: OSPF metric problem

no.

metric-type 1 just plus something.

what I am trying is to give them exact value that I want.

just give 100 to 192.168.1.0 and 50 to 192.168.2.0

thanks

Cisco Employee

Re: OSPF metric problem

The cost of the link between R1 and R2 will always be factored in when calculating the metric to 192.168.1.0/24 and 192.168.2.0/24.

given that the link between r1 and r2 as a cost of 1, If you want the total metrics to be respectively 100 and 50, just set the external metric to be 99 and 49.

If that doesn't solve the specific issue that you are trying to solve, could you let you know what it is that you are trying to achieve.

Hope this helps,

Harold Ritter
Sr. Technical Leader
CCIE 4168 (R&S, SP)
harold@cisco.com
México móvil: +52 1 55 8312 4915
Cisco México 
Paseo de la Reforma 222 Piso 19
Cuauhtémoc, Juárez
Ciudad de México, 06600
México
New Member

Re: OSPF metric problem

Thanks.

still confused.

for the "set external metric", do you mean the "administrative distance", I mean "metric".

router ospf 100

distance ospf extern xx yy

for the loopback address, give them metrics respectivly is not useful, but maybe the routes are from other areas.

thanks

Cisco Employee

Re: OSPF metric problem

By external metric, I meant the metric that you are setting as you redistribute in OSPF. The administrative distance only has local siginficance and is used to prefer one source (static or dynamic) rather than another when a prefix is learnt from multiple sources.

Again if you told us what it is that you are trying to achieve, it would be easier to help you.

Harold Ritter
Sr. Technical Leader
CCIE 4168 (R&S, SP)
harold@cisco.com
México móvil: +52 1 55 8312 4915
Cisco México 
Paseo de la Reforma 222 Piso 19
Cuauhtémoc, Juárez
Ciudad de México, 06600
México
New Member

Re: OSPF metric problem

BB1--RIPv2---(R1 s0)--OSPF---(s0 R2 s1)--ospf---(s1 R3)

R1 learned 2 routes from BB1, 192.168.1.0/24, 192.168.2.0/24, R1 redistribute them into OSPF, by default, R3 got the external routes with metric 20, now I just want to give the two routes diffirent metric.

when I redistribute them, like

redistribute rip METRIC 100(or 50) subnet

R3 will get two routes with same metric 100(or 50), I just want to differ them.

I don't know how to do that. no special purpose.

otherwise, for "set metric 100" under "route-map", it only can be used by BGP MED? because for IGP, it seems not work.

thanks.

Cisco Employee

Re: OSPF metric problem

Sorry for the confusion. External type 2 will not take in consideration the internal metric, only the external one.

Your configuration should therefore do the job. You might have applied your route-map after the redistribution had already taken place. Just try forcing the redistribution by issuing a "clear ip ospf redistribution" and you should see 192.168.1.0/24 with a metric of 100 and 192.168.2.0/24 with a metric of 50 on R2 and R3.

Hope this helps,

Harold Ritter
Sr. Technical Leader
CCIE 4168 (R&S, SP)
harold@cisco.com
México móvil: +52 1 55 8312 4915
Cisco México 
Paseo de la Reforma 222 Piso 19
Cuauhtémoc, Juárez
Ciudad de México, 06600
México
New Member

Re: OSPF metric problem

exactly solve the problem. I never restart the routers or clear ip ospf redistribu. i guess the router remember the old metric for long time

thanks

115
Views
5
Helpful
8
Replies