CCNA OSPF Configuration: Free Practice Questions + Study Guide

MB
Moussa BENALI
Senior Network & Security Engineer · 6+ years of experience designing and securing enterprise networks. CCNA, Security+, and AWS certified.
Verified for CCNA 200-301 · Feb 2026

What is OSPF?

Open Shortest Path First (OSPF) is a link-state routing protocol used in large enterprise networks. Unlike distance-vector protocols like RIP, OSPF builds a complete map of the network topology (the Link-State Database or LSDB) and uses Dijkstra's Shortest Path First (SPF) algorithm to calculate the best path to every destination.

OSPF is an interior gateway protocol (IGP) defined in RFC 2328. It's the most widely deployed IGP in enterprise networks and a critical topic on the CCNA 200-301 exam.

📝
CCNA Exam Note: OSPF falls under the IP Routing domain, which represents approximately 25% of the CCNA 200-301 exam. You need to understand both single-area and multi-area OSPF concepts.

Key characteristics of OSPF:

  • Link-state protocol - routers share link-state advertisements (LSAs) to build a complete topology map
  • Uses SPF algorithm - calculates the shortest path tree from the LSDB
  • Hierarchical design - uses areas to reduce LSDB size and SPF computation
  • Fast convergence - detects changes quickly and recalculates routes
  • Classless - supports VLSM and CIDR
  • Administrative distance of 110 - lower than IS-IS (115) but higher than EIGRP (90)

OSPF Area Types

OSPF uses a hierarchical design with areas to scale efficiently. All areas must connect to the backbone area (Area 0). Here are the key area types you need to know:

Area Type Allows External LSAs? Default Route? Use Case
Backbone (Area 0) Yes No (not automatic) Central area connecting all others
Normal Area Yes No Standard non-backbone area
Stub Area No (blocks Type 5) Yes (injected by ABR) Areas with single exit point
Totally Stubby Area No (blocks Type 3, 4, 5) Yes Maximum LSDB reduction
NSSA No Type 5 (uses Type 7) Optional Stub area that needs limited external routes
💡
Tip: Remember that all routers in a stub area must agree on the stub configuration. You can't have one router configured as stub and another as normal in the same area.

OSPF Neighbor Adjacency & States

Before OSPF routers can exchange routing information, they must form a neighbor adjacency. OSPF neighbors go through several states before becoming fully adjacent:

  1. Down - No Hello packets received from neighbor
  2. Init - Hello received but own Router ID not seen in neighbor's Hello
  3. 2-Way - Bidirectional communication established; DR/BDR election occurs here
  4. ExStart - Master/Slave relationship established for DBD exchange
  5. Exchange - DBD (Database Description) packets exchanged
  6. Loading - LSR/LSU packets exchanged for missing LSAs
  7. Full - LSDBs synchronized; routers are fully adjacent
Key Concept: For two OSPF routers to form a neighbor relationship, they must match on: Hello/Dead timers, Area ID, subnet and mask, authentication, and stub area flag. A mismatch in any of these prevents adjacency.

Use show ip ospf neighbor to verify neighbor states. The most common states you'll see in a healthy network are FULL (on point-to-point and DR/BDR relationships) and 2-WAY (between DROther routers on multi-access networks).

DR/BDR Election Process

On multi-access networks (like Ethernet), OSPF elects a Designated Router (DR) and Backup Designated Router (BDR) to reduce the number of adjacencies and LSA flooding.

The election process works as follows:

  1. Router with the highest OSPF priority becomes DR (default priority = 1)
  2. If priorities are equal, the router with the highest Router ID wins
  3. Second highest becomes BDR
  4. All other routers become DROther
  5. Setting priority to 0 prevents a router from participating in the election
⚠️
Important: The DR/BDR election is non-preemptive. If a router with higher priority joins later, it does NOT automatically become DR. The election only re-occurs when the current DR fails.

Configure OSPF priority on an interface:

IOS Configuration
interface GigabitEthernet0/0
 ip ospf priority 200

OSPF Configuration Commands

Here's how to configure basic single-area OSPF on a Cisco router:

Basic OSPF Configuration
! Enable OSPF process (process ID is locally significant)
router ospf 1

! Advertise networks into OSPF Area 0
network 10.1.1.0 0.0.0.255 area 0
network 10.1.2.0 0.0.0.255 area 0

! Set Router ID explicitly (recommended)
router-id 1.1.1.1

! Prevent OSPF on interfaces facing end devices
passive-interface GigabitEthernet0/2

! Set reference bandwidth to match modern links
auto-cost reference-bandwidth 10000

Key points about OSPF configuration:

  • The process ID (e.g., router ospf 1) is locally significant - it doesn't need to match between neighbors
  • The network command uses a wildcard mask (inverse of subnet mask)
  • passive-interface suppresses OSPF Hello packets on that interface but still advertises the network
  • router-id should be set explicitly; otherwise OSPF uses the highest loopback IP, then highest physical IP

Useful verification commands:

OSPF Verification
show ip ospf neighbor          ! View neighbor table and states
show ip route ospf             ! View OSPF-learned routes
show ip ospf interface brief   ! View OSPF-enabled interfaces
show ip ospf database          ! View the LSDB

OSPF Cost & Path Selection

OSPF uses cost as its metric. The cost is calculated as:

📐
OSPF Cost Formula: Cost = Reference Bandwidth / Interface Bandwidth
Default reference bandwidth = 100 Mbps. Minimum cost = 1.
Interface Bandwidth Default Cost Cost (ref=10000)
FastEthernet100 Mbps1100
GigabitEthernet1 Gbps110
10 GigabitEthernet10 Gbps11
⚠️
Problem: With the default reference bandwidth (100 Mbps), FastEthernet, GigabitEthernet, and 10 GigE all have a cost of 1 - OSPF can't differentiate between them! Always set auto-cost reference-bandwidth 10000 or higher on all routers.

OSPF selects the path with the lowest total cost from source to destination. The total cost is the sum of all outgoing interface costs along the path.

Included with Exam Purchase

Get the Complete CCNA Study Guide

When you purchase a CCNA practice exam, you get full access to our comprehensive study guides covering every exam topic in depth - not just the free samples here.

All CCNA topics covered Detailed explanations 10 free preview pages
Create Free Account to Preview

CCNA OSPF Practice Questions

Test your understanding with these 5 expert-created questions. Each includes a detailed explanation to reinforce your learning.

Ready for More?

You've just covered OSPF Configuration. Here's how to keep preparing for your CCNA:

Frequently Asked Questions

Is OSPF covered on the CCNA 200-301 exam?

Yes, OSPF is a major topic on the CCNA 200-301 exam. It falls under the "IP Routing" domain, which represents approximately 25% of the exam. You need to understand single-area and multi-area OSPF concepts, configuration, neighbor adjacencies, and troubleshooting.

What is the difference between OSPFv2 and OSPFv3?

OSPFv2 is used for IPv4 routing, while OSPFv3 was originally designed for IPv6 but now supports both IPv4 and IPv6 (with address families). OSPFv3 uses link-local addresses for neighbor communication and includes changes to LSA types. The CCNA exam primarily focuses on OSPFv2 for single-area configurations.

How many OSPF questions appear on the CCNA exam?

While Cisco doesn't disclose exact question counts per topic, OSPF is part of the IP Routing domain (25% of the exam). Expect approximately 5-10 questions related to OSPF concepts and configuration across the 100-120 question exam.

What OSPF concepts should I focus on for CCNA?

For CCNA, focus on: single-area OSPF configuration (router ospf, network command), OSPF neighbor adjacencies and states, DR/BDR election process, OSPF cost and path selection, basic multi-area concepts (area types, ABR), and OSPF troubleshooting (show ip ospf neighbor, show ip route ospf).