Addressing and routingOSPFIntermediate29 min read

What Is OSPF in Networking?

Also known as: OSPF, Open Shortest Path First, OSPF definition, OSPF protocol, routing protocol

Reviewed byJohnson Ajibi· Senior Network & Security Engineer · MSc IT Security

This page mentions older exam versions. See the Current Exam Context and Legacy Exam Context sections below for the updated mapping.

On This Page

Quick Definition

OSPF stands for Open Shortest Path First. It is a routing protocol that helps routers talk to each other to find the fastest and most reliable path for data. It works by having each router share information about its connections, so every router builds a complete map of the network. When a link goes down, OSPF quickly updates the map and re-routes traffic.

Common Commands & Configuration

router ospf 1

Enters OSPF configuration mode with process ID 1. This is the first step to enable OSPF on a router.

Exams test that any process ID (1-65535) is locally significant but required; different routers can have different IDs.

network 192.168.1.0 0.0.0.255 area 0

Advertises the 192.168.1.0/24 network into OSPF area 0 (backbone area). Uses wildcard mask.

CCNA and Network+ questions often ask to identify the correct wildcard mask for a given subnet mask.

area 0 authentication message-digest

Enables MD5 authentication on area 0. Requires key configuration under each interface.

Security+ and CCNA exams test knowledge of OSPF authentication types: null, simple, and MD5.

ip ospf cost 10

Manually sets OSPF cost to 10 on an interface, overriding the default derived from bandwidth.

Exams test that cost is inversely proportional to bandwidth; this command overrides default path selection logic.

default-information originate always

Injects a default route (0.0.0.0/0) into OSPF even if no default route exists in the routing table.

show ip ospf neighbor

Displays all OSPF neighbors and their states (e.g., FULL, 2WAY, INIT).

CCNA troubleshooting questions frequently ask to interpret neighbor states (e.g., stuck in EXSTART/EXCHANGE) using this output.

clear ip ospf process

Resets the OSPF process, forcing re-establishment of all adjacencies and recalculation of the SPF tree.

Exams test this as a last-resort fix for OSPF convergence issues, but warn it causes temporary outage.

OSPF appears directly in 857exam-style practice questions in Courseiva's question bank — one of the most-tested concepts on Cisco CCNA. Practise them →

Must Know for Exams

OSPF appears in several major certification exams, and its coverage ranges from basic concepts to advanced configuration and troubleshooting. In the CompTIA Network+ (N10-008) exam, OSPF is tested at a conceptual level. Candidates must know that OSPF is a link-state routing protocol, that it uses cost as a metric, and that it supports areas and fast convergence. Questions are often multiple-choice or scenario-based, asking which protocol is best suited for a large network with high availability requirements.

The AWS Certified Solutions Architect (SAA-C03) exam covers OSPF in the context of AWS Direct Connect and transit gateways. Candidates need to understand OSPF as one of the routing protocols used to exchange routes between on-premises networks and AWS. The exam may present scenarios involving BGP, but OSPF knowledge is relevant when designing hybrid networks. For example, a question might describe a company using a virtual private network (VPN) and ask which dynamic protocol reduces administrative overhead, with OSPF being a correct choice.

The Microsoft Azure Administrator (AZ-104) exam also touches on OSPF, particularly when discussing Azure ExpressRoute and site-to-site VPNs. While Azure primarily uses BGP for routing, understanding OSPF helps in troubleshooting and designing hybrid connections. The exam may ask about routing protocols in the context of virtual network gateways and local network gateways.

The Cisco CCNA (200-301) exam is where OSPF receives the deepest treatment. Candidates must configure single-area OSPF, verify neighbor relationships, and troubleshoot OSPF issues. The exam includes command-line interface (CLI) questions where candidates interpret the output of "show ip ospf neighbor", "show ip route", and "show ip ospf interface". Configuration scenarios require writing OSPF network statements, setting router IDs, and adjusting timers. Troubleshooting questions often involve mismatched areas or interface costs.

The Google Professional Cloud Architect (Google-ACE) exam covers OSPF in the context of hybrid networking. Candidates must understand how OSPF operates over cloud VPN tunnels and how it integrates with Google Cloud's routing stack. The exam may present a scenario where a customer has multiple on-premises sites connected to Google Cloud via VPN, and the question asks which routing protocol ensures loop-free and efficient path selection.

The CompTIA Security+ (SY0-601) exam does not focus heavily on OSPF, but it may mention OSPF in the context of routing protocol security, such as the importance of authentication to prevent route spoofing. Candidates should know that OSPF supports MD5 authentication as a security measure.

Across all these exams, question types include multiple-choice, scenario-based, drag-and-drop, and command-output interpretation. Common question patterns include identifying OSPF characteristics, comparing OSPF to EIGRP, choosing the best protocol for a specific network design, and troubleshooting adjacency issues. Candidates who practice OSPF configuration and troubleshooting on actual routers or simulators will have a significant advantage.

Simple Meaning

Imagine you are a delivery driver in a large city with many roads, intersections, and neighborhoods. Your job is to deliver packages from a central warehouse to homes and businesses all over the city. To do your job efficiently, you need a map that shows every street, every intersection, and every one-way road. Now, think of every router in a network as a delivery driver. Routers send data packets, not packages, but the challenge is the same: find the best path from point A to point B.

OSPF is like a smart GPS system that gives every router a complete, up-to-date map of the entire network. In older routing methods, routers only knew about their immediate neighbors, like a driver who only knows the next block and has to guess the rest. OSPF is different. Every router using OSPF sends out messages called Link State Advertisements, or LSAs, telling all other routers about its directly connected links and their status.

Think of each LSA as a small update about a single street: "I am Router A, and I have a high-speed connection to Router B that costs 10 points, and a slower connection to Router C that costs 20 points." Every router receives these updates from every other router, and they all build the same detailed map, known as the Link State Database. This is like every delivery driver in the city having the same master map that shows every road and its current condition.

Once the map is built, each router runs the Dijkstra algorithm, named after the computer scientist who invented it. This algorithm calculates the shortest path from every router to every destination. The algorithm considers the cost of each link, which is usually based on bandwidth. A fast fiber link might have a cost of 1, while a slower DSL link might have a cost of 10. The router then builds a routing table with the best paths.

If a road closes or a new highway opens, OSPF does not wait for a timer to update. It immediately floods a new LSA to every router, and every router recalculates its paths. This is why OSPF is called a dynamic routing protocol. It constantly adapts to changes. This makes OSPF very reliable for large networks like corporate campuses, internet backbones, and data centers where traffic patterns are always changing.

OSPF also organizes large networks into smaller areas, like dividing a big city into boroughs. This limits the amount of map information each router needs to store and process, making the system more efficient. A router in one area only needs a detailed map of its own area and a general idea of how to reach other areas. This keeps the system fast and scalable.

OSPF is a protocol that allows routers to share information about the network topology so that every router has a complete, accurate picture. It uses this picture to find the fastest and most reliable paths, and it updates those paths quickly when something changes. For anyone working with IT networks, understanding OSPF is essential because it is one of the most widely used interior gateway protocols in the world.

Full Technical Definition

OSPF (Open Shortest Path First) is an interior gateway protocol (IGP) that operates within a single autonomous system (AS). It is defined in RFC 2328 for IPv4 and RFC 5340 for IPv6 (OSPFv3). OSPF is a link-state routing protocol, meaning that each router maintains a complete view of the network topology by exchanging link-state advertisements (LSAs) with all other routers in the same OSPF area. This differs from distance-vector protocols like RIP (Routing Information Protocol), which only know the distance and direction to a destination.

OSPF uses the Dijkstra shortest path first (SPF) algorithm to compute the best path to each destination. The algorithm calculates the shortest path tree with the router itself as the root. The metric used by OSPF is cost, which is inversely proportional to the bandwidth of the link. By default, the cost is calculated as 100 Mbps / interface bandwidth. For example, a 100 Mbps Fast Ethernet link has a cost of 1, while a 10 Mbps Ethernet link has a cost of 10. Network administrators can manually set the cost to influence path selection.

The OSPF protocol operates by sending Hello packets to discover neighbors and establish adjacencies. Hello packets are multicast to 224.0.0.5 (AllSPFRouters) on broadcast networks like Ethernet. Once two routers form a neighbor relationship, they go through several states: Down, Init, 2-Way, ExStart, Exchange, Loading, and Full. The 2-Way state indicates that bidirectional communication has been established, and in broadcast networks, one router is elected as the Designated Router (DR) and another as the Backup Designated Router (BDR) to reduce the number of adjacencies. The DR and BDR are elected based on the highest OSPF priority (0-255) or, if ties, the highest Router ID.

LSAs are the core of OSPF operation. There are several types of LSAs: Type 1 (Router LSA) describes the router's interfaces and their state; Type 2 (Network LSA) is generated by the DR on broadcast networks and lists all routers connected to the segment; Type 3 (Summary LSA) is used by Area Border Routers (ABRs) to advertise networks from one area to another; Type 4 (ASBR Summary LSA) advertises the location of an Autonomous System Boundary Router (ASBR); Type 5 (AS External LSA) advertises external routes redistributed into OSPF; Type 7 (NSSA External LSA) is used in Not-So-Stubby Areas for external routes. Each LSA is identified by a Link State ID and an Advertising Router, and is aged to ensure freshness.

OSPF supports hierarchical routing through the use of areas. The backbone area is Area 0 (0.0.0.0), and all other areas must connect to Area 0. This design prevents routes from being flooded across the entire network, reducing CPU and memory usage. Routers are classified by their role: Internal Router (all interfaces in one area), Area Border Router (ABR) (interfaces in multiple areas, including Area 0), Backbone Router (at least one interface in Area 0), and Autonomous System Boundary Router (ASBR) (redistributes routes from outside the OSPF domain, such as static routes or routes from another protocol like BGP).

OSPF uses a hierarchical area design to optimize performance. The backbone area (Area 0) must be contiguous and all other areas must connect to it, either directly or through a virtual link. Stub areas restrict the types of LSAs they accept to reduce the routing table size. A stub area does not allow Type 5 LSAs (external routes). Totally stubby areas further restrict Type 3 and Type 4 LSAs, allowing only a default route. Not-So-Stubby Areas (NSSA) allow Type 7 LSAs to carry external routes while still preventing Type 5 LSAs.

Authentication is supported in OSPF to protect against malicious routing updates. OSPF can use null authentication (no security), simple password authentication (plain text, easily compromised), or MD5 cryptographic authentication (more secure). In modern networks, MD5 or higher is recommended. Timers are also critical: the Hello interval (default 10 seconds on broadcast networks) determines how often Hello packets are sent. The Dead interval (default 40 seconds) specifies how long a router waits without receiving a Hello before declaring the neighbor down. These timers must match between neighbors for an adjacency to form.

In real IT implementations, OSPF is configured on routers and Layer 3 switches using commands like "router ospf <process-id>" in Cisco IOS, followed by network statements to advertise interfaces. For example, "network 192.168.1.0 0.0.0.255 area 0" tells OSPF to include the 192.168.1.0/24 network in Area 0. The process ID is local to the router and does not need to match between neighbors. Loopback interfaces are often used as Router IDs for stability. OSPF also supports passive interfaces, which listen for Hello packets but do not send them, often used on interfaces connected to end users.

OSPF is widely used in enterprise networks, internet service provider backbones, and data centers due to its fast convergence, support for Variable Length Subnet Masks (VLSM), and ability to scale to large networks. It is an open standard, meaning it works across different vendors, unlike Cisco's EIGRP which is proprietary. OSPFv3, used for IPv6, has similar mechanics but operates directly on the IPv6 network layer.

Real-Life Example

Think of a large office building with many floors, each floor having its own mailroom. The mailrooms are connected by a system of pneumatic tubes, elevators, and stairs that can be used to send envelopes between floors. The building manager, Sarah, wants to ensure that any envelope sent from one floor to another takes the absolute fastest route, considering that some tubes are broken, some elevators are slow, and some stairs are blocked by maintenance.

Sarah's solution is to give each mailroom a complete, current map of every connection between floors. This is exactly what OSPF does. Each mailroom (router) announces its working connections (links) to all other mailrooms. For example, the mailroom on Floor 3 might announce: "I have a fast pneumatic tube to Floor 5 that takes 2 seconds, and a slow elevator to Floor 2 that takes 10 seconds." Every mailroom receives these announcements and builds the same master map.

Now, when the mailroom on Floor 1 needs to send an envelope to Floor 7, it consults its map. It sees multiple possible paths: through Floor 2 and Floor 4, or through Floor 3 and Floor 5. It calculates the total cost for each path by adding up the individual link costs. It chooses the path with the lowest total cost. This is the Dijkstra algorithm in action.

One day, the pneumatic tube between Floor 3 and Floor 5 breaks. The mailroom on Floor 3 detects the failure because it stops receiving a regular "I'm okay" signal from Floor 5 (the Hello protocol). Immediately, Floor 3 sends out an update to all other mailrooms: "Connection to Floor 5 is down." Every mailroom updates its map and recalculates the best paths. Envelopes are now rerouted within seconds, avoiding the broken tube.

To keep the map manageable, the building is divided into wings: East Wing (Area 1), West Wing (Area 2), and the central core (Area 0). Mailrooms in the East Wing only need a detailed map of the East Wing and a simplified map of the rest of the building. This is how OSPF areas reduce the amount of routing information each router must process.

In this analogy, the mailrooms are routers, the connections are links, the announcements are LSAs, the master map is the link-state database, and the path calculation is the SPF algorithm. The broken tube is a link failure, and the rerouting is OSPF's fast convergence. The wing divisions are OSPF areas, and the central core is Area 0, the backbone area.

This real-life example shows how OSPF ensures that data always finds the best path, automatically adjusting to changes in the network. Without OSPF, network administrators would have to manually update routing tables every time a link went down or a new connection was added, which would be impractical in large networks.

Why This Term Matters

OSPF matters because it is one of the most widely deployed interior gateway protocols in enterprise networks, internet service provider backbones, and data centers. Understanding OSPF is critical for network engineers, system administrators, and IT support professionals because it directly impacts network performance, reliability, and scalability.

In practical IT operations, OSPF provides fast convergence. When a link fails, OSPF detects the failure within seconds and recalculates paths, minimizing downtime. This is especially important for critical applications like VoIP, video conferencing, and financial transactions where even a few seconds of downtime can cause significant disruption. Without OSPF, network administrators would have to manually update routing tables on every affected router, which is error-prone and slow.

OSPF also supports large networks through its hierarchical area design. By dividing a network into areas, OSPF reduces the amount of routing information that each router must store and process. This makes the protocol scalable to thousands of routers, which is essential for large organizations and service providers. For example, a global enterprise might have thousands of routers across hundreds of sites, and OSPF allows them to be managed efficiently.

Another reason OSPF matters is its openness. As an open standard, OSPF works across routers from different vendors, such as Cisco, Juniper, Huawei, and open-source platforms like Linux (Quagga or FRRouting). This gives organizations flexibility and avoids vendor lock-in. In mixed-vendor environments, OSPF is often the protocol of choice.

Finally, OSPF is a core topic in many IT certification exams, including the Cisco CCNA, CompTIA Network+, AWS Solutions Architect, and Azure Administrator exams. Candidates who understand OSPF demonstrate a deep understanding of routing concepts, network troubleshooting, and infrastructure design. For exam takers, mastering OSPF is not optional; it is a requirement for passing many certification exams.

How It Appears in Exam Questions

OSPF questions appear in several distinct patterns across certification exams. The most common type is the conceptual multiple-choice question. For example, a question might ask: "Which of the following is true about OSPF?" with options like "It is a distance-vector protocol, It uses hop count as a metric, It is a link-state protocol, It requires weekly manual updates." The correct answer is "It is a link-state protocol." This type of question tests basic understanding.

Another common pattern is scenario-based questions. The exam provides a network scenario with a topology diagram or description. For example: "A company has four routers in a single area. Router A needs to send data to Router D. The link costs are as follows: A to B cost 10, B to D cost 5, A to C cost 2, C to D cost 8. Which path will OSPF choose?" Candidates must calculate the cumulative cost: A-B-D is 15, A-C-D is 10. The correct answer is A-C-D, as OSPF always selects the path with the lowest total cost.

Configuration questions are common in the CCNA exam. Candidates might see a partial configuration and be asked to complete it. For instance: "Which command configures OSPF on interface GigabitEthernet0/0 with IP 192.168.1.1/24 in area 0?" The answer might be a network statement like "network 192.168.1.0 0.0.0.255 area 0" or the newer interface-level configuration "ip ospf 1 area 0."

Troubleshooting questions present a problem and ask for the root cause. For example: "Two OSPF routers are connected but do not become neighbors. show ip ospf neighbor output shows nothing. What is a likely cause?" Options might include mismatched area IDs, mismatched hello timers, IP address mismatch, or a firewall blocking multicast. The correct answer could be mismatched hello timers (one router using 10 seconds, the other using 30 seconds) because Hello and Dead intervals must match.

Output interpretation questions show the results of commands like "show ip ospf neighbor" or "show ip ospf database." For example: "Router R1 shows a neighbor in the FULL state, but the neighbor router R2 shows a neighbor in the 2WAY state. What does this indicate?" The answer: On a broadcast network, the DR and BDR form FULL adjacencies with all routers, while non-DR routers only form FULL with the DR and BDR. Two non-DR routers remain in 2WAY state, which is normal.

Design questions appear in cloud architect exams. For instance: "A company has multiple offices connected via VPN to a cloud provider. They need a routing protocol that converges quickly and supports VLANS. Which protocol should they use?" OSPF is a suitable answer because it is link-state and supports VLSM.

Finally, security-related questions might ask: "Which authentication method does OSPF support to prevent route injection attacks?" The answer: MD5 cryptographic authentication. By understanding these question patterns, candidates can focus their study on the most testable aspects of OSPF.

Practise OSPF Questions

Test your understanding with exam-style practice questions.

Practise

Example Scenario

You are the IT administrator for a small company with three floors in an office building. Each floor has a router. Router A is on Floor 1, Router B on Floor 2, and Router C on Floor 3. They are connected in a straight line: A is connected to B, and B is connected to C. The connection between A and B is a 100 Mbps Ethernet link, so OSPF assigns it a cost of 1. The connection between B and C is a slower 10 Mbps link, so OSPF assigns it a cost of 10.

You want all routers to automatically find the best path to each other. You configure OSPF on all three routers with the same area, Area 0. After configuration, each router sends Hello packets to discover its neighbors. Router A and Router B become neighbors. Router B and Router C become neighbors. They exchange LSAs, so each router builds a complete map. Router A learns that to reach Router C, it can go directly through Router B with a total cost of 1 + 10 = 11.

Now, a new link is added between Router A and Router C directly. This link is a 1000 Mbps fiber, so OSPF assigns it a cost of 0.1 (if using the default formula). Router A and Router C become neighbors and exchange LSAs. Now Router A sees two paths to Router C: the old path through B costing 11, and the new direct path costing 0.1. OSPF automatically updates the routing table to use the direct path. If the fiber link fails, OSPF detects the loss of Hello packets within 40 seconds, updates the LSA, and all routers revert to the backup path through B.

In this scenario, OSPF has accomplished automatic path selection, fast convergence, and loop-free routing. Without OSPF, you would have had to manually reconfigure static routes every time a link was added or removed, which is tedious and error-prone. For the exam, this scenario demonstrates how OSPF adapts to network changes and chooses the lowest cost path.

Common Mistakes

Thinking OSPF is a distance-vector protocol like RIP

OSPF is a link-state protocol, not distance-vector. Distance-vector protocols only know the next hop and the distance, while OSPF has a complete map of the network.

Remember: OSPF = Open Shortest Path First = Link State. RIP = Routing Information Protocol = Distance Vector.

Confusing OSPF's metric (cost) with hop count

OSPF cost is based on bandwidth, not hops. A path with more hops but higher bandwidth links might have a lower cost than a shorter path with slower links.

Understand that OSPF cost is inversely proportional to bandwidth. 100 Mbps link cost = 1, 10 Mbps link cost = 10. A route with 2 fast hops (cost 2) beats 1 slow hop (cost 10).

Assuming OSPF hello timers can be different between neighbors

OSPF requires that Hello and Dead intervals match exactly between two routers for them to form an adjacency. If they do not match, the routers will not become neighbors.

Always verify that 'ip ospf hello-interval' and 'ip ospf dead-interval' are identical on both sides of a link.

Thinking all routers must be in area 0

While all areas must connect to area 0, internal routers can be in non-zero areas (e.g., area 1, area 2). Only routers with interfaces in multiple areas are ABRs.

Remember: Area 0 is the backbone. Other areas connect to it. A router can be in area 0 only, area 1 only, or be an ABR connecting both.

Confusing OSPF with BGP

BGP is an exterior gateway protocol for routing between autonomous systems (like ISPs). OSPF is an interior gateway protocol for routing within one AS. They operate at different scales.

OSPF = inside your network (IGP). BGP = between networks (EGP).

Misunderstanding the role of DR and BDR

Some think every pair of routers needs a direct adjacency. But in broadcast networks, only the DR and BDR form full adjacencies with all routers; non-DR routers only fully connect to DR/BDR, staying in 2WAY state with each other.

On a switch (broadcast network), only DR and BDR form FULL adjacencies with everyone. Other routers remain in 2WAY state between themselves.

Forgetting that authentication must match on both ends

If one router has MD5 authentication enabled and the neighbor has no authentication, the adjacency will not form. The authentication type and key must match.

When using OSPF authentication, configure identical type (null, simple, or MD5) and same key on both routers.

Exam Trap — Don't Get Fooled

{"trap":"An exam question shows two routers with OSPF configured, but they are not becoming neighbors. The output of 'show ip ospf neighbor' is empty. One router has an OSPF process ID of 1, and the other has a process ID of 100.

The question asks why they are not forming an adjacency.","why_learners_choose_it":"Learners often think that the OSPF process ID must match between neighboring routers because it seems intuitive that a process number should be consistent. This is a common misconception because other protocols sometimes require matching IDs."

,"how_to_avoid_it":"Remember that the OSPF process ID is local to the router. It is only used to identify the routing process on that single device. Two routers can have different process IDs and still become neighbors.

Instead, check other OSPF parameters: area ID, network type (broadcast vs. point-to-point), hello/dead timers, subnet masks, and authentication. These must match."

Commonly Confused With

OSPFvsEIGRP

EIGRP is a Cisco proprietary hybrid routing protocol that combines distance-vector and link-state features. Unlike OSPF, EIGRP uses bandwidth and delay as default metrics (not just cost), and it stores routes in a topology table. EIGRP converges faster in some scenarios but is not an open standard.

If you have a pure Cisco network, you might choose EIGRP; if you need multi-vendor support, choose OSPF.

OSPFvsRIP

RIP (Routing Information Protocol) is a distance-vector protocol that uses hop count as a metric (max 15 hops). It has slower convergence and does not support VLSM efficiently. OSPF is more scalable, converges faster, and uses bandwidth-based cost.

For a large enterprise network with hundreds of routers, OSPF is a better choice than RIP.

OSPFvsBGP

BGP is an exterior gateway protocol used for routing between autonomous systems, like between ISPs or between an enterprise and its ISP. OSPF operates within a single AS. BGP uses path attributes (like AS path) instead of cost. OSPF is simpler for internal routing.

Your company's internal network runs OSPF, but to connect to the internet, you use BGP to exchange routes with your ISP.

OSPFvsIS-IS

IS-IS (Intermediate System to Intermediate System) is also a link-state protocol similar to OSPF. Both use the SPF algorithm. Key differences: IS-IS runs on the data link layer (Layer 2), while OSPF runs on IP (Layer 3). IS-IS can support CLNS and IPv4/IPv6 natively, but OSPF is more common in enterprise networks.

Large ISPs often use IS-IS for their core backbones, while enterprises typically use OSPF.

OSPFvsStatic Routing

Static routing requires an administrator to manually configure each route on each router. It does not adapt to network changes. OSPF dynamically learns and adapts. Static routing is fine for small, stable networks, but OSPF is necessary for dynamic or large networks.

A small branch office with one router and one ISP link might use a static default route. A corporate campus with many routers uses OSPF.

Step-by-Step Breakdown

1

Router sends Hello packets

Each OSPF-enabled router sends Hello packets on its interfaces to discover neighbors. On broadcast networks like Ethernet, these are multicast to 224.0.0.5. The Hello interval is 10 seconds by default on broadcast networks. The packet contains the router's Router ID, area ID, and timers.

2

Neighbor discovery and 2-Way state

When two routers receive each other's Hello packets with matching parameters (area, timers, authentication, subnet), they enter the 2-Way state. This means bidirectional communication is established. On broadcast networks, this is also when the Designated Router and Backup Designated Router are elected.

3

Database synchronization and ExStart state

The two routers agree on which router will be the master and which will be the slave for the exchange of database information. They enter the ExStart state and exchange Database Description (DBD) packets, which are summaries of their link-state databases.

4

Exchange state

The routers send DBDs to each other, describing all LSAs they know about. Each router compares the list with its own database. If a router sees that it is missing an LSA, it marks it as needed.

5

Loading state

Routers request the full LSAs they are missing by sending Link State Request (LSR) packets. The other router responds with Link State Update (LSU) packets containing the requested LSAs. Link State Acknowledgement (LSAck) packets confirm receipt.

6

Full state

Once all LSAs are exchanged and synchronized, the routers enter the Full state. This means they have identical link-state databases. The adjacency is fully established, and routing information can be used for SPF calculations.

7

SPF calculation and routing table update

Each router independently runs the Dijkstra algorithm on its link-state database to compute the shortest path tree with itself as the root. The best paths are installed in the routing table. If the network topology changes (a link goes up or down), the process begins again with a new LSA flood.

8

LSA aging and refresh

Each LSA has a timer (default 30 minutes, or MaxAge). Routers periodically refresh their own LSAs before they expire. If an LSA is not refreshed and reaches MaxAge, it is flushed from the database, and the SPF algorithm recalculates paths. This ensures old or invalid information is removed.

Practical Mini-Lesson

In practice, configuring OSPF requires careful planning and attention to detail. The first step is to assign Router IDs. Without explicit configuration, the router selects the highest IP address on a loopback interface, or if there is no loopback, the highest IP on a physical interface. For stability, it is best to manually assign a Router ID using the command 'router-id X.X.X.X' in OSPF router configuration mode. This prevents Router ID changes when interfaces go down.

Next, you must configure the network type. By default, Ethernet interfaces are broadcast networks, which require DR/BDR elections and have multicast traffic. Point-to-point links (like serial connections) are simpler, without elections. For faster convergence and lower overhead, configure the network type as point-to-point if both ends are directly connected, using 'ip ospf network point-to-point' on Cisco devices. This eliminates the DR/BDR election and speeds up the OSPF adjacency.

Another critical practice is to use passive interfaces on links that do not have routers on the other end, such as ports connecting to end users. The command 'passive-interface default' in OSPF router mode makes all interfaces passive, then 'no passive-interface <interface>' enables OSPF only on interfaces that connect to other routers. This prevents unnecessary OSPF traffic and improves security.

Common issues in production networks include mismatched area IDs, incorrect subnet masks, and firewall rules blocking OSPF multicast addresses (224.0.0.5 and 224.0.0.6). Always verify that interfaces are up, IP addresses are in the correct subnet, and OSPF is not administratively disabled on the interface. Use 'show ip ospf neighbor' to verify adjacencies and 'show ip route ospf' to see learned routes.

When troubleshooting OSPF, the most common command is 'show ip ospf neighbor'. If the output is empty, check the Hello and Dead timers. Use 'show ip ospf interface <interface>' to see the current timer values. If timers match, check the area ID. On Cisco devices, the network statement includes the wildcard mask and area. For example, 'network 10.0.0.0 0.255.255.255 area 0' will advertise any interface with an IP that starts with 10. Misconfigured network statements can cause a router to not advertise its interfaces.

Finally, remember that OSPF is a CPU-intensive protocol. In very large networks, frequent SPF calculations can consume resources. Tune SPF timers using 'timers throttle spf' to dampen the effect of network flaps. The default timers are 10 milliseconds (initial delay), 1000 milliseconds (initial hold time), and 5000 milliseconds (maximum hold time). Adjusting these can prevent constant recalculations during instability.

Troubleshooting Clues

OSPF neighbor stuck in INIT state

Symptom: Router shows neighbor state as INIT and never transitions to 2WAY or FULL.

INIT state means the router has received a Hello but not seen its own Router ID in the neighbor's Hello; typically mismatched subnet masks or ACL blocking multicasts.

Exam clue: Exam questions describe OSPF adjacency failures and ask to identify why the state stays INIT (e.g., wrong subnet mask on interface).

OSPF neighbor stuck in EXSTART/EXCHANGE

Symptom: Neighbor state remains in EXSTART or EXCHANGE, never reaching FULL.

Caused by MTU mismatch between interfaces; in EXSTART, routers negotiate master/slave and DB descriptions, failing if MTU differs.

Exam clue: CCNA questions often present a scenario with one end having MTU 1500 and the other 1400, causing EXSTART stuck state.

OSPF routes not appearing in routing table

Symptom: show ip route shows no OSPF-learned routes even though neighbors are FULL.

Possible reasons: passive interface, network statement missing the subnet, wrong area, or route filtering via distribute-list.

Exam clue: Network+ and Azure AZ-104 exams test that a passive interface prevents OSPF from sending/receiving Hellos, blocking neighbor formation.

OSPF designated router (DR) election instability

Symptom: Frequent DR/BDR changes causing routing table flapping.

DR election is based on highest OSPF priority (default 1) and Router ID; if priorities are equal and Router IDs change, election repeats.

Exam clue: Exam scenarios ask why DR keeps changing-answer: Router ID changed due to a new loopback or interface flapping.

OSPF route has higher cost than expected

Symptom: Traffic takes a suboptimal path despite a lower-cost link available.

Default cost is 10^8 / bandwidth; if link bandwidth is auto-negotiated incorrectly (e.g., 100 Mbps vs 1 Gbps), cost becomes higher.

Exam clue: AWS-SAA and Google ACE exams include questions where manual cost override (ip ospf cost) is the fix for asymmetric routing.

OSPF router ID conflict

Symptom: Neighbor adjacency flaps with 'Duplicate router ID' log messages.

Two routers in the same OSPF domain have the same Router ID (usually from a loopback or highest IP); OSPF requires unique IDs.

Exam clue: Security+ and CCNA questions test that a Router ID change requires 'clear ip ospf process' to take effect.

OSPF not forming adjacency over a VPN tunnel

Symptom: Neighbor state shows DOWN or ATTEMPT; no Hellos received.

GRE tunnel or IPsec VPN may have MTU/MSS issues, or multicast (224.0.0.5) is not forwarded across the tunnel.

Exam clue: Azure AZ-104 and AWS-SAA scenarios test that OSPF over VPN needs multicast routing enabled and correct tunnel interface configuration.

Memory Tip

**OSPF** = **O**pen **S**hortest **P**ath **F**irst. Think of a **map** that every router has. To remember the metric: **C**ost = 100 Mbps / bandwidth. To remember the neighbor states: **D**own, **I**nit, **2**-Way, **E**xStart, **E**xchange, **L**oading, **F**ull. The acronym is DIE 2 ELF.

Learn This Topic Fully

This glossary page explains what OSPF means. For a complete lesson with labs and practice, see the topic guide.

Covered in These Exams

Current Exam Context

Current exam versions that test this topic — use these objectives when studying.

Legacy Exam Context

Older materials may mention these exam versions, but learners should use the current objectives for their target exam.

N10-008N10-009(current version)
SY0-601SY0-701(current version)

Related Glossary Terms

Quick Knowledge Check

1.Which OSPF state indicates that a router has received a Hello packet but not yet seen its own Router ID in the neighbor's Hello?

2.What is the default OSPF cost for a 100 Mbps Ethernet interface?

3.Which command configures OSPF to advertise a default route into the OSPF domain?

4.Two OSPF routers are stuck in EXSTART state. What is the most likely cause?

5.In OSPF, what is the purpose of the 'backbone area' (area 0)?

Summary

OSPF is a powerful and widely used routing protocol that helps networks operate efficiently and reliably by finding the best path for data based on link speed and availability. It is an open standard, meaning it works across different vendors equipment, making it a versatile choice for enterprise networks, data centers, and cloud hybrid environments. OSPF uses a link-state approach where each router maintains a complete map of the network and calculates the shortest path using the Dijkstra algorithm.

This allows for fast convergence when links fail or change, which keeps applications running and users happy. For IT certification exams such as CCNA, Network+, and cloud provider exams, OSPF is a core topic that tests your understanding of how routers communicate, how metrics are calculated, and how to configure and troubleshoot routing. Remember that OSPF uses cost not hops, sends updates only on change not periodically, operates within one autonomous system, and uses areas to scale.

Avoid common mistakes like confusing OSPF with RIP or BGP, using subnet masks instead of wildcard masks, or misidentifying administrative distances. When you master OSPF, you have a strong foundation in routing that will serve you throughout your IT career.