08-07-2023
01:13 PM
- last edited on
08-10-2023
04:12 AM
by
Translator
Hey there,
I have situation where I need to redistribute static routes into OSPF and apply a cost to prefer one path over another, but I don't really know how admin distance of a static route being
redistributed
is going to affect OSPF.
My situation is this. Lets say I have a computer with an IP of 192.168.10.1. This computer connects to an AN which then is trunked over to a DN that hosts that subnet. That DN has an uplink to CN1 and CN2 for redundancy. CN1 has an uplink to a boundary type device that has an IP of 192.168.5.5 /28. CN2 goes up to a different boundary type device, and that device's IP is 192.168.5.20 /28.
192.168.10.1 (the computer) can go through either CN1 or CN2 to hit the boundary. The two CNs advertise OSPF routes to each other. I would like to put a static route on CN1 that send traffic from 192.168.10.1 to 192.168.5.5. This static route needs to be
redistributed
into OSPF as the primary route. CN2 will send the computer to 192.168.5.20 if 192.168.5.5 is detected as down. How can I configure this?
CN1:
router ospf 1
redistribute static metric-type 1 subnets
(I'm unsure if this command is applied correctly)
ip route
192.168.10.1 255.255.255.255 192.168.5.5 (I'm unsure what to put for distance metric here)
CN2:
router ospf 1
redistribute static metric-type 1 subnets
(I'm unsure if this command is applied correctly)
ip route
192.168.10.1 255.255.255.255 192.168.5.20 (I'm unsure what to put for distance metric here)
-----
Any help would be appreciated.
Solved! Go to Solution.
08-07-2023
01:35 PM
- last edited on
08-10-2023
04:48 AM
by
Translator
Hello,
When
redistributing
routes the metric is taken over by the
redistributed
protocol. So if you put a metric or AD on a
static route
its overwritten during
redistribution
to the protocols metric. For OSPF this is a metric type-2 (E2) and a cost of 20. You can influence this with a
route map
and
prefix-list
or within the
redistribution
statement itself.
You can accomplish this a couple ways.
1. Leave the matric type as Type-2 for both routes and adjust the cost during
redistribution
to prefer CN1. (this is the example demonstrated below)
2. Configure CN1 route as type-1 when being
redistributed
and leave CN2
static route
as the
default Type-2 route
. OSPF chooses Type-1 over Type-2 routes.
CN1:
router ospf 1
redistribute static subnets metric <lower number than CN2>
ip route 192.168.10.1 255.255.255.255 192.168.5.5 (I'm unsure what to put for distance metric here)
CN2:
router ospf 1
redistribute static subnets metric <higher number than CN1>
ip route 192.168.10.1 255.255.255.255 192.168.5.20 (I'm unsure what to put for distance metric here)
*Note: if you have multiple
static routes
and you only want those specific ones
redistributed
in you will need to create a
prefix list
identifying them and applying it to a
route-map
. Then you can configure the
route-map
as part of the
redistribution
like the example below:
redistribute static subnets route-map OSPF metric
<#>
Make sure the
route-map
references the
static routes
you want to
redistribute.
Hope that helps
-David
08-07-2023
01:35 PM
- last edited on
08-10-2023
04:48 AM
by
Translator
Hello,
When
redistributing
routes the metric is taken over by the
redistributed
protocol. So if you put a metric or AD on a
static route
its overwritten during
redistribution
to the protocols metric. For OSPF this is a metric type-2 (E2) and a cost of 20. You can influence this with a
route map
and
prefix-list
or within the
redistribution
statement itself.
You can accomplish this a couple ways.
1. Leave the matric type as Type-2 for both routes and adjust the cost during
redistribution
to prefer CN1. (this is the example demonstrated below)
2. Configure CN1 route as type-1 when being
redistributed
and leave CN2
static route
as the
default Type-2 route
. OSPF chooses Type-1 over Type-2 routes.
CN1:
router ospf 1
redistribute static subnets metric <lower number than CN2>
ip route 192.168.10.1 255.255.255.255 192.168.5.5 (I'm unsure what to put for distance metric here)
CN2:
router ospf 1
redistribute static subnets metric <higher number than CN1>
ip route 192.168.10.1 255.255.255.255 192.168.5.20 (I'm unsure what to put for distance metric here)
*Note: if you have multiple
static routes
and you only want those specific ones
redistributed
in you will need to create a
prefix list
identifying them and applying it to a
route-map
. Then you can configure the
route-map
as part of the
redistribution
like the example below:
redistribute static subnets route-map OSPF metric
<#>
Make sure the
route-map
references the
static routes
you want to
redistribute.
Hope that helps
-David
08-09-2023
10:11 AM
- last edited on
08-10-2023
04:48 AM
by
Translator
Thank you. I'm looking into
ip prefix-lists
and
route-maps
now.
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