20-10 OSPF Cost Metric
20-10 OSPF Cost Metric
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
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
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
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
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