cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2344
Views
10
Helpful
12
Replies

Modify Cost of OSPF Route using route map and Distribute List

Hi all,

First time poster here. Hoping to benefit from your insight.

I have a test environment with a hub and spoke architecture using OSPF as the routing protocol. Each spoke and the hub connect to each other over two simulated service provider WANs with the traffic being load balanced over the two.  

What I want to be able to do is to set the cost of routes being learned by the hub from only one location over a specific interface to a higher cost without changing/ impacting the routing from the hub standpoint to other locations. The config below is how I have sought to do this. However, the routes are still being installed on the hub router with the default costs. I'm testing this in GNS3 using the C7200 image.

What am I missing? 

 

 

R2#show run | sec route-map
route-map INCREASE permit 10
match ip address prefix-list MYNET

match interface GigabitEthernet2/0
set metric 100
route-map INCREASE permit 20

 

R2#show ip prefix-list
ip prefix-list MYNET: 1 entries
seq 5 permit 21.21.21.21/32

 

R2#show run | sec router
router ospf 10
network 192.168.11.0 0.0.0.255 area 0
network 192.168.12.0 0.0.0.255 area 0
network 192.168.100.0 0.0.0.255 area 0
distribute-list route-map INCREASE in

 

R2#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override

Gateway of last resort is not set


C 192.168.11.0/24 is directly connected, GigabitEthernet2/0
L 192.168.11.4/32 is directly connected, GigabitEthernet2/0
C 192.168.12.0/24 is directly connected, GigabitEthernet1/0
L 192.168.12.4/32 is directly connected, GigabitEthernet1/0
O 21.21.21.21 [110/2] via 192.168.12.3, 00:00:02, GigabitEthernet1/0 
                        [110/2] via 192.168.11.3, 01:01:31, GigabitEthernet2/0<---- the route I want to modifiy

192.168.100.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.100.0/24 is directly connected, GigabitEthernet3/0
L 192.168.100.2/32 is directly connected, GigabitEthernet3/0

1 Accepted Solution

Accepted Solutions

Hello ,

PBR you can use the following to check the availibility of next/hop if next hop is not reachable standard destination routing is used

set ip next-hop address

set ip next-hop verify-availability

 

Hope to help

Giuseppe

 

View solution in original post

12 Replies 12

Can you draw the topology

Topology attached.

Tyson Joachims
Spotlight
Spotlight

I was able to increase the cost of the route in my test lab using all the same configurations you used. It is also strange that the routing table on R2 shows the network 21.21.21.21 without the CIDR. Can you please provide the output from the following command on R2?

show ip ospf rib

Hi
I try and also same result couldn't change Cost for specific prefix,
I use GNS3 use image 7200.
which image you use ?

I used the same image as you did, 7200.

Interesting,

Could it be a bug within GNS 3?

Here's the output of the command requested below.

 

Base Topology (MTID 0)

OSPF local RIB
Codes: * - Best, > - Installed in global RIB

* 192.168.11.0/24, Intra, cost 1, area 0, Connected
via 192.168.11.4, GigabitEthernet2/0
* 192.168.12.0/24, Intra, cost 1, area 0, Connected
via 192.168.12.4, GigabitEthernet1/0
*> 21.21.21.21/32, Intra, cost 2, area 0
via 192.168.12.3, GigabitEthernet1/0
via 192.168.11.3, GigabitEthernet2/0
* 192.168.100.0/24, Intra, cost 1, area 0, Connected
via 192.168.100.2, GigabitEthernet3/0

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello,

try the following:

clear ip ospf proc

 

However, OSPF is a link state protocol so the changes are not effective on the LSA and they are local to the node where the distribution list is configured

 

Hope to help

Giuseppe

Hi Guiseppe,

 

I tried clearing the ospf process before but unfortunately it didn't work. I am also aware that the change will not propagate to neighbouring routers. Thanks for the reminder.

Hello @vaughanreese_jones ,

in a real world network I would use PBR to achieve the desired result instead of attempting to tweak OSPF that is not so easy for its link state nature.

 

Hope to help

Giuseppe

 

 @Giuseppe Larosa 

 

I thought about that. My issue though is that if the link goes down there wouldn't be a dynamic which over to the available link.

This is why I want to adjust the cost so that in the even of failure it will dynamically use the next available route.

Hello ,

PBR you can use the following to check the availibility of next/hop if next hop is not reachable standard destination routing is used

set ip next-hop address

set ip next-hop verify-availability

 

Hope to help

Giuseppe

 

Thanks. i'll Try this

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card