Open Shortest Path First (OSPF) Routing

OSPF is a scalable, industry standard link state protocol used on IP networks and defined in RFC 2328. Because link state protocols build and maintain a topology database for a network based on first-hand knowledge rather than simply relying on the “hearsay” of neighbors, they tend to be more efficient in determining the most efficient route to a network. OSPF uses what is known as the Dijkstra algorithm to determine the shortest path between a router and a destination network. The metric used by OSPF to determine the best route to a network is interface cost, which is calculated based on bandwidth. For those interested, the actual calculation is 108 divided by the interface bandwidth in bits per second, which you might remember can be found using the show interface command. For example, the cost associated with a T1 line would be 108/1544000, which equals 64.

Like RIPv2, OSPF is also classless, meaning that it supports the use of VLSM addressing. OSPF routers exchange information by flooding link state advertisement (LSA) packets throughout a network. These packets include information on the current state of the router’s links, interfaces, and cost. Ultimately, this information is used by an OSPF router to build its adjacency, topology, and routing tables. Every 10 seconds, on a broadcast network, an OSPF router also sends out a “hello” message, letting adjacent routers know that it is still around.

While a simple distance vector protocol like RIP or IGRP may require little more than being enabled in order to make routing decisions, an OSPF implementation is usually designed according to a hierarchy, where different routers are given different roles. A proper OSPF design also helps to ensure that those LSA packets just mentioned don’t overwhelm routers. Instead, an OSPF network is divided into what are known as areas, with a group of areas forming what is known as an OSPF autonomous system (AS). The figure below shows a network made up of 4 areas, all within autonomous system 100.

OSPF autonomous system including multiple areas, IRs, ABRs, and an ASBR.

It’s easy to get confused by OSPF terms when learning them for the first time. The bullet points below outline all of the key terms that you should be familiar with

Area. An OSPF area is nothing more than a grouping of routers (running OSPF) amongst whom link state advertisements will be flooded. The idea is to try to reduce the number of LSAs that are sent throughout an internetwork by keeping the majority of LSAs within an area.

Backbone Area. The backbone area should be the first area defined in an OSPF network, and is the area to which all other areas usually connect. The backbone area is known as Area 0. The backbone area is used to move OSPF routing information between areas.

Autonomous System. An OSPF autonomous system is nothing more than a collection of OSPF areas amongst which OSPF routing information is shared. An autonomous system is assigned a number, similar to the one we used when looking at IGRP.

External Network. Any networks running other routing protocols, or other OSPF autonomous systems, are considered external networks.

Routers within an Area exchange LSAs with one another to build their link state databases. All OSPF routers in the same area have the same link state database. The LSAs flooded within an area are known as Type 1 or router LSAs – they contain information on the links, interfaces, and costs for routers within an area. Any router whose interfaces only connect to a single area is known as an Internal Router (IR).

Author: Dan DiNicolo

Dan DiNicolo is a freelance author, consultant, trainer, and the managing editor of He is the author of the CCNA Study Guide found on this site, as well as many books including the PC Magazine titles Windows XP Security Solutions and Windows Vista Security Solutions. Click here to contact Dan.