cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
272
Views
2
Helpful
9
Replies

OSPF route preference for 2 subnets

wgranada
Level 1
Level 1

Good day All,

I have 2 N9K-C93108TC-FX3P running ospf (rtrA and rtrB) right now the way ospf is working is that all the routes are currently going over rtrB.  I have 2 subnets 

10.4.1.0/24

10.4.2.0/24

I don't want these 2 to go over rtrB but instead need them to go over rtrA. I was thinking of creating a route map for rtrB as follows

ip prefix-list Non-Trd-Taf seq 5 permit 10.4.1.0/24

route-map OSPF-PREF permit 10
match ip address prefix-list Non-Trd-Taf
set metric 100

rtrB

Interface Ethernet1/54/2
distribute-list route-map OSPF-PREF in

so if someone is trying to go to the 10.4.1.0 subnet it will be redirected to rtrA, Not sure if this is the correct way to do this but iff you have a better way please let me know.

Thank you in advance!!!

Warren

9 Replies 9

Enes Simnica
Level 4
Level 4

hello. will try to be short with my answer. Ur route-map approach should work to influence OSPF path selection by making routes via rtrB less preferred. and yet, however a simpler method would be to just adjust the OSPF interface cost on rtrB. Try this on rtrB's OSPF interface:

int e1/54/2
ip ospf cost 100

This increases the metric for all routes through this interface, making rtrA's path more attractive by comparison. The advantage is it doesn't require maintaining prefix-lists or route-maps - just a single interface command. DOnt forget, before making changes, check current metrics with "show ip ospf interface" and verify the path change afterward with "show ip route 10.4.1.0". If u only want to affect specific prefixes, then ur original route-map solution is the way to go.

hope it wasnt tooooo long, and hope it helps..

 

-Enes

more Cisco?!
more Gym?!



If this post solved your problem, kindly mark it as Accepted Solution. Much appreciated!

Thank you Enes but I want to keep everything routing as is just only need the 10.4.1.0 to go over rtrA but everything else go over rtrB that is why I was thinking route-maps

Traffic come to RtA meaning remote peer select RtA as best path.

So how your ospf area config

Idea will be 

If you use area and RtA and RtB is ABR then 

Make RtA send area range 

Make RtB send prefix 

Remote Peer (for example RtC) will always select longest prefix match and hence traffic will direct to RtB

This how you do it.

MHM

Hi MHM

so basically I have the following on my nexus 9k

router ospf 1
auto-cost reference-bandwidth 100000 Mbps

Ethernet1/54/2 is up, line protocol is up
IP address 10.10.104.2/30
Process ID 1 VRF default, area 0.0.0.0
Enabled by interface configuration
State P2P, Network type P2P, cost 10
Index 11, Transmit delay 1 sec
1 Neighbors, flooding to 1, adjacent with 1
Timer intervals: Hello 10, Dead 40, Wait 40, Retransmit 5
Hello timer due in 00:00:05
No authentication
Number of opaque link LSAs: 0, checksum sum 0
Interface ospf state change count: 1

Give me two hours' I will share lab explain my idea with more detail 

MHM

Richard Burts
Hall of Fame
Hall of Fame

Warren

I am not clear about much of your environment and what you want to accomplish. But if you are trying to make sure that 2 subnets will go using rtA I would suggest that Policy Based Routing would be a good way to accomplish this.

HTH

Rick

Hi Richard

Yes that is what I wanted to do is to keep everything routing the way it is just have those 2 subnets go over rtrA, let me look into Policy Base Routing then.

Thank you!

M02@rt37
VIP
VIP

Hello @wgranada 

With your OSPF config, the router choose the path with the lowest cost to a destination. You should modify the metric when rtrB advertises those routes...not when it receives them.

So why ?
Applying a dostribution list or route-map on the inbound side of OSPF on rtrB does not influence what other routers learn from rtrB _ it affects only what rtrB itself installs, which is not your goal...

So instead, you should control how rtrB advertises those two routes, making them less preferable than the same routes from rtrA.

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.