cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1223
Views
3
Helpful
3
Replies

OSPF static route cost on neighboring router

Haris P
Level 4
Level 4

Dears ,

Is there is any way to pass the cost from static route to ospf

Like I put the below route on one of my router and if i go to one another neighbor see OSPF cost only .Is there is any way to preserve the cost 150 in the neighboring router also ?

ip route 5.5.5.5 255.255.255.255  172.21.2.94 150

sh ip route 5.5.5.5
Routing entry for 5.5.5.5/32
  Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 1
  Last update from 172.16.26.10 on GigabitEthernet0/1, 00:00:01 ago
  Routing Descriptor Blocks:
  * 172.16.26.10, from 172.16.12.10, 00:00:01 ago, via GigabitEthernet0/1
      Route metric is 20, traffic share count is 1

Regards

Haris P

3 Replies 3

Peter Paluch
Cisco Employee
Cisco Employee

Hello Haris,

The 150 in your example is not a cost - rather, it is an administrative distance. An administrative distance is an expression of trustworthiness of the source of routing information, and is used to break ties when two or more routing protocols are trying to insert the same network into the routing table. The routing protocol using the lowest administrative distance will win the tie. But the administrative distance is never announced to another router, nor is it used by a single routing protocol to select the best paths. It is only a way of saying which of many routing protocols is more preferred.

What are you trying to accomplish? Please try to explain it in more detail, perhaps we can find a way to meet your needs.

Best regards,

Peter

I have some routers in OSPF domain  and I have a connection to network ,say 5.5.5.5/32 through 2 of my routers in the OSPF domain . I want to make one route as primary and another one as secondary

I have  2 conection to one of my customer thru router R1 and R2  ,say customer network as 5.5.5.5/32 .  I want to keep the route through R1 as primary and route through R2 as secondary . I want all my other routers in OSPF domain wanted to know that R1 is the primry link to the customer

on R1

ip route 5.5.5.5 255.255.255.255 172.21.2.94

on R2

ip route 5.5.5.5 255.255.255.255 192.168.5.2 150

sh ip route 5.5.5.5
Routing entry for 5.5.5.5/32
  Known via "static", distance 150, metric 0
  Routing Descriptor Blocks:
  * 172.21.2.94
      Route metric is 0, traffic share count is 1

Regards

Haris P

Haris,

I see. What you can do is to redistribute the static route into OSPF with different metric so that the R1 will be more preferred than R2.

On R1, do this:

ip prefix-list Networks permit 5.5.5.5/32

route-map Static2OSPF permit 10

match ip address prefix-list Networks

set metric 10

set metric-type type-2

route-map Static2OSPF permit 20

router ospf 1

redistribute static route-map Static2OSPF

On R2, do this:

ip prefix-list Networks permit 5.5.5.5/32

route-map Static2OSPF permit 10

match ip address prefix-list Networks

set metric 100

set metric-type type-2

route-map Static2OSPF permit 20

router ospf 1

redistribute static route-map Static2OSPF

This way, the redistributed route 5.5.5.5/32 on R1 will have a metric set to 10, the same route redistributed on R2 will have a metric set to 100, and this metric will not increase throughout the OSPF domain (metric-type 2). All other routers will therefore prefer R1 to reach these networks but will be able to use R2 in case R1 stops working.

Moreover, you should configure your ip route 5.5.5.5 255.255.255.255 commands without specifying the administrative distance because that one is used for different purposes, and should not be modified in your case.

Best regards,

Peter

Review Cisco Networking for a $25 gift card