0% found this document useful (0 votes)
27 views15 pages

20-10 OSPF Cost Metric

- OSPF is a link-state routing protocol where each router learns about all destinations in its area and the links between them. - The router will calculate the lowest cost path to each destination using the Shortest Path First (SPF) algorithm based on interface bandwidths and costs. - By default, fast interfaces like FastEthernet have a cost of 1 while slower interfaces like T1 have a higher default cost of 64. This can be manipulated by changing the reference bandwidth or interface costs.

Uploaded by

loaybbbjj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views15 pages

20-10 OSPF Cost Metric

- OSPF is a link-state routing protocol where each router learns about all destinations in its area and the links between them. - The router will calculate the lowest cost path to each destination using the Shortest Path First (SPF) algorithm based on interface bandwidths and costs. - By default, fast interfaces like FastEthernet have a cost of 1 while slower interfaces like T1 have a higher default cost of 64. This can be manipulated by changing the reference bandwidth or interface costs.

Uploaded by

loaybbbjj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

OSPF Metric Calculation

As OSPF is a Link State routing protocol, the router will learn


about all destinations in its area, the links and their cost
The router will select routes based on its lowest cost to get to
the destination
OSPF Link States
An OSPF router knows about all links in its OSPF area, and each
link’s cost
In a multiple area OSPF network, ABRs know the information for
each area they are connected to
When multiple areas are in use, each router has individual
routes for each IP subnet in its own area, and summary routes
to other areas which go via an ABR
OSPF Metric Calculation
For destinations in its own area, a router looks at all available
links to get there, and chooses the path with the lowest overall
cost
For destinations in another area, a router looks at all available
links to get to the ABR and chooses the path with the lowest
overall cost to the ABR. It’s then up to the ABR to choose the
best path onwards from there
SPF Shortest Path First Algorithm
The SPF Shortest Path First algorithm calculates the overall
cost for each available path to each destination network, and
then selects the lowest cost path
The overall cost = cumulative cost of all outgoing interfaces
You should ensure the cost is set the same on the interfaces
on both sides of a link or you can get asymmetric routing
Outgoing Interfaces

FE1/0
10.0.1.1/24
10.1.1.0/24 10.1.0.0/24 10.0.0.0/24
10.1.2.1/24 .1 .2 .1 .2 .2 .1
R4 R3 R2 R1
FE1/0 FE0/0 FE0/0 FE1/0 FE1/0 FE0/0 FE0/0
FE2/0
FE2/0 FE3/0 10.0.2.1/24
10.1.3.1/24 10.0.3.1/24

R5
FE2/0 FE3/0
10.1.3.2/24 10.0.3.2/24
OSPF Metric Calculation
In this example R2 will choose the path via R3 to get to the
10.0.1.0/24 network as it is lower cost

.2 10.0.0.0/24 .1 F1/0 10.0.1.1/24


R2 R1
F0/0 Cost: 50 F0/0 Cost: 10
F1/0.1 F1/0
.1

10.0.2.0/24 10.0.3.0/24
Cost: 10 Cost: 10
.2 .2
F1/0 R3 F0/0
Reference Bandwidth
The cost is automatically derived from the interface bandwidth
Cost = Reference Bandwidth / Interface Bandwidth
The default reference bandwidth is 100 Mbps
FastEthernet link cost defaults to 1 (100 / 100)
T1 link cost defaults to 64 (100 / 1.544)
Reference Bandwidth
OSPF treats all interfaces of 100 Mbps or faster as equal
FastEthernet, Gigabit Ethernet, 10 Gigabit Ethernet etc. all
default to a cost of 1
This can cause undesirable routing in modern networks

.2 10.0.0.0/24 .1 F1/0 10.0.1.1/24


R2 R1
F0/0 Cost: 1 F0/0 Cost: 1
G1/0.1 G1/0
.1

10.0.2.0/24 10.0.3.0/24
Cost: 1 Cost: 1
.2 .2
G1/0 R3 G0/0
Reference Bandwidth
R1(config)#router ospf 1
R1(config-router)#auto-cost reference-bandwidth 100000

The reference bandwidth should be changed on all routers

.2 10.0.0.0/24 .1 F1/0 10.0.1.1/24


R2 R1
F0/0 Cost: 1000 F0/0 Cost: 1000
G1/0.1 G1/0
.1

10.0.2.0/24 10.0.3.0/24
Cost: 100 Cost: 100
.2 .2
G1/0 R3 G0/0
Manipulating the OSPF Metric
OSPF takes the bandwidth of an interface into account when
calculating the metric, so paths along higher bandwidth links will be
preferred
The most desirable path will typically be automatically selected
Manipulating the OSPF Metric (Cont.)
If you want to use a different path, you can manipulate this by
manually changing the bandwidth or OSPF cost on interfaces
It is recommended to use cost because the bandwidth setting can
affect many features other than OSPF (such as QoS)
OSPF Metric - Bandwidth
R1#show interface serial1/0
Serial1/0 is administratively down, line protocol is down
Hardware is M4T
MTU 1500 bytes, BW 1544 Kbit/sec, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
!
R1(config)#interface serial1/0
R1(config-if)#bandwidth 768
!
R1#show interface serial1/0
Serial1/0 is administratively down, line protocol is down
Hardware is M4T
MTU 1500 bytes, BW 768 Kbit/sec, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
OSPF Metric - Cost

A manually configured OSPF cost overrides the value


automatically derived from the bandwidth

R1(config)#interface FastEthernet 0/0


R1(config-if)#ip ospf cost 50
OSPF Metric - Cost
R1#show ip ospf interface FastEthernet 0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 10.0.0.1/24, Area 0, Attached via Network Statement
Process ID 1, Router ID 192.168.0.1, Network Type BROADCAST, Cost: 1
Topology-MTID Cost Disabled Shutdown Topology Name
0 50 no no Base
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:02
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 10.1.0.2 (Designated Router)
! truncated
Lab

FE1/0
10.0.1.1/24
10.1.1.0/24 10.1.0.0/24 10.0.0.0/24
10.1.2.1/24 .1 .2 .1 .2 .2 .1
R4 R3 R2 R1
FE1/0 FE0/0 FE0/0 FE1/0 FE1/0 FE0/0 FE0/0
FE2/0
FE2/0 FE3/0 10.0.2.1/24
10.1.3.1/24 10.0.3.1/24

R5
FE2/0 FE3/0
10.1.3.2/24 10.0.3.2/24

You might also like