Network Kings


$999 $499 only For All Access Pass Today! USE PROMO CODE : LIMITED

d :
h :

What is OSPF? Explained 

ospf stub area

OSPF stands for Open Shortest Path First. It is a routing protocol used in computer networks to determine the best path for routing data packets from one network node to another.

What are the features of OSPF?

Here are some key features of OSPF: –  

  • It is a link-state routing protocol. 
  • OSPF is a nonproprietary Interior Gateway Protocol. 

There are two main versions of OSPF in production networks today: 

  1. OSPFv2 – Originally defined in RFC 2328 with IPv4 support 
  2. OSPFv3 – Modifies the original structure to support IPv6 
  • OSPF is a Layer 3 Protocol. 
  • The Protocol Number of OSPF is 89. 
  • AD value of OSPF is 110. 
  • The multicast address of OSPF is (used by all the OSPF routers) and (used to communicate to the Designated Router and Back Designated Router). 
  • OSPF uses the Dijkstra algorithm to calculate the shortest path tree, determining the best data routes to traverse the network. 
  • OSPF networks get divided into areas to improve scalability. Each area has its link-state database, and routers within an area only exchange summary information with routers outside their area, reducing the LSA flooding.
  • OSPF uses cost metrics to determine the best path. The cost of a path is based on link bandwidth. The higher the bandwidth lower the cost.
  • OSPF can quickly adapt to changes in the network. In case of link failure, it rapidly recalculates routes based on the updated link-state information.
  • OSPF supports authentication mechanisms to secure the network. 
  • OSPF is compatible with Variable Length Subnet Mask (VLSM) and Classless Inter-Domain Routing (CIDR). 

What tables do OSPF maintain?

OSPF maintains three tables, namely: – 

  • Neighbour Table

The Neighbour table contains information about the directly connected OSPF neighbours. 

  • Database Table

A Database table contains information about the entire view of the topology concerning each router.   

  • Routing Information Table

It contains the best path calculated by the shortest path algorithm or Dijkstra algorithm. 

Since OSPF is a link-state routing protocol, every router shares the information of its neighbour with the other router in a network. This is known as Link state advertisements

ospf stub area

NOTE: All the routers in a network need to learn this link-state advertisement to create a routing database known as the Link-State Database.

So, the scenario would look something like this. All the routers will flood the advertisements, leading to a lot of OSPF traffic.

ospf stub area

A lot of link state advertisements in a network will lead to network congestion, wastage of bandwidth, and ultimately an inefficient network. 

So, to eliminate this issue and make the network more efficient OSPF introduces us to the concept of AREA

Explain the concept of AREA in OSPF.

Let us understand this with the help of an example:- 

Suppose a router of a given topology goes down for any reason. Other routers would look into its LSDB for another best possible route, and hence, it will also advertise that R1 is down throughout the network. This causes a serious issue known as Link-state advertisement flooding

OSPF eliminates this flooding by introducing the concept of area. We can divide our network into different areas. Also, the Link State advertisements do not cross a particular area leading to a reduction in LSA flooding. 

NOTE: There are ways with the help of which OSPF advertises its information outside the area, which we will discuss later. 

What should we remember while grouping the routers?

An area is a logical grouping of routers. Some Important points to remember regarding the OSPF area: – 

  • Each OSPF topology must have Area 0 
  • Area 0 is also called the backbone area. 
  • If in topology, we have only 1 area, it should be AREA 0 
  • All the area must be connected to Area 0 
  • Area 0 should be contiguous, i.e., it should not get divided into two or more parts. If, for some reason, area 0 is not contiguous, we must combine it using the concept of virtual links.
virtual link
virtual link
routes between the areas

What are Designated Router and Backup Designated Router?

In OSPF networks, designated routers and backup designated routers are used whose main purpose is to reduce the amount of overhead traffic and to improve the efficiency of routing updates. 

  • Designated Router

In each multi-access network segment, one router is elected as a Designated router which is responsible for generating and sending OSPF network information to all the other routers in the same area. Since only DR is responsible for sending the updates, the amount of duplicate traffic is reduced.

  • Backup Designated Router

Along with the Designated Router, a backup designated router is elected. BDR takes up the responsibility of the Designated router in case it fails.

How does Designated Router and Backup Designated Router is elected?

  • Router Priority

Each router has some priority value. The router with the highest priority becomes the Designated Router, and the one with the second highest priority becomes the Backup Designated Router. The default priority is 1, but it can be set manually.

  • Router ID

The router ID is a 32-bit unique identifier assigned to each router. The highest loopback IP becomes the router ID. If no loopback is configured to a router, the highest IP address on a physical interface becomes a router ID. 

If more than one router has the same priority, the router with the highest Router ID becomes the Designated router. 

NOTE: The Designated Router and Backup Designated Router are only needed in multi-access networks and are not required in the case of point-to-point networks. In point-to-point links, there is no need for DR and BDR because there are only two routers involved and they directly exchange OSPF information.

What are Backbone Router, ABR, and ASBR?

  • Backbone Router

A backbone router is the one that resides within the backbone area, i.e., area 0 of an OSPF network. This router is responsible for exchanging routing information and network updates with other routers in the same backbone area. It ensures the connectivity between different OSPF areas. 

  • Area Border Router

ABR, also known as Area Border Router, is the one that connects two or more OSPF areas, including the backbone area. Its primary role is to route traffic between different areas with the help of LSA Type 3. For a router to become an Area Border Router, at least one link must be in Area 0 while other links are in areas other than Area 0. 

  • Autonomous System Border Router (ASBR)

An ASBR is a router connecting an OSPF domain to routers in another routing domain. A router becomes an ASBR router when one link is configured with OSPF while the other link gets configured with a protocol other than OSPF. The protocol can be EIGRP, a static route, a default router, etc. ASBR router imports external routes into the OSPF domain and exports OSPF routes to the external network. 

ospf stub area

What are the OSPF messages?

The OSPF messages are as follows-

  • Hello

A Hello message is used to discover neighbours and establish adjacency. Routers sends hello message periodically to their directly connected neighbours. This message includes information about Router ID, Area ID, network mask, priority hello interval, dead time interval, authentication options if configured, etc. Hello, the message uses multicast address 

  • Database Description Message (DBD)

The router sends a DBD message to describe its own Link state database to a neighbouring router. DBD is a summary of the Link State Database. 

  • Link State Request (LSR)

After DBD is received, the receiving router identifies the missing routes and sends an LSR message to request a missing LSA from its neighbour. 

  • Link State Update (LSU)

LSU is sent in response to the Link State Request. When a router receives an LSR message requesting a particular LSA, it responds with one or more LSU which contains the requested LSA. 

  • Link State Acknowledgment (LSAck)

When a requesting router receives an LSU, it sends back LSAck, i.e., the acknowledgement which confirms that the LSA is correctly received. 

What are the OSPF states?

The OSPF states are as follows-

  • Down State

In this state, a router has no information about its neighbour, and no OSPF hello message is received. This is the initial state before any OSPF communication begins.

  • Init State

When a router sends out a hello message to its neighbour, it comes into the Init State. The router waits for a response to its hello message from a neighbour. 

  • Two-way state

After a router receives the hello message from its neighbour, it enters into a two-way state. In this state, a bidirectional communication has been established. 

  • Exstart state

Once the router has established two-way communication, i.e., Two-way state, it transitions to Exstart state. This is the initial state of OSPF adjacency formation. In this state, master and slave mode is determined. 

  • Exchange

In this state router exchanges the DBD packets that summarize their Link State Database. This helps them to identify the missing route. 

  • Loading

In this state router exchanges Link State Request and Link State Update packets to synchronize their Link State Database. 

  • Full state

Once the router has successfully exchanged LSA and has a matching link state database, it enters into the full state. In this state, routers have a complete understanding of network topology, and the Link state Database is also in sync. Hence, adjacency is established.