Deploy your apps to a supercloud in a few clicks

This Engineering Education program is supported by Section. Instantly deploy your GitHub apps, Docker containers or K8s namespaces to a supercloud.

Try It For Free

Classless Routing using Open Shortest Path First Protocol

September 5, 2021

Packets take different routes when sent in large and complex networks. Some routes can be longer while others are shorter.

The fastest available routes are always the best hence a mechanism is needed to identify them.

This article will cover how we can apply classless routing protocols on networks to identify fast routes using the Open Shortest Path First (OSPF) protocol.

Table of contents


To follow along, the reader should:

  • Have a good understanding of networks and configurations.
  • Have a prior understanding of the basic network routing concepts.
  • Know how to use the Cisco Packet Tracer.

You can download the Cisco packet tracer from here.


  • Classless routing - It refers to a type of routing where the router uses the default route to forward traffic if no other specific routes are found. It includes subnet mask information in the routing update and is supported by RIPv2, OSPF, and EIGRP protocols.

  • Administrative Distance (AD) - This feature is used by routers to select the best path possible.

  • Metric - It refers to the ways used by each classless routing protocol to determine the best path to a network. OSPF uses the Sum of Inverse of Bandwidth while RIP uses Hop Count. EIGRP relies on Min Bandwidth + Delay.

  • Wildcard Mask - It refers to the inverses of subnet masks configured on interfaces and used by OSPF to specify the range of IP addresses to examine for a match. It is usually 32-bit long.

  • A logical grouping of OSPF networks, routers, and links with the same area identification is referred to as an OSPF area. A router within an area is required to have a topological database for that particular region.

  • OSPF neighbors - It is the relationship that exists between two OSPF-enabled routers in the same area that is connected by a common network.

OSPF components and characteristics

The Open Shortest Path First (OSPF) protocol is a link-state, classless, open standard routing protocol that was created as an inner gateway protocol.

It uses the concept of areas and the routing metric cost to help control routing traffic by providing fast convergence and scaling to much larger network implementations.

The OSPF protocol manages several routing zones and assists in determining the quickest available route for a particular situation.

The OSPF protocol has comparable components. That is:

  • Routing Protocol Messages - OSPF allows routers to send and receive messages in the form of packets. Such as hello packets, link-state request packets, and database description packets.

  • Data Structures - They are created by the OSPF neighbors’ messages and contains a list of surrounding routers that they share routing information. They are stored in the RAM.

  1. The neighbor table is created by the adjacency database.
  2. The topology table is created by the link-state database(LSDB).
  3. The routing table is generated by the forwarding database.
  • Algorithm - OSPF employs the Shortest Path First(SPF) algorithm, which is based on the total cost of reaching a target.

OSPF characteristics

  • OSPF uses link-state routing algorithm.
  • It supports CIDR addressing model.
  • OSPF only sends updates rather than the complete routing table.
  • The simplest routing statistic is path cost.
  • It supports authentication and sends updates after every 10 seconds.
  • Updates are sent with the multi-cast address

OSPF implementation

OSPF can be set up in two different ways:

i). Single area OSPF

This form of OSPF implementation happens in small networks with all routers in the backbone region (area 0), resulting in enormous routing tables.

Single Area OSPF Network Configuration.

ii). Multi area OSPF

OSPF is done in a hierarchical order. Multiple locations must link to the backbone. We can divide a large autonomous system into smaller segments to support hierarchical routing.

The Shortest Path First (SPF) is confined to an area resulting in smaller routing tables.

Multi Area OSPF Network Configuration.

OSPF configuration

Let’s look at how we can configure and verify OSPF implementation on a local area network.

Consider the network below:

OSPF Network Configuration

Assign IP addresses to the interfaces on both routers and PCs.

Router#configure terminal
Router(config)  #interface gi0/0    !specifying interface
Router(config-if)   #ip address  !assigning IP address to interface
Router(config-if)   #no shutdown    !activating the interface
Router(config-if)   #interface gi0/1
Router(config-if)   #ip address
Router(config-if)   #no shutdown
Router(config-if)   #do write   ! routers configuration saving
Router#config terminal
Router(config)  #interface gi0/0
Router(config-if)   #ip address
Router(config-if)   #no shutdown
Router(config-if)   #interface gi0/1
Router(config-if)   #ip address
Router(config-if)   #no shutdown

Create a relationship between the two routers and specify the connected subnet in OSPF.

Router(config)  #router ospf 1  !ospf is enabled
Router(config-router)   #network area 0  !specifying the network, wildcard mask and the area
Router(config-router)   #network area 0
Router(config-router)   #do write
Router(config-if)   #router ospf 1
Router(config-router)   #network area 0
Router(config-router)   #network area 0
Router(config-router)   #do write

To disable OSPF configurations on the routers, the command no router ospf is used in the global configuration mode. To view the OSPF information, we can use the show ip protocols command.

OSPF verification

To verify that we configured OSPF on the network and its implementation is working, the command show ip ospf is used.

Router#show ip ospf
Routing Process "ospf 1" with ID
Supports only single TOS(TOS0) routes
Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs

To view the OSPF neighbors we use show ip ospf neighbor.

Router#show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface      1   FULL/BDR        00:00:32    GigabitEthernet0/0

On both routers, we can use the show ip route ospf command to check if the connected subnets are advertised in a different area.

Router#show ip route ospf
O [110/2] via, 00:34:39, GigabitEthernet0/0

Computers can communicate since they are directly connected to the same area.

OSPF Network PCs Ping


As shown above, we can use OSPF in classless routing to determine the fastest available routes for packets. This feature helps to accomodate large network implementations.

You can find more information about classless routing using OSPF here.

Peer Review Contributions by: Eric Gacoki