Network Kings


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

d :
h :

Understanding the OSPF Theory

ospf theory

Introduction: (OSPF Theory) Open Shortest Path First

OSPF stands for open shortest path first. OSPF is a dynamic routing protocol that comes under IGP(interior gateway protocol). It is also known as link state protocol. It works on shortest path first algorithm (SPF). To advertise routes information OSPF running routers send LSAs to exchange information with neighbors.

LSA Flooding

This picture is showing how LSA flooding takes place whenever a change occurs in network. You can see, at router 8, a new interface with IP address is added and to notify other routers about this change R8 sent LSAs to their neighbors and neighbors will send to their neighbors and process will go on until  all routers don’t get LSA updates.

It is open standard protocol.
In OSPF, no router limit like EIGRP, it supports unlimited routers.
It uses 2 multicast address and
IP protocol = 89, AD value = 110
It supports subnetting.

Basic Terminology

Wildcard Mask: It is inverted form of subnet mask (1 is replace by 0 and 0 is replaced by 1). Learn step-by-step process to calculate wildcard mask.

For class A subnet mask is and wild card mask is
For class B subnet is and wild card mask is
For class C subnet is and wild card mask is

RID: RID stands for router identity. RID is an unique identity of a router. It is a 32 bit number. OSPF used RID to uniquely identify the router. By default, IOS selects one of its interface IP address as a RID. You can also configure it manually.


Backbone Router: A router that belongs to area 0 is known as backbone router. All routers inside area 0 including ABRs come under backbone routers.

Internal Routers: Routers that lie inside a single area (all interfaces of router should be in same area) are called as internal routers.

ABR (Area Border Router): An OSPF router that belongs to area 0 and at least one other area is called as ABR.

ASBR (Autonomous System Boundary Router): A router that belongs to area 0 and one other area. It is similar definition as ABR, yes it is similar, only one difference, on both interfaces different protocols are running.

OSPF Area Design Conditions

  1. Area 0 is mandatory.
  2. All areas should be connected to area 0.
  3. All areas should be continuous.

Why we use area concept in OSPF?

The straight forward answer for this question is to reduce LSA flooding, we make areas in OSPF. For smaller network single area will not impact the performance. But for larger network, single area is not a good choice. Why?
Here are 3 reasons
1) SPF algorithm takes more time to calculate routes.
2) To manage large database routers require more processing power and memory.
3) If any small changes occurs in the network, LSAs (link state advertisements) are generated and every router flood the LSA to their neighbours and after this again SPF algorithm runs to update their routes.

Case 1: For example in a network, total 100 routers (all are in one area) so when change will occur in the topology, all routers receive LSA updates.

Case 2: Same topology, a network has 100 routers, but this time we divided whole network into areas, so whenever change will occur, routers which reside in the same area where change occurred, only receive the LSA updates.
So, in short you can say to reduce LSA flooding, to reduce processing power and memory we use area concept in OSPF.

OSPF tables

  1. Neighbour Table: Neighbor table contains information about the directly connected ospf neighbors.
  2. Database Table: Database table contains information about the entire topology with respect to each router.
  3. Routing Table: Routing table contains a list of the best paths
    calculated by the shortest path first(SPF) algorithm.

OSPF Packets

  1. Hello
  2. DBD (database description)
  3. LSR (Link State Request)
  4. LSU (Link State Update)
  5. LSACK (Link State Acknowledment)

Hello Message: OSPF use hello packets to discover neighbors. The routers which are connected on same link can become neighbors. Hello packets are sent to multicast IP address Inside hello packets, router ID (RID) is exchanged. After exchanging hello packets, neighborship is formed.

Database description (DBD) : After becoming neighbors, both routers exchange DBD summary to each other to synchronise their database.

LSR (Link State Request): After receiving DBD from neighbors, router matches it’s own database with DBD. And if router doesn’t have any route that neighbors have, router send LSR message to ask missing routes information.

LSU (Link State Update): In the response of LSR, neighbor send LSU. Neighbor put all the missing route information in LSU and send to the router.

LSAK (Link State Acknowledge): After receiving LSU, router send a acknowledge message that I have received the LSU message properly.

After, all this process, now both routers have same link state database (LSDB) and now they will form adjacency.

OSPF States

  1. Down
  2. Init
  3. 2-way
  4. Exstart
  5. Exchange
  6. Loading
  7. Full
OSPF States

OSPF DR/BDR Election:

DR (Designated Router): DR is like a head of a network whenever a change occurs, routers will send the LSA to DR and BDR only. DR sends LSA to other routers (DRothers).

  • DR listens LSAs on multicast address
  • DR transmits LSAs to other routers on
  • DR ensures that all routers have same synchronised LSDB.

BDR (Backup designated router): BDR takes the responsibility of DR when DR goes down because of any technical issue.

It listens LSAs on and

DRothers: In a network, all routers other than DR and BDR are known as DRothers.

  • DRother routers transmit LSAs to DR on
  • Listens network LSAs on

OSPF have 2 types of network.

  1. Point-to-point network
  2. Broadcast or multiaccess network.

In point-to point network there is no need of DR/BDR election. But in broadcast network DR/BDR election helps in reducing LSA flooding. In broadcast network whenever changes occur (like a link fails or any new link adds) LSAs are generated and flooded throughout the network so that all routers in the topology can update their LSDB (link state database).

Why we need DR/BDR?

To reduce LSA flooding and to improve network performance DR/BDR election is done. Once DR is selected then there is no more LSA flooding in the network, whenever there is any change in topology, instead of sending LSAs to their neighbor, router will only inform to DR on multicast address. And then DR takes care of other routers LSDB, it informs other routers by sending LSAs on, so that they can update their LSDB.

Selection criteria for DR (Designated router)

  1. It checks interface priority. The router which has highest priority is selected as DR. By default, all OSPF interface priority is 1.
  2. If all routers have same priority then it checks highest RID. The router which has highest RID is selected as DR, and router which has second highest RID is selected as BDR.

By default, IOS select highest IP address as router RID.

In order to select RID, OSPF gives priority to loopback interface over physical interfaces. Reason is loopback are virtual interface, never goes down.