Redistribute static routes in OSPF

Hello,

I would like to know if it is possible to redistribute static routes in ospf but maintainning the metric of the static route. All static routes redistributed by OSPF has the same metric (20), which is the default metric for redistributing static routes.

For example, if I have a static route with metric 1 and a static route with metric 20 I would like to redistribute them as 21 and 40 respectively.

Thanks,

Christian

type1 - ospf metric is the sum of the internal OSPF cost and the external route cost
type2 - ospf metric is equal only to the external route cost.

I use E1 for redistributing static router in OSPF. All static routes redistributed are redistributed with metric 20, the default metric for distributing static routes configured in OSPF. Indeed, I have a static route with 1 distance and another static route with 150 distance and both has a metric 20 attribute in its LSA.

Is this normal?

I would like to know if it is possible to change the metric of a redistributed static route based on the distance of the static route.

How do you redistribute your static routes, as type 1 or type 2?

As type 1.

Then it should work as you want. With type 1 total cost is sum of costs.

So Could there be a bug???

This is the static route in R1 router:

DST-ADDRESS PREF-SRC GATEWAY DISTANCE

9 ADS x.x.x.x/28 y.y.y.y.y 150

This is the LSA announced by R1 router:

instance=default area=external type=as-external id=x.x.x.x originator=z.z.z.z sequence-number=0x80000006 age=1272
checksum=0xC6E6 options=ā€œEā€ body=
netmask=255.255.255.240
forwarding-address=0.0.0.0
metric=20
route-tag=0x0
type1

This is the LSA received in R2 router:

instance=default area=external type=as-external id=x.x.x.x originator=z.z.z.z sequence-number=0x80000006 age=1272
checksum=0xC6E6 options=ā€œEā€ body=
netmask=255.255.255.240
forwarding-address=0.0.0.0
metric=20
route-tag=0x0
type1

So OSPF is not considering the distance of the static route to define the cost of the external route.
How could I change it? Thanks!

Christian