OSPF, or Open Shortest Path First, is an interior gateway routing protocol used by routers within an organization’s IP network. Rather than having an administrator define every route manually, participating routers advertise link-state information, build a view of the topology and calculate routes from that view. OSPF is valuable when a network has several possible paths and must react to link or router failures. The important limitation is in the word shortest: OSPF computes the lowest-cost eligible path according to its configured metrics and routing rules, not necessarily the route with the least real-world latency or congestion.
How OSPF chooses a route
Each OSPF router maintains a link-state database (LSDB) for the area or areas in which it participates. The database describes advertised routers, links and networks. Once the router has sufficient consistent information, it runs the shortest-path-first (SPF) calculation to build a tree rooted at itself. Route selection then applies OSPF’s route-type rules and calculated path costs. For an intra-area path, the cost is the sum of the relevant interface costs along the path.
Suppose a router has two eligible paths to a branch network. Path A crosses links assigned costs of 10 and 10, totaling 20. Path B crosses links assigned costs of 5 and 7, totaling 12. If the advertisements are valid and no more-specific routing or policy rule intervenes, OSPF prefers the lower-cost path B. That does not prove B is physically shorter, more secure or less congested. OSPF’s cost is a routing metric; it does not continuously benchmark application response time.
Equal-cost routes may be installed as equal-cost multipath (ECMP) when the platform and configuration permit it. Traffic distribution typically follows forwarding-platform behavior such as per-flow hashing, rather than duplicating every packet across all available paths. A diagram showing two links therefore does not establish that an application will see twice the bandwidth or uninterrupted sessions after a failure.
Neighbors, adjacencies and the link-state database
Before two routers can exchange useful topology information, they must discover one another and establish an appropriate neighbor relationship. OSPF Hello packets advertise the sender’s router ID and parameters such as area, timers and neighbor information. Interfaces on opposite sides must have compatible settings. A mismatched area, authentication configuration or Hello/Dead timer can prevent a usable adjacency, even when the interfaces can ping one another.
Not every neighbor relationship becomes a full adjacency in every network type. On a shared broadcast network, OSPF normally elects a designated router (DR) and backup designated router (BDR) to reduce adjacency and flooding overhead. The election affects who forms full adjacencies, but it does not turn the DR into the next hop for every data packet. On point-to-point links, the expected adjacency pattern differs.
OSPFv2 uses five packet types: Hello, Database Description, Link State Request, Link State Update and Link State Acknowledgment. These support neighbor discovery, database summary exchange, retrieval of missing information, propagation of link-state advertisements (LSAs) and acknowledgment of flooded information. The resulting LSDB is an input to route calculation; it is not the same object as the installed IP routing table. A prefix can appear in LSAs yet still be absent from the forwarding table because another route is preferred or an OSPF rule prevents installation.
These control packets use IP protocol number 89, not a TCP or UDP application port. OSPFv2 is used for IPv4 routing and OSPFv3 is commonly used for IPv6; their packet and address-family details differ. Engineers should match commands and security settings to the operating system and OSPF version actually in use.
Why areas matter
OSPF supports a hierarchy of areas to limit the amount of topology information routers must process. Area 0 is the backbone. In conventional multi-area designs, nonbackbone areas reach other areas through the backbone, while area border routers (ABRs) connect areas and advertise appropriate summarized or inter-area information. This design can improve scalability and contain the effects of some topology changes.
Area boundaries are not arbitrary labels. Incorrect area assignments or missing backbone connectivity can result in neighbors that never establish, reachability gaps or surprising inter-area routes. Stub and not-so-stubby area (NSSA) options can control how external information enters an area, but their detailed restrictions must match the site’s topology. Before applying an area type because it sounds simpler, identify where default routes, external prefixes and internal services must be reachable.
An autonomous system boundary router (ASBR) can introduce external routes, such as prefixes learned from another routing protocol. Redistribution is useful but risky: route maps, tags, administrative distance and feedback between protocols can create loops or unexpected preference. A successful OSPF neighbor state does not validate the safety of the redistributed route policy.
What happens when a link fails?
When a participating router detects a material topology change, relevant new LSAs are flooded through their permitted scope. Routers update their databases, schedule calculations and may install new routes. The time from a physical fault to a usable application path depends on detection, timers, platform processing, LSA propagation, SPF scheduling, route installation and the forwarding behavior of adjacent devices. There is no universal OSPF guarantee of zero packet loss or instantaneous convergence.
A simple failure exercise illustrates the distinction. A branch originally uses a low-cost primary WAN circuit and has a backup circuit with a higher configured cost. Disconnect the primary link in a maintenance window and observe which OSPF route becomes active, how long traffic is disrupted and whether applications reconnect correctly. Restore the primary and check whether routing returns as expected. If both circuits terminate at the same upstream physical point, the apparent redundant paths may still share a failure domain.
Interface cost should be calibrated to the intended routing policy rather than assumed from an old bandwidth default. Link speed can be one design input, but an expensive or metered circuit, a security inspection path and an application-sensitive route might justify explicit costs. Changes should be documented and tested because a small metric adjustment can affect many destinations at once.
Troubleshooting OSPF in the right order
Start with the symptom: is a neighbor missing, an LSDB incomplete, a route absent, or a route present but traffic failing? Those are different faults and require different evidence. For a missing neighbor, confirm interface state, IP connectivity, area ID, router IDs, timers, authentication and applicable network type. For neighbors stuck in ExStart or Exchange, investigate mismatched MTU and database exchange behavior rather than repeatedly restarting routing.
If the neighbor reaches Full state but the expected prefix is absent, inspect the advertisements and area boundaries first. Check whether the prefix is actually originated, whether summarization or filtering changes what another area receives, and whether redistribution is configured. Then inspect OSPF’s calculated route and the device’s installed routing table: route preference, a more-specific prefix, or another protocol can explain why an apparently healthy LSA does not become the chosen forwarding path.
On Cisco IOS-like systems, read-only diagnostics include show ip ospf neighbor, show ip ospf interface, show ip ospf database and show ip route ospf. Command availability and syntax vary by platform and version. The order matters more than memorizing a long command list: establish link health, adjacency, LSDB visibility, route selection and actual packet delivery. A route that looks correct may still be undermined by an ACL, an asymmetric return path, an MTU issue or a downstream device outside the OSPF domain.
For a deeper enterprise troubleshooting exercise involving OSPF, EIGRP and infrastructure failures, see Cisco 300-410 ENARSI: diagnosing OSPF and EIGRP failures. That practical context builds on the same control-plane and forwarding-plane distinction without treating every routing issue as a neighbor problem.
OSPF design and security considerations
OSPF is not a substitute for an access-control policy. Protect routing adjacency formation by limiting interfaces that participate, applying supported authentication or appropriate link/IP-layer protection, monitoring unexpected neighbors and controlling who can change interface costs or redistribution settings. The specific mechanisms differ between OSPFv2, OSPFv3, devices and software versions; never assume authentication settings carry over unchanged across them.
Plan for operations as well as initial reachability. Document area ownership, addressing, router IDs, interface costs, expected neighbors, default-route origin, external-route redistribution and the failover paths that have actually been exercised. Baseline neighbor and LSA behavior during healthy periods so incident responders know what changed. Review designs when introducing new sites, tunnels or route redistribution: OSPF can react to topological information, but it cannot verify that the application’s dependencies or network security controls are correct.
What to remember about Open Shortest Path First
OSPF builds routes from advertised topology and configured costs. It discovers neighbors, synchronizes relevant LSDB information, calculates paths and responds to topology changes. Areas improve scalability and external-route controls introduce additional policy. Successful operation means the intended prefixes are advertised, the correct routes are selected and traffic can flow—not merely that an adjacency displays Full.
For study or production troubleshooting, practice distinguishing an adjacency failure from a route selection failure and both from an application or forwarding problem. That sequence leads to better decisions than promises that OSPF always finds the fastest route, avoids all loops, or prevents downtime under any conditions.