Open Shortest Path First (OSPF) Protocol

In this tutorial, you will learn the basic concepts of the OSPF routing protocol. After reading this tutorial, you will understand how OSPF works, the routing policies it employs, and how OSPF chooses the best path for data transmission.

Contents:

  1. Intradomain Routing
  2. Open Shortest Path First (OSPF)
  3. Autonomous System (AS)
  4. Areas of OSPF

Intradomain Routing

Intradomain routing is used inside the network. For example, it is used inside a school, college, or organization network. Intradomain routing is also known as interior gateway routing.

  • On the Internet, many networks exist, and all of them are independent in nature. An independent network is known as an autonomous system (AS or ASes).
  • An intradomain routing protocol is used when devices within the same network want to communicate.
  • Distance vector routing was used in early intradomain routing protocols. But it was good for small networks, and nowadays, networks have become bigger. Then the OSPF routing protocol came into play.
  • OSPF or Open Shortest Path First is an interior gateway routing protocol widely used inside networks.

Open Shortest Path First (OSPF)

When distance vector routing was used, there was a count-to-infinity problem that slows down convergence. Then ARPANET changed the DVR algorithm to the link-state routing algorithm. But then the IETF worked on the Link State Protocol for internal gateway routing and created the OSPF (Open Shortest Path First) algorithm.

advertisement
advertisement

Open Shortest Path First (OSPF) is a link-state routing protocol used within an autonomous system to find the most efficient path for data packets based on the shortest path first (SPF) algorithm.

  • Nowadays, most networks support the OSPF routing protocol. Usually, it is widely used in organization networks.
  • The OSPF algorithm supports a variety of distance metrics, including physical distance, delay, hop, etc. It is a dynamic algorithm so that it can automatically update its routing tables when the network topology changes.
  • If the load on one-line increases, the OSPF algorithm splits the load across multiple lines, in which case it acts as a load balancer. The OSPF algorithm also protects against router spoofing attacks.
  • OSPF supports point-to-point and broadcast networks for communication.
  • OSPF allows large autonomous systems to be divided into different sized areas, and it may be possible that some routers do not belong to an area.
  • When the router uses the OSPF algorithm, the router exchanges five messages to establish communication.

The figure below shows the five types of OSPF messages.

five types of OSPF messages
  • As shown in the diagram, the router first sends the HELLO packet to all of its point-to-point lines. With its help, the router learns about its neighbors.
  • Routers periodically advertise LINK STATE UPDATE to adjacent routers, providing the cost to be used in a topological database. The message contains the sequence number by which the router identifies whether the LINK STATE UPDATE received is new or old.
  • When a receiver router receives a LINK STATE UPDATE, it sends a LINK STATE ACK to the router that sends the link-state update packet.
  • Upon receiving the DATABASE DESCRIPTION, the receiver router receives the sequence number of all link state entries that the sender router has.
  • The router requests link-state information by sending the LINK STATE REQUEST packet to another router.

Autonomous System (AS)

An independent network is known as an autonomous system. Various independent networks are operated by different organizations, and together they form the Internet.

The diagram below shows an autonomous system network.

autonomous system network
  • As shown in the figure, routers are connected to a network. Most routers are connected using point-to-point links.
  • Routers are also connected to different networks so that they can reach hosts on those networks.
  • As you can see in the figure, Router-3, Router-4, and Router-5 are connected to LAN-3, which is broadcast LAN.
  • In autonomous system graphs, a weight is assigned to the links, and the weights can be distance, delay, etc. In broadcast LAN-3, each connected router’s link from LAN-3 weights 0.
  • OSPF creates the graph of the autonomous system as shown in the figure, it uses link-state routing so that each router can calculate the shortest path from itself to all other nodes.
  • OSPF creates the set of shortest paths, and when a packet is forwarded by the sender, OSPF divides the traffic into shortest paths, which balances the load of the network. This process is known as Equal Cost Multipath (ECMP).

Areas of OSPF

In OSPF, the area is a generalization of an individual network. The topology of the region is not visible, but the destinations are visible.

advertisement
  • When an AS is created, it has a backbone area, also known as area 0. In this area, routers are present, and the routers are known as backbone routers.
  • All the areas available on the Internet are connected to the backbone with the help of tunneling, which makes it possible to move from the area of ​​the current AS to the area of ​​another AS.
  • Another area is the area boundary router, in which each router is connected to two or more areas. In this area, the destinations will be summarized, and the summary is injected into other areas associated with it. This summary includes area costing information.
  • AS consists of a stub area, in which only one router is present and connected to the stub link. When a packet enters the stub area, there is only one router through which the packet enters the stub area and leaves the stub area.
  • When routers in the backbone want to communicate with other routers in the other AS, they send packets to the AS boundary router, which injects routes to external destinations on the other AS.
  • All routers in an AS have a link-state database, which contains information about the shortest path to reach other routers.

The diagram below explains the relation between the autonomous system, the backbone, and the areas.

Relation between Autonomous System, Backbone, and Areas

The above diagram shows, in an autonomous system, area 0 (backbone), a stub area, and different types of areas exist. Backbone has a backbone Router and an AS boundary router. AS border router communicates with other AS.

Key Points to Remember

Here is the list of key points we need to remember about “OSPF”.

  • On the Internet, many networks exist, and all of them are independent in nature. An independent network is known as an autonomous system (AS or ASes).
  • The OSPF algorithm supports a variety of distance metrics, including physical distance, delay, hop, etc. It is a dynamic algorithm so that it can automatically update its routing tables when the network topology changes.
  • HELLO, LINK STATE UPDATE, LINK STATE ACK, DATABASE DESCRIPTION, and LINK STATE REQUEST are the five types of OSPF messages.
  • OSPF creates the set of shortest paths, and when a packet is forwarded by the sender, OSPF divides the traffic into shortest paths, which balances the load of the network. This process is known as Equal Cost Multipath (ECMP).
  • When an AS is created, it has a backbone area, also known as area 0. In this area, routers are present, and the routers are known as backbone routers.

advertisement

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.