cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2785
Views
4
Helpful
16
Replies

change the cost of a learned OSPF route

Samuel
Level 1
Level 1

Im having issues with changing the cost of a learned ospf route. the route map pics up the route but the set metric command isnt working. Am I missing something?

 


ip prefix-list DEFAULT_ROUTE seq 5 permit 0.0.0.0/0

route-map test permit 10
match ip address prefix-list DEFAULT_ROUTE
match interface GigabitEthernet0/1.99
set metric 5

router ospf 1
priority 0
redistribute eigrp 1 subnets
network 192.168.X.X 0.0.0.X area X.X.X.X
distribute-list route-map test in

 

16 Replies 16

Harold Ritter
Level 12
Level 12

Hi @Samuel  ,

The "distribute-list in" ospf feature allows you to allow or deny an ospf route to be installed in the RIB, but it doesn't allow you to change the metric.

Regards,

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

Thanks for that. What would be the best way to influence this route on my local router? I need the metric to be set higher than another one.

Screenshot (533).pngScreenshot (534).png

Hi @Samuel  ,

Can you please tell us more about what you are trying to achieve? I suppose that you have another default route being learnt via ospf as well and you are trying to favour one over the other. You would normally do that on the route originator not on the receiver.

Regards,

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

we have 2 fortigate firewalls with static routes being redistributed into OSPF. One firewall redistributes with a higher cost than the other. What I would like to do is to change the cost of one of those default routes for one of my downstream routers so that it can prefer the higher cost one.

Hi,

OSPF is link state protocol, does not work as we expect in EIGRP/RIP.

But you can use E1 type external route advertisement, so path to ASBR (firewall in your topology) is also considered. You should use value, so that every routers chooses proper firewall (primary) in your network. However, for the device that you want to go through secondary one (higher cost), you can increase OSPF interface cost on downstream router. Note, that this will have impact not only to default route, but for others as well.

I tried to use distance command with source and access-list (prefix) matching, it changes distance, but does not have effect within the same OSPF process.

HTH,
Please rate and mark as an accepted solution if you have found any of the information provided useful.

If i were to change the cost on the interface, it would affect both routes and still not get the desired outcome.

Hi @Samuel  ,

Is the router directly connected to both FW? Are the default routes received as E1 or E2?

Regards,

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

The default routes are e2. The router is ospf neighbors with both firewalls in the same broadcast segment. This router is a secondary dmvpn hub. We also want it to pass traffic via our secondary internet hence the reason to alter the cost.

using redistrubte with route-map (this will filter the prefix) and then add metric 
check above lab

Am I in same way or in different way'

I see in original post redistrubte from eigrp into ospf and I think I answer this.

But I see talking about FW and local route !!

Can I see at least topolgy??

Opsf select prefix with specific order'

When can change this order with 

Run multi process 

Run multi routing topolgy via vrf

Run different area ( some cases can solve with config specific area)

But all above and what I can suggest depend on topolgy.

Waiting your reply 

Samuel
Level 1
Level 1

So guys Ive decided to let both default routes have the same cost, making both default routes present in my downstream routers. I only hope that this will have the desired effect of load sharing internet traffic between the two firewalls.

Thanks everyone who chipped in.

But fw and multi path' I think you will face asymmetric traffic issue'.

I recommend use only one path

Review Cisco Networking for a $25 gift card