Introduction to Open Shortest Path First (OSPF)

Open Shortest Path First (OSPF) is a link-state routing protocol replacing distance vector routing protocol, RIP. RIP was acceptable in the early days of networking. RIP uses hop count as the metric which is not working better in the larger network.

Open Shortest Path First (OSPF) has many advantages over RIP. It can scale a larger network and offer a faster convergence. It is a classless routing protocol using the concept of areas for scaling the network. Open Shortest Path First (OSPF) uses the Dijkstra algorithm created a famous programmer Edsger Wybe Dijkstra.

Development of Open Shortest Path First (OSPF)

The Internet Engineering Task Force (IETF) starts initial working on OSPF in 1987. Meanwhile, the internet was not public; it only used as an academic and research network funded by the government of the United States.  In 1989 the OSPF version 1 specification was published in RFC 1131; only for running on routers and UNIX workstations. Later its implementation became a widespread UNIX process known as GATED.

Version 1 of the OSPF is an experimental routing protocol and was never deployed.  In 1991, John Moy introduced OSPF version 2 in RFC 1247. Version 2 gives significant improvements over version 1. It is classless and supporting VLSM and CIDR. It the same time the IETF chose Open Shortest Path First (OSPF) as their recommended interior gateway protocol(IGP)

In 1998, version 2 was updated in RFC 2328; which remains the current RFC for OSPF. In 1999, OSPF version 3 was introduced in RFC 2740. It was created by John Moy, Rob Count; and Dennis for IPv6. In 2008, OSPFv3 has updated in RFC 5340 as OSPF for IPv6.

Features of Open Shortest Path First (OSPF)

The Open Shortest Path First (OSPF) has many features included:

  • Classless– OSPF is classless by design, so, it supports VLSM and CIDR.
  • Fast convergence– it is fast convergence and quickly propagates network changes.
  • Efficient– OSPF has no periodic update, it only triggers routing updates on the event. It uses the SPF algorithm to choose the best path.
  • Scalable– It works well both in small and large networks. We can group the routers into areas to support a hierarchical system.
  • Secure– OSPF supports MD5 (Message Digest 5) authentication. When MD5 has enabled, routers only accept encrypted routing updates from peers with the same pre-shared password.
  • Trustworthiness – Administrative distance is the trustworthiness of the route source. Open Shortest Path First (OSPF) has a default administrative distance of 110 and preferred over IS-IS and RIP.

Components of Open Shortest Path First (OSPF)

OSPF uses smaller routing tables due to the segmentation of the entire network into smaller areas. The network segmentation into area enables better administration.

OSPF consists of a backbone Area “0”. The Area “0” links all other smaller areas within the hierarchy. The important components of an OSPF network are hardware components, areas, databases,  Messages and algorithm:

Hardware Components

Hardware components are included area border router (ABR) and AS boundary router.

Area Border Routers (ABR)

ABR is a router located near the border between one or more one OSPF areas. It establishes a link between backbone networks and the OSPF areas.

AS Boundary Routers

It is a router exchanging routing information with non-OSPF networks. AS boundary routers advertise externally learned routes throughout the OSPF AS.

The AS Boundary Routers can also work as an ABR, backbone router or an internal router depending on the location. A router within a stub area cannot be an AS boundary router because the stub area cannot contain any type 5 LSAs.

OSPF Areas

In OSPF a single autonomous system (AS) can be divided into smaller groups. These smaller groups called areas. Areas reduce the number of LSAs and also reduce other overhead traffic sent on the network. The areas also reduce the topology database size maintaining each router.

Backbone Areas

The backbone area consists of all networks in area ID, including attached routing devices, and all Area Border Routers. It distributes routing information between areas. The backbone is itself an area, so the rules and terminology of an area also apply.

Stub Areas

Areas where AS external advertisements are not flooded called stub areas. Stub areas are shielded from external routes but receive information about networks that belong to other areas of the same OSPF domain

Routing devices within a stub area rely on the default routes originated by the area’s ABR to reach external AS destinations. The default-metric must be configured on the ABR before it advertises a default route.

The ABR advertises a default route in place of the external routes that are not being advertised within the stub area so that routing devices in the stub area can reach destinations outside the area.

Not-So-Stubby Areas (NSSA)

It enables the network administrator to configure OSPFv2 areas that provide the benefits of stub areas capable of importing external route information.  These routes are then leaked into other areas. But, external routes from other areas still do not enter the NSSA.

Totally Stubby Area

This area filters out information of OSPF database on the bases of LSA types. An Area Border Router (ABR) in a Totally Stubby Area prevents LSA type 3, 4 and 5 to be flooded into a Totally Stub Area. It replaces all these types of LSA with a default route.

Transit Areas

The area through which we can configure the virtual link called transit area. The transit area must be in a position of full routing information. The transit area cannot be a stub area.

OSPF Databases

The OSPF databases including adjacency database, link-state database (LSDB) and forwarding database. The introduction to the databases are the following:

Adjacency database

OSPF adjacency database maintains the neighbour database. This database allows routers to exchange routing information. The routers must be neighbours, then they can become adjacent. Two routers only become adjacent if at least one of them is DR or BDR.

The database contains the list of all neighbours routers establishes bidirectional communication. The adjacent database table is unique for each router. We can view this database using “show ip ospf neighbor” command.

Link-state database (LSDB)

The LSDB creates the topology table for every area to which the router belongs. The router links advertisements; network links advertisements, and summary link advertisements are the components of LSDB.

The link-state database also maintains the list of all routers in the network.  We can view LSDB using the “show ip ospf database” command.

Forwarding database

This database creates and lists the routing table of the router. Each router routing table is unique and containing information on how and where to send a packet to other routers.  We can view the forwarding database using the “show ip route” command.

Routing Protocol Messages

OSPF exchange information between routers using different messages. The messages packet populates the routing table with the routing protocol’s choice of best paths.

These packets discover neighbouring routers and also to exchange routing information to maintain accurate information about the network. There are five types of messages packet in OSPF also illustrates in the figure below:

  • Hello packet
  • Link-state request packet
  • Database description packet
  • Link-state update packet
  • Link-state acknowledgement packet

Open Shortest Path First


The Open Shortest Path First (OSPF) is a link-state routing protocol and using the CPU processes the neighbour and topology tables using Dijkstra’s SPF algorithm. The SPF algorithm cumulative cost-based algorithm to reach a destination.

The SPF algorithm creates an SPF tree and calculates the shortest and the best path to each node. OSPF places the best routes into the forwarding database and makes routing table using the forwarding database.