Overview of OSPF


Open Shortest Path First (OSPF) is a link-state Interior Gateway Protocol (IGP) developed by the Internet Engineering Task Force (IETF).

OSPF version 2 (OSPFv2) is intended for IPv4. OSPF version 3 (OSPFv3) is intended for IPv6.

In this document, OSPF refers to OSPFv2, unless otherwise stated.


Before the emergence of OSPF, the Routing Information Protocol (RIP) was widely used as an IGP on networks. RIP is a distance-vector routing protocol which is gradually being replaced with OSPF, due to the former's slow convergence, tendency to form routing loops, and poor scalability.

The most common IGPs are RIP, OSPF, and Intermediate System to Intermediate System (IS-IS). Table 1 describes the differences between these IGPs.

Table 1 Differences between IGPs





Protocol type

IP layer protocol

IP layer protocol

Link layer protocol

Application scope

Applies to small networks with simple architectures, such as campus networks.

Applies to medium-sized networks with several hundred routers supported, such as enterprise networks.

Applies to large networks, such as Internet service provider (ISP) networks.

Routing algorithm

Uses a distance-vector algorithm and exchanges routing information over the User Datagram Protocol (UDP).

Uses the shortest path first (SPF) algorithm to generate a shortest path tree (SPT) based on the network topology, calculates shortest paths to all destinations, and exchanges routing information over IP.

Uses the SPF algorithm to generate an SPT based on the network topology, calculates shortest paths to all destinations, and exchanges routing information over IP.

In IS-IS, the SPF algorithm runs separately in Level-1 and Level-2 databases.

Route convergence speed


Less than 1 second

Less than 1 second


Not supported

Supported by partitioning a network into areas

Supported by defining device levels


OSPF offers the following benefits:

  • Wide application scope: OSPF applies to medium-sized networks with several hundred routers, such as enterprise networks.

  • Network masks: OSPF packets can carry masks, and therefore the packet length is not limited by natural IP masks. OSPF can process variable length subnet masks (VLSMs).

  • Fast convergence: When the network topology changes, OSPF immediately sends link state update (LSU) packets to synchronize the changes to the link state databases (LSDBs) of all devices in the same autonomous system (AS).

  • Loop-free routing: OSPF uses the SPF algorithm to calculate loop-free routes based on the collected link status.

  • Area partitioning: OSPF allows an AS to be partitioned into areas, which simplifies management. Routing information transmitted between areas is summarized, which reduces network bandwidth consumption.

  • Equal-cost routes: OSPF supports multiple equal-cost routes to the same destination.

  • Hierarchical routing: OSPF uses intra-area routes, inter-area routes, Type 1 external routes, and Type 2 external routes, which are listed in descending order of priority.

  • Authentication: OSPF supports area-based and interface-based packet authentication, which ensures packet exchange security.

  • Multicast: OSPF uses multicast addresses to send packets on certain types of links, which minimizes the impact on other devices.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
Next topic >