cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
785
Views
1
Helpful
9
Replies

OSPF: specifying cost

mmedwid
Level 3
Level 3

Let's say I have a router A with OSPF and network 10.10.10.0/24 and 10.10.12.0/24 in area 0 to advertise.  It has two interfaces connecting to

two other routers B and C also in area 0.  Router A's connecting interfaces are fa0/1 (to B) and fa0/2 (to C).  When router

B receives the 10.10.10.0 route I want the cost to be 10 and when it receives the 10.10.12.0 route I want the cost to be 100.

How can I color the route costs so that they are different despite being hear on the same interface?  Thanks!

2 Accepted Solutions

Accepted Solutions

I don't think there is a way to do this running OSPF, because you can only manipulate the cost for the physical interface or vlan interface

View solution in original post

OSPF is a link state protocol. And one of the basic principles of a link state protocol is that each router must have an accurate map of the topology of its network. This principle means that all locally connected routes that router A advertises to router B must have the same metric.

To achieve his requirements the original poster needs to look into a different routing protocol. He might achieve it with IBGP, but I think that a better choice would be to use EIGRP.

HTH

Rick

HTH

Rick

View solution in original post

9 Replies 9

Reza Sharifi
Hall of Fame
Hall of Fame

you can change the cost on router A, under the interface. the command is

ip os cost xx

HTH

But that would mean both network 10.10.10.0 and 10.10.12.0 would arrive at router B with cost xx.  What I would like to do is have 10.10.10.0 arrive at B with cost with cost 10 and 10.10.12.0 arrive at B with cost 100.  But both route advertisements would be egressing routing A on the same interface fa0/1.  Thank you!

Ok, sorry. I misunderstood you. So  you are trying to use the same outgoing interface but different cost per subnet right?

Yes - exactly.  So in my example the interfaces on router A would be say:

fa0/0 - 10.10.78.1/24

fa0/1 - 10.10.79.1/24

fa1/0 - 10.10.10.1/24

fa1/1 - 10.10.12.1/24

ospf 1

router-id 1.1.1.1

network 10.10.10.0 0.0.0.255 area 0

network 10.10.12.0 0.0.0.255 area 0

So when these two networks 10.10.10.0 and 10.10.12.0 are advertised out fa0/0 and router B receives the routes, each route would have a different cost.


Yes - exactly.  So in my example the interfaces on router A would be say:

fa0/0 - 10.10.78.1/24

fa0/1 - 10.10.79.1/24

fa1/0 - 10.10.10.1/24

fa1/1 - 10.10.12.1/24

ospf 1

router-id 1.1.1.1

network 10.10.10.0 0.0.0.255 area 0

network 10.10.12.0 0.0.0.255 area 0

So when these two networks 10.10.10.0 and 10.10.12.0 are advertised out fa0/0 and router B receives the routes, each route would have a different cost.

This is achievable by specifying the cost on the remote side physical interface. So, in your case lets say fa1/1 on Router A is connecting to Router Z. and network between them is  10.10.12.0/24. Then , you simply add the cost on the remote side physical interface to 90. So, now when the Router B sees the route it would see it as 10(cost of fast eth fa0/0 + 90(which we have changed on the Router Z).

Hope this helps,

Kishore

I don't think there is a way to do this running OSPF, because you can only manipulate the cost for the physical interface or vlan interface

Interesting.  With BGP I know I can alter attributes as the routes are received on which routing decisions can be made. So I was assuming there would be something similar in OSPF.  Perhaps for this situation iBGP would work better.

Reza Sharifi
Hall of Fame
Hall of Fame

have a look.  The original cost for this interface was 1 I changed it to 10

Switch#sh ip os in

Switch#sh ip os interface

Vlan1 is up, line protocol is up

  Internet Address 192.168.1.10/24, Area 0

  Process ID 1, Router ID 192.168.1.10, Network Type BROADCAST, Cost: 1

  Transmit Delay is 1 sec, State WAITING, Priority 1

  No designated router on this network

  No backup designated router on this network

  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

    oob-resync timeout 40

    Hello due in 00:00:03

    Wait time before Designated router selection 00:00:33

  Supports Link-local Signaling (LLS)

  Cisco NSF helper support enabled

  IETF NSF helper support enabled

  Index 1/1, flood queue length 0

  Next 0x0(0)/0x0(0)

  Last flood scan length is 0, maximum is 0

  Last flood scan time is 0 msec, maximum is 0 msec

  Neighbor Count is 0, Adjacent neighbor count is 0

  Suppress hello for 0 neighbor(s)

Switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#int

Switch(config)#interface gi

Switch(config)#interface gigabitEthernet 1/0/1

Switch(config-if)#ip os co

Switch(config-if)#ip os cos

Switch(config-if)#inter vlan 1

Switch(config-if)#ip os

Switch(config-if)#ip ospf co

Switch(config-if)#ip ospf cost 10

Switch(config-if)#do sh ip os int

Vlan1 is up, line protocol is up

  Internet Address 192.168.1.10/24, Area 0

  Process ID 1, Router ID 192.168.1.10, Network Type BROADCAST, Cost: 10

  Transmit Delay is 1 sec, State DR, Priority 1

  Designated Router (ID) 192.168.1.10, Interface address 192.168.1.10

  No backup designated router on this network

  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

    oob-resync timeout 40

    Hello due in 00:00:01

  Supports Link-local Signaling (LLS)

  Cisco NSF helper support enabled

  IETF NSF helper support enabled

  Index 1/1, flood queue length 0

  Next 0x0(0)/0x0(0)

  Last flood scan length is 0, maximum is 0

  Last flood scan time is 0 msec, maximum is 0 msec

  Neighbor Count is 0, Adjacent neighbor count is 0

  Suppress hello for 0 neighbor(s)

Switch(config-if)#

HTH

OSPF is a link state protocol. And one of the basic principles of a link state protocol is that each router must have an accurate map of the topology of its network. This principle means that all locally connected routes that router A advertises to router B must have the same metric.

To achieve his requirements the original poster needs to look into a different routing protocol. He might achieve it with IBGP, but I think that a better choice would be to use EIGRP.

HTH

Rick

HTH

Rick
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: