OSPF: Open Shortest Path First Protocol (OSPFv2)

OSPF: Open Shortest Path First Protocol (OSPFv2)
OSPF is an interior gateway protocol used for routing between routers belonging to a single Autonomous System. OSPF uses link-state technology in which routers send each other information about the direct connections and links which they have to other routers. Each OSPF router maintains an identical database describing the Autonomous System's topology. From this database, a routing table is calculated by constructing a shortest- path tree. OSPF recalculates routes quickly in the face of topological changes, utilizing a minimum of routing protocol traffic. OSPF provides support for equal-cost multi-path. An area routing capability is provided, enabling an additional level of routing protection and a reduction in routing protocol traffic. In addition, all OSPF routing protocol exchanges are authenticated.

OSPF has been designed expressly for the TCP/IP internet environment, including explicit support for CIDR and the tagging of externally-derived routing information. OSPF also provides for the authentication of routing updates, and utilizes IP multicast when sending/receiving the updates.

OSPF routes IP packets based solely on the destination IP address found in the IP packet header. IP packets are routed "as is" - they are not encapsulated in any further protocol headers as they transit the Autonomous System.
OSPF allows sets of networks to be grouped together. Such a grouping is called an area. The topology of an area is hidden from the rest of the Autonomous System. This information hiding enables a significant reduction in routing traffic. Also, routing within the area is determined only by the area's own topology, lending the area protection from bad routing data.

OSPF enables the flexible configuration of IP subnets. Each route distributed by OSPF has a destination and mask. Two different subnets of the same IP network number may have different sizes (i.e., different masks). This is commonly referred to as variable length subnetting. A packet is routed to the best (i.e., longest or most specific) match.

Protocol Structure - OSPF (Open Shortest Path First version 2) 

32 bit
Version No.
Packet Type
Packet length
Router ID
Area ID
Authentication (64 bits)
  • Version number - Protocol version number (currently 2).
  • Packet type - Valid types are as follows:
    • 1 : Hello
    • 2 : Database Description
    • 3 : Link State Request
    • 4 : Link State Update
    • 5 : Link State Acknowledgment.
  • Packet length - The length of the protocol packet in bytes. This length includes the standard OSPF header.
  • Router ID - The router ID of the packet's source. In OSPF, the source and destination of a routing protocol packet are the two ends of an (potential) adjacency.
  • Area ID - identifying the area that this packet belongs to. All OSPF packets are associated with a single area. Most travel a single hop only.
  • Checksum - The standard IP checksum of the entire contents of the packet, starting with the OSPF packet header but excluding the 64-bit authentication field.
  • AuType - Identifies the authentication scheme to be used for the packet.

Authentication - A 64-bit field for use by the authentication scheme