OSPF

Routing

Definition

Open Shortest Path First. An interior gateway routing protocol that uses link-state advertisements and Dijkstra's algorithm to compute the shortest path within an autonomous system.

OSPF belongs to the link-state family of routing protocols. Each OSPF router builds a complete map of the network topology by flooding Link State Advertisements (LSAs) to all neighbors. Every router then independently runs Dijkstra's shortest-path-first algorithm on this map — hence the protocol's name.

This contrasts with distance-vector protocols like RIP, where routers only know their neighbors' advertised distances without seeing the full topology. Link-state protocols converge faster and scale better, at the cost of higher CPU and memory usage during topology changes.

OSPF Areas

Large OSPF deployments are divided into areas to control LSA flooding scope and reduce resource consumption. Area 0 — the backbone area — is mandatory. All other areas must connect to Area 0, either directly or through virtual links. Area Border Routers (ABRs) sit between areas and summarize routing information, limiting the scope of topology changes.

OSPF uses cost as its metric, typically calculated as 10^8 / interface_bandwidth. Lower cost wins. Administrators can manually set interface costs to influence path selection, enabling traffic engineering without protocol changes.

OSPF vs. BGP

OSPF is an interior gateway protocol (IGP) — it operates within a single Autonomous System (AS)A large network or group of networks under a single administrative policy, identified by a unique Autonomous System Number (ASN). The internet is composed of tens of thousands of interconnected autonomous systems.. BGPBorder Gateway Protocol. The routing protocol that exchanges reachability information between autonomous systems, effectively determining how data traverses the internet. Often called the "postal service of the internet." is the exterior gateway protocol for routing between autonomous systems. In most enterprise and ISP networks, OSPF handles internal routing while BGP handles external connectivity. The Routing TableA data structure stored in a router that lists known network destinations and the next hop or interface for reaching each one. Routing tables are populated by static configuration or dynamic routing protocols like BGP and OSPF. built by OSPF feeds into BGP route selection at AS edges.

Related Terms

More in Routing