07-06-2023 03:29 AM
Hi everyone,
I would like to configure a specific OSPF route in my router. I want it to take precedence over a better static route or a route with a lower administrative distance. Is there any way to achieve this?
Any help would be greatly appreciated.
Thank you!
07-06-2023 03:48 AM
Hi @Cisco Enthusiast ,
If you can inject a more specific route into OSPF, it will take precedence (longest prefix match) over any other routes in the routing table.
Regards,
07-06-2023 03:59 AM
Sorry you need either config vrf
Or change static route Ad to be more than ospf ad 110
07-06-2023 04:38 AM
The goal is to configure a network with three routes: one specific route (10.5.0.0/16), one global route (10.5.0.0/24), and a third route (10.5.1.0/24). The objective is to observe the behavior in the routing table regardless of the routing protocol being used.
07-06-2023 06:27 AM
So your goal is to see overlapping prefixes in the route table?
Unlike dynamic routing protocols, which within their own topology generally don't show overlapping prefixes (as overlaps tend to be summaries/aggregates), you can easily overlap using statics, and on the same L3 device, to mix in with OSPF, just make ADs the same.
07-06-2023 11:37 AM
In prior message, I mentioned overlapping prefixes, within the same dynamic routing protocol topology normally would only be done with summaries/aggregates. I wasn't really sure what would happen if you did this with "real" networks.
Well, I tried in in PT (which might not be accurate), and what PT did, when I activated the 10.5.0.0/16 it converted 10.5.0.0/24 into a like network.
I.e. from:
Router#sh 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, E - EGP
i - IS-IS, 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
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 2 subnets
O 10.5.0.0/24 [110/2] via 192.168.2.2, 00:00:01, GigabitEthernet0/0/1
O 10.5.1.0/24 [110/3] via 192.168.2.2, 00:06:46, GigabitEthernet0/0/1
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/30 is directly connected, GigabitEthernet0/0/0
L 192.168.1.1/32 is directly connected, GigabitEthernet0/0/0
192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.2.0/30 is directly connected, GigabitEthernet0/0/1
L 192.168.2.1/32 is directly connected, GigabitEthernet0/0/1
to:
Router#sh 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, E - EGP
i - IS-IS, 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
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O 10.5.0.0/16 [110/2] via 192.168.1.2, 00:00:05, GigabitEthernet0/0/0
[110/2] via 192.168.2.2, 00:00:05, GigabitEthernet0/0/1
O 10.5.1.0/24 [110/3] via 192.168.2.2, 00:08:04, GigabitEthernet0/0/1
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/30 is directly connected, GigabitEthernet0/0/0
L 192.168.1.1/32 is directly connected, GigabitEthernet0/0/0
192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.2.0/30 is directly connected, GigabitEthernet0/0/1
L 192.168.2.1/32 is directly connected, GigabitEthernet0/0/1
I've attached the PT file.
07-06-2023 06:55 AM
you need to test longest match behave of router ?
any packet have IP but dont have mask in IP header
so the packet receive from Router with
10.5.1.1
we have three routes
10.5.0.0 1111.11111.0000.0000 <<-mask
10.5.0.0 1111.1111.1111.0000
10.5.1.0 1111.1111.1111.0000
NOW
10.5.1.1 will hit two route
10.5.0.0 1111.11111.0000.0000 <<-mask
10.5.1.0 1111.1111.1111.0000
which one have longest match sure 10.5.1.0
Q why we select
10.5.0.0 1111.11111.0000.0000 <<-mask
not
10.5.0.0 1111.1111.1111.0000 ?
the answer is third oct is 11111 which meaning care and the value must be ""0"" not ""1""
so router will not select 10.5.0.0 1111.1111.1111.0000
Q if packet have 10.4.0.1 ?
NONE will select !! why ?
you must know that for each route in RIB the router match care bit subnet value with packet and this value MUST be match
10 is match for three routes above
4 not match and routes above
07-06-2023 04:25 AM
I believe (???) if the OSPF route is an external, when it's redistributed into OSPF you can override the default AD for it.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide