As far as I can tell, it’s impossible to set costs on external routes injected into a OSPF network by a ASBR. All external routes of a given type that are redistributed (connected, static, other ospf, bgp, rip) are only able to have a global cost set on an ospf instance level. In addition, I can’t find any way to use a /routing filter to rewrite the ospf cost on egress from the router of matching network prefixes.
Is the above correct, or is there a way to have a router redistribute arbitrary routes (say, redistributing static) where one route will be redistributed with cost 10 and one will be redistributed with cost 50?
Edit: to clarify, I’m looking for something along the lines of:
router ospf 1
redistribute connected subnets route-map control-conn
!
access-list 1 permit 192.168.100.0 0.0.0.255
route-map control-conn permit 10
match ip address 1
set metric 50
!
route-map control-conn permit 20
set metric 10
!
Where all connected subnets are redistributed at a cost of 10 except 192.168.100.0/24, which is redistributed with a cost of 50.