OSPF cost could be set explicitly or calculated automatically using the link’s bandwidth and OSPF reference bandwidth. In this tutorial, I explain the definition of OSPF reference bandwidth, how to adjust it, and more.

Upon the completion of this lesson, you will be able to answer the following questions:

  • What is reference bandwidth in OSPF?
  • What is the function of the auto-cost reference-bandwidth command?
  • Why would you want to change the OSPF default reference bandwidth?
  • How do I change the reference bandwidth in OSPF?
  • How does OSPF calculate its metric or cost?
  • How does OSPF check reference bandwidth?
  • How does OSPF determine the cost of an interface?
  • How does OSPF reference bandwidth get used?
  • How to use the auto-cost reference-bandwidth command?

ospf-reference-bandwidth

In the rest of this tutorial, we use the following network topology consisting of 4 routers. All interfaces belong to area 0, and the bandwidths of some interfaces have been changed to demonstrate facts related to OSPF reference bandwidth.

RouterInterfaceBandwidth
R3FastEthernet 0/12.5Gbps
R4GigabitEthernet 0/010Gbps
R4Serial 1/056kbps

Here are the links to download the configurations applied to the routers.

Router R1Router R2Router R3Router R4

What is OSPF Reference Bandwidth?

OSPF reference bandwidth is a value OSPF uses along with bandwidth to calculate the link’s cost if the cost was not set manually. By default, OSPF divides the reference bandwidth by the bandwidth and assigns the resulting value to the link’s cost.

OSPF Cost = (OSPF Reference Bandwidth) / (Link Bandwidth)

100 Mbps is the default value for OSPF reference bandwidth on Cisco IOS, IOS-XE, and IOS-XR.

Link Bandwidth depends on the interface type (Loopback, T1, Ethernet, Fast Ethernet, Gigabit Ethernet, 10-Gigabit Ethernet, Serial, OC48, etc) by default. The table below shows the default bandwidth for several interface types and the corresponding cost based on different OSPF reference bandwidth values.

Interface TypeDefault BandwidthOSPF Cost
Reference bandwidth of 100MbpsReference bandwidth of 1GbpsReference bandwidth of 10Gbps
Loopback8000000111
Serial56178517857178571
T11544646476476
Ethernet10000101001000
Fast Ethernet100000110100
Gigabit Ethernet10000001110
OC482500000114
10-Gigabit Ethernet10000000111

When the value of OSPF Reference Bandwidth is lower than the link’s bandwidth, OSPF sets the cost to 1. For example, with OSPF reference bandwidth equal to 100 Mbps, loopback, Gigabit Ethernet, OC48, and 10-Gigabit Ethernet interfaces get an OSPF of 1 (Examples 1, 2, 3, and 4 )

R1# show interfaces loopback 0
Loopback0 is up, line protocol is up 
  Hardware is Loopback
  Internet address is 10.0.1.1/24
  MTU 1514 bytes, BW 8000000 Kbit/sec, DLY 5000 usec, 

omitted output


R1# show ip ospf interface loopback 0
Loopback0 is up, line protocol is up 
  Internet Address 10.0.1.1/24, Area 0 
  Process ID 1, Router ID 10.0.1.1, Network Type LOOPBACK, Cost: 1
  Loopback interface is treated as a stub Host

Example 1 – Displaying the bandwidth and OSPF cost of R1’s loopback 0 interface

R2# show interfaces gigabitEthernet 0/0
GigabitEthernet0/0 is up, line protocol is up 
  Hardware is i82543 (Livengood), address is ca02.0888.0008 (bia ca02.0888.0008)
  Internet address is 10.0.12.2/24
  MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec, 
     reliability 255/255, txload 1/255, rxload 1/255


omitted output

R2# show ip ospf interface gigabitEthernet 0/0
GigabitEthernet0/0 is up, line protocol is up 
  Internet Address 10.0.12.2/24, Area 0 
  Process ID 1, Router ID 10.0.24.2, Network Type BROADCAST, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
        0           1         no          no            Base


omitted output

Example 2 – Displaying the bandwidth and OSPF cost of R2’s GigabitEthernet 0/0 interface

R3# show interfaces fastethernet 0/1
FastEthernet0/1 is up, line protocol is up 
  Hardware is AmdFE, address is cc03.089c.0001 (bia cc03.089c.0001)
  Internet address is 10.0.34.3/24
  MTU 1500 bytes, BW 2500000 Kbit/sec, DLY 100 usec, 
     reliability 255/255, txload 1/255, rxload 1/255


omitted output

R3# show ip ospf interface fastethernet 0/1
FastEthernet0/1 is up, line protocol is up 
  Internet Address 10.0.34.3/24, Area 0 
  Process ID 1, Router ID 10.0.34.3, Network Type BROADCAST, Cost: 1
  Transmit Delay is 1 sec, State BDR, Priority 1


omitted output

Example 3 – Displaying the bandwidth and OSPF cost of R3’s FastEthernet 0/1 interface

R4# show interfaces gigabitEthernet 0/0
GigabitEthernet0/0 is up, line protocol is up 
  Hardware is i82543 (Livengood), address is ca04.063f.0008 (bia ca04.063f.0008)
  Internet address is 10.0.34.4/24
  MTU 1500 bytes, BW 10000000 Kbit/sec, DLY 10 usec, 

omitted output

R4# show ip ospf interface gigabitEthernet 0/0
GigabitEthernet0/0 is up, line protocol is up 
  Internet Address 10.0.34.4/24, Area 0 
  Process ID 1, Router ID 10.0.34.4, Network Type BROADCAST, Cost: 1

omitted output

Example 4 – Displaying the bandwidth and OSPF cost of R4’s GigabitEthernet 0/0 interface

Default OSPF Reference Bandwidth

The default OSPF reference bandwidth on Cisco IOS is 100Mbps. The table below provides the default OSPF reference bandwidth on different router operating systems.

Router OSDefault OSPF Reference Bandwidth
Cisco IOS100Mbps
Cisco IOS XE100Mbps
Cisco IOS XR100Mbps
Cisco NX-OS40Gbps
Juniper JunOS100Mbps

Adjusting OSPF Reference Bandwidth on Cisco IOS

The goal of adjusting OSPF reference bandwidth is to best calculate the OSPF cost according to the interface’s bandwidth. On Cisco IOS, OSPF reference bandwidth can range from 1 to 4294967 Mbps. Using a small value will make all interfaces equal to OSPF while using a too-high value leads to very high OSPF costs that may exceed the maximum cost of 65535 that can be assigned to an interface. However, setting the OSPF reference bandwidth to the speed of the fastest router interface in the current OSPF domain would be enough.

The auto-cost reference-bandwidth bw allows changing the default value of OSPF reference bandwidth, where bw is a number between 1 and 4294967 in Mbps.

R2(config-router)# auto-cost reference-bandwidth 10000

To display the current OSPF reference bandwidth on a particular router, use the show ip ospf command (Example 6).

Finally, make sure that OSPF reference bandwidth is the same on all routers in the current OSPF autonomous system.

R2# show ip ospf
 Routing Process "ospf 1" with ID 10.0.24.2
 Start time: 00:03:49.320, Time elapsed: 00:41:10.548
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 Supports Link-local Signaling (LLS)
 Supports area transit capability
 Event-log enabled, Maximum number of events: 1000, Mode: cyclic
 Router is not originating router-LSAs with maximum metric
 Initial SPF schedule delay 5000 msecs
 Minimum hold time between two consecutive SPFs 10000 msecs
 Maximum wait time between two consecutive SPFs 10000 msecs
 Incremental-SPF disabled
 Minimum LSA interval 5 secs
 Minimum LSA arrival 1000 msecs
 LSA group pacing timer 240 secs
 Interface flood pacing timer 33 msecs
 Retransmission pacing timer 66 msecs
 Number of external LSA 0. Checksum Sum 0x000000
 Number of opaque AS LSA 0. Checksum Sum 0x000000
 Number of DCbitless external and opaque AS LSA 0
 Number of DoNotAge external and opaque AS LSA 0
 Number of areas in this router is 1. 1 normal 0 stub 0 nssa
 Number of areas transit capable is 0
 External flood list length 0
 IETF NSF helper support enabled
 Cisco NSF helper support enabled
 Reference bandwidth unit is 10000 mbps
    Area BACKBONE(0)
        Number of interfaces in this area is 2
        Area has no authentication
        SPF algorithm last executed 00:01:59.948 ago
        SPF algorithm executed 7 times
        Area ranges are
        Number of LSA 7. Checksum Sum 0x02FB20
        Number of opaque link LSA 0. Checksum Sum 0x000000
        Number of DCbitless LSA 0
        Number of indication LSA 0
        Number of DoNotAge LSA 0
        Flood list length 0

Example 5 – Displaying general information about OSPF

OSPF Issue Caused by OSPF Reference Bandwidth

When you adjust OSPF reference bandwidth manually, Cisco IOS displays the following message.

% OSPF: Reference bandwidth is changed.
Please ensure reference bandwidth is consistent across all routers.

Basically, configuring different OSPF reference bandwidth values on routers in the same OSPF routing domain would not cause routing loops. A routing loop occurs when router A forwards a packet, destined for a particular network, to a next-hop router B, which sends the packet back to A.

However, suboptimal routing may occur because links with lower bandwidth gets lower OSPF cost.

Related Articles to OSPF Reference Bandwidth

Conclusion

I hope this blog post helps you learn something.
Now I’d like to turn it over to you:
What did you like about this tutorial?
Or maybe you have an excellent idea that you think I need to add.
Either way, let me know by leaving a comment below right now.

Mohamed Ouamer
Mohamed Ouamer is a tenured professor (professeur agrégé) in computer science and a self-published author. He taught networking technologies and programming for more than fifteen years. While he loves to share knowledge and write, Mohamed's best passions include spending time with his family, visiting his parents, and learning new things.