If you’re preparing for a job interview in networking or studying for CCNA/CCNP exams, mastering OSPF (Open Shortest Path First) is crucial. This widely used link-state protocol powers thousands of enterprise and ISP networks.
In this guide, you’ll find 50 carefully selected and updated OSPF interview questions and answers, covering topics from basics to expert-level troubleshooting. Whether you’re a fresher or an experienced professional, this post will give you the confidence to handle OSPF interview scenarios.
1. What is OSPF and what are its main characteristics?
Answer:
OSPF (Open Shortest Path First) is a link-state, interior gateway routing protocol developed by the IETF. It is an open standard, meaning it can run on devices from different vendors. Key characteristics include:
- Uses Dijkstra’s SPF algorithm
- Supports classless routing (VLSM/CIDR)
- Has fast convergence
- Divides networks into areas for scalability
- Utilizes cost as a metric
- Multicast-based communication (224.0.0.5 / 224.0.0.6)
2. What is the function of OSPF areas and how do they improve scalability?
Answer:
OSPF divides a network into hierarchical areas to reduce routing overhead.
- Backbone Area (Area 0) connects all other areas
- Standard Areas share link-state info with Area 0
- Stub/NSSA Areas restrict certain LSA types to reduce processing
Using areas helps control LSA flooding, improves route summarization, and enhances network performance.
3. What metric does OSPF use and how is it calculated?
Answer:
OSPF uses cost as its metric, calculated as:
Cost = Reference Bandwidth / Interface Bandwidth
- Default reference: 100 Mbps
- A 100 Mbps link = cost of 1
Use auto-cost reference-bandwidth to adjust this for faster interfaces (like Gigabit links).
4. What is a Router ID (RID) in OSPF and how is it selected?
Answer:
The Router ID is a 32-bit unique identifier (like an IP address) used to identify OSPF routers. Selection order:
- Manually configured using router-id command
- Highest IP address on a loopback interface
- Highest IP address on any active interface
RID remains fixed unless manually changed or the OSPF process is restarted.
5. What are the different OSPF packet types and their functions?
Answer:
OSPF uses 5 packet types:
- Hello: Discover and maintain neighbors
- DBD (Database Description): Share LSDB summaries
- LSR (Link-State Request): Ask for specific LSAs
- LSU (Link-State Update): Send new LSAs
- LSAck: Confirm receipt of LSAs
These ensure reliable and synchronized routing information exchange.
6. What are OSPF neighbor states?
Answer:
OSPF routers form adjacencies in stages:
- Down – No Hello received
- Attempt – Actively trying (NBMA)
- Init – Hello received
- 2-Way – Bidirectional communication
- ExStart – DR/BDR elected, master/slave decided
- Exchange – DBDs exchanged
- Loading – Missing LSAs requested via LSR
- Full – LSDBs are fully synchronized
Not all routers form full adjacency (e.g., non-DRs stay in 2-Way).
7. What is the difference between DR and BDR in OSPF?
Answer:
In broadcast and NBMA networks, OSPF elects:
- Designated Router (DR): Central point for LSA exchange
- Backup DR (BDR): Takes over if DR fails
Other routers form full adjacency only with the DR and BDR to reduce LSA flooding.
Election is based on highest priority, then highest RID if tied.
8. What is the function of the OSPF Hello packet?
Answer:
Hello packets are used to:
- Discover neighbors
- Maintain adjacency
- Agree on parameters (timers, RID, area, etc.)
- Participate in DR/BDR election
Sent every 10 seconds (default on broadcast networks) to 224.0.0.5.
9. What are the multicast addresses used in OSPF?
Answer:
OSPF uses:
- 224.0.0.5 – All OSPF routers
- 224.0.0.6 – All DR/BDR routers
These multicast addresses optimize LSA delivery and neighbor formation on multi-access networks.
10. What is the purpose of different OSPF network types?
Answer:
OSPF supports several network types to match different physical topologies:
Type | Characteristics |
Broadcast | Supports DR/BDR; e.g., Ethernet |
Point-to-Point | No DR/BDR; direct adjacency |
NBMA | Manual neighbor config needed; e.g., Frame Relay |
Point-to-Multipoint | No DR/BDR; treats all links as separate |
Choosing the right type ensures efficient neighbor discovery and LSA propagation.
11. What is Dijkstra’s algorithm and how is it used in OSPF?
Answer:
OSPF uses Dijkstra’s Shortest Path First (SPF) algorithm to compute the best path to each network. The algorithm operates on the Link-State Database (LSDB) and calculates the shortest path tree by comparing cost metrics of all known routes.
This ensures loop-free, deterministic routing in OSPF domains.
12. What is the Link-State Database (LSDB) in OSPF?
Answer:
The LSDB is a collection of all Link-State Advertisements (LSAs) that a router receives from its area.
Every router maintains an identical LSDB for its area.
It’s used by the SPF algorithm to build the routing table.
Synchronization of LSDBs between routers is what ensures consistent and accurate route computation.
13. What are the different types of LSAs in OSPF and their purposes?
Answer:
Here are the key LSA types:
Type | Description |
Type 1 – Router LSA | Lists router’s links within its area |
Type 2 – Network LSA | Generated by DRs to describe connected routers |
Type 3 – Summary LSA | Advertised by ABRs between areas |
Type 4 – ASBR Summary LSA | Informs routers how to reach the ASBR |
Type 5 – External LSA | For redistributed external routes |
Type 7 – NSSA External LSA | Used in NSSA areas for external routes |
14. What is a stub area in OSPF?
Answer:
A stub area is an OSPF area that does not accept external LSAs (Type 5).
Instead, a default route is injected by the ABR. This reduces LSDB size and speeds up SPF calculations.
Stub areas are used in hub-and-spoke topologies for scalability.
Note: You cannot have a virtual link traverse a stub area.
15. What is a Not-So-Stubby Area (NSSA)?
Answer:
An NSSA is a modified stub area that allows external routes to be advertised via Type 7 LSAs, which are later converted to Type 5 by the ABR.
NSSAs are useful when you have an ASBR inside a stub-like area, such as a branch router redistributing external routes into OSPF.
16. What is the role of the Designated Router (DR) and Backup DR in OSPF?
Answer:
In multi-access networks like Ethernet, OSPF elects:
- DR to manage and distribute LSAs
- BDR as a standby router
This reduces unnecessary adjacencies and LSA floods.
DR/BDR are elected based on priority and Router ID.
17. How is DR/BDR election conducted in OSPF?
Answer:
Election is based on:
- Highest OSPF priority on the interface (0 means ineligible)
- If tied, highest Router ID
Only applies to broadcast and NBMA networks.
There is no preemption—the DR/BDR remains until it goes down.
18. What happens if the OSPF Router ID is duplicated between routers?
Answer:
If two routers share the same Router ID:
- OSPF adjacency will not form
- You may see errors or dropped packets
To fix, configure a unique RID on each router using:
router ospf 1
router-id 1.1.1.1
Then restart the OSPF process.
19. How can you change the OSPF interface cost manually?
Answer:
By default, OSPF calculates cost from bandwidth, but you can override it:
interface GigabitEthernet0/1
ip ospf cost 10
This manual cost is useful to influence path selection without changing bandwidth.
20. What is OSPF auto-cost and how is it configured?
Answer:
OSPF’s auto-cost feature lets you set the reference bandwidth for cost calculation:
router ospf 1
auto-cost reference-bandwidth 1000
This adjusts OSPF to work properly with high-speed interfaces (e.g., Gigabit or 10G), where default costs might treat all links equally.
21. What is an OSPF virtual link and when is it used?
Answer:
A virtual link in OSPF is a logical connection that allows a non-backbone area to connect to Area 0 (Backbone) through another area. It’s required when:
- An area is not directly connected to Area 0
- You need to maintain OSPF hierarchical integrity
Example configuration:
area 1 virtual-link 2.2.2.2
Used primarily as a temporary fix—not recommended in long-term designs.
22. What are the different OSPF network types and how do they differ?
Answer:
OSPF supports several network types to accommodate different physical topologies:
Type | DR/BDR Election | Hello Interval | Common Use |
Broadcast | Yes | 10 sec | Ethernet, LANs |
Point-to-Point | No | 10 sec | WAN links (PPP) |
Non-Broadcast (NBMA) | Yes | 30 sec | Frame Relay, ATM |
Point-to-Multipoint | No | 30 sec | Partial-mesh WAN |
Correct configuration of network type is critical for proper neighbor formation.
23. How do you configure OSPF neighbors in an NBMA network?
Answer:
In Non-Broadcast Multi-Access (NBMA) networks like Frame Relay, neighbors aren’t automatically discovered. You must configure them manually:
router ospf 1
neighbor 10.1.1.2 priority 1
Also, set the interface as NBMA:
interface Serial0/0
ip ospf network non-broadcast
24. What is route summarization in OSPF and where can it be done?
Answer:
OSPF supports manual summarization:
- On ABRs: Summarize between areas using area range
- On ASBRs: Summarize external routes using summary-address
Example:
router ospf 1
area 1 range 10.1.0.0 255.255.0.0
Summarization improves scalability, reduces LSDB size, and limits LSA flooding.
25. How does OSPF perform route redistribution?
Answer:
OSPF can import routes from other protocols (e.g., RIP, EIGRP) using:
router ospf 1
redistribute rip subnets
Important options:
- Use subnets to redistribute all subnet routes
- Apply route-maps for filtering
- Adjust metric type (E1 or E2) for external LSAs
26. What is the difference between E1 and E2 external routes in OSPF?
Answer:
Type | Metric Behavior | Use Case |
E1 | Total cost = external metric + internal OSPF cost | Preferred when cost to ASBR matters |
E2 | External metric only (default is 20), internal cost ignored | Default; simpler and static |
Use metric-type 1 to configure E1 for better path selection in complex topologies.
27. Can OSPF run over unnumbered interfaces?
Answer:
Yes, OSPF supports unnumbered interfaces, especially in point-to-point configurations (like between routers using loopback-based addressing).
This is commonly used in IPv6 or MPLS backbone designs to conserve IP space.
Ensure the loopback interface used is:
ip unnumbered Loopback0
OSPF treats this as if the interface has an IP.
28. How does OSPF handle default route advertisement?
Answer:
To advertise a default route into OSPF:
- Ensure router has a default route (0.0.0.0/0)
- Use:
default-information originate
Optionally:
default-information originate always
This is useful in single-exit-point networks or to guide edge routers.
29. What are the default OSPF Hello and Dead intervals?
Answer:
Network Type | Hello | Dead |
Broadcast / P2P | 10s | 40s |
NBMA / P2MP | 30s | 120s |
These intervals must match between neighbors, or adjacency will fail.
You can change them using:
ip ospf hello-interval 5
ip ospf dead-interval 20
30. How do you influence OSPF path selection?
Answer:
You can manipulate OSPF path selection by:
- Changing interface cost using ip ospf cost
- Adjusting reference bandwidth using auto-cost reference-bandwidth
- Using route summarization to hide routes
- Redistributing external routes with E1 metric
Manual tuning helps optimize primary vs backup path preference.
31. How do you configure authentication in OSPF?
Answer:
OSPF supports both plain text and MD5 authentication.
To configure MD5 (recommended for security):
interface GigabitEthernet0/1
ip ospf message-digest-key 1 md5 MySecureKey
ip ospf authentication message-digest
Also enable authentication at the area level:
router ospf 1
area 0 authentication message-digest
This ensures only routers with matching keys can form OSPF adjacencies.
32. What are distribute-lists and how are they used in OSPF?
Answer:
Distribute-lists allow filtering of routes in and out of the OSPF routing table (not the LSDB).
They use ACLs or prefix-lists to control route injection.
Example to filter a route:
access-list 10 deny 192.168.1.0 0.0.0.255
router ospf 1
distribute-list 10 in
Note: OSPF distribute-lists work only on routes received into the routing table, not on LSAs.
33. What is the purpose of prefix-lists in OSPF route filtering?
Answer:
Prefix-lists provide a more granular way to filter routes compared to ACLs.
They’re ideal for filtering by prefix length (subnet mask) and network prefix.
Example:
ip prefix-list BLOCK-LOOPBACK seq 5 deny 1.1.1.0/24
router ospf 1
distribute-list prefix BLOCK-LOOPBACK in
They help fine-tune route selection, especially in redistribution scenarios.
34. How do OSPF timers affect neighbor relationships?
Answer:
OSPF neighbors must agree on:
- Hello interval: Time between Hello packets
- Dead interval: Max time to wait before declaring a neighbor down
Default (Broadcast/P2P):
- Hello = 10s, Dead = 40s
If timers mismatch, adjacency will not form. Adjust using:
ip ospf hello-interval 5
ip ospf dead-interval 20
35. How does OSPF prevent routing loops?
Answer:
OSPF is loop-free by design due to:
- Link-state database (LSDB) synchronization
- Use of SPF algorithm
- Complete topology awareness
- Consistent view across routers in an area
Unlike distance-vector protocols, OSPF doesn’t rely on split-horizon or poison reverse.
36. What is SPF throttling and why is it important?
Answer:
SPF throttling limits how frequently OSPF recalculates the SPF tree, preventing CPU overuse during frequent topology changes.
Configured as:
timers throttle spf 500 1000 5000
Where:
- 500 = initial delay
- 1000 = minimum hold time
- 5000 = maximum hold time
Useful in unstable networks to avoid performance degradation.
37. How do you troubleshoot OSPF adjacency issues?
Answer:
Use the following commands:
- show ip ospf neighbor – Verify state and timer sync
- show ip ospf interface – Check hello/dead intervals
- debug ip ospf adj – See adjacency transitions
- debug ip ospf hello – Confirm Hello exchange
Check - Mismatched area IDs
- Hello/dead timer mismatches
- Authentication key mismatch
- Network type misconfiguration
38. What is the significance of the “FULL” neighbor state in OSPF?
Answer:
“FULL” state means the router and its neighbor have:
- Exchanged and acknowledged all LSAs
- Fully synchronized LSDBs
- Successfully formed adjacency
This is the final state of neighbor establishment on P2P and DR/BDR links.
If routers are stuck in 2-Way or ExStart, it may indicate an issue with election or MTU.
39. How do you limit OSPF LSA flooding?
Answer:
To control excessive LSA flooding:
- Use area design to isolate instability
- Apply summarization on ABRs
- Configure stub/NSSA areas to suppress Type 5 LSAs
- Use ip ospf flood-reduction on interfaces to suppress updates during stability
This improves performance in large or flapping networks.
40. What are best practices for deploying OSPF in enterprise networks?
Answer:
- Use areas to break up large topologies
- Keep Area 0 contiguous and central
- Apply manual summarization at ABRs
- Use stub or NSSA for edge areas
- Set router IDs manually
- Enable authentication for security
- Avoid overuse of virtual links
These practices improve scalability, convergence, and security in enterprise-grade OSPF networks.
41. What is the role of Loopback interfaces in OSPF?
Answer:
Loopback interfaces are used to:
- Stabilize the Router ID (RID) — as they’re always up
- Ensure consistent identification across reboots
- Act as OSPF endpoints in unnumbered or point-to-point designs
- Improve stability in networks where interface flaps are common
OSPF prefers the highest IP on a loopback interface to select the RID (unless manually set).
42. What is OSPF graceful restart (Non-Stop Forwarding)?
Answer:
Graceful Restart (GR) or Non-Stop Forwarding (NSF) allows a router to restart the OSPF process without losing neighbor adjacencies or causing route recalculations.
- It relies on GR-capable neighbors to maintain adjacency
- Helps minimize downtime during control plane restarts
Useful in high-availability enterprise or service provider environments.
43. What are LSA refresh, max age, and flush timers in OSPF?
Answer:
Timer | Default Value | Purpose |
LSA Refresh | 1800 sec (30 min) | LSAs are refreshed periodically |
Max Age | 3600 sec (1 hour) | LSA is aged out if not refreshed |
Flush | Triggered when LSA hits max age | LSA removed from LSDB |
These timers ensure stale or invalid information doesn’t persist in the LSDB.
44. How does OSPF handle multiple equal-cost paths?
Answer:
OSPF supports Equal-Cost Multi-Path (ECMP) routing.
If multiple routes have equal cost, OSPF can install up to 4 paths by default (configurable up to 16):
maximum-paths 8
This allows load balancing and link redundancy, improving performance.
45. What is the use of the default-information originate command?
Answer:
Used to inject a default route (0.0.0.0/0) into OSPF:
router ospf 1
default-information originate
Requirements:
- The router must have a default route
- Use always keyword to advertise even if no default exists:
default-information originate always
Essential for edge routers or internet gateways.
46. What are the key differences between OSPF and EIGRP?
Answer:
Feature | OSPF | EIGRP |
Type | Link-State | Hybrid (Distance Vector + Link-State) |
Standard | Open (multi-vendor) | Cisco proprietary (mostly) |
Metric | Cost (based on bandwidth) | Composite (BW, delay) |
Convergence | Fast | Very fast (with DUAL) |
Load Balancing | Equal-cost only | Equal and unequal |
Area-based | Yes | No |
Choose based on network size, vendor support, and scalability needs.
47. How can you verify OSPF configuration and operation?
Answer:
Key commands:
- show ip ospf – Global OSPF info
- show ip ospf interface – Area, cost, timers
- show ip ospf neighbor – State and adjacency
- show ip ospf database – View LSAs
- debug ip ospf events – Live troubleshooting
These help confirm neighbor states, area assignments, and route propagation.
48. What is an ABR and what is its function in OSPF?
Answer:
An Area Border Router (ABR):
- Connects Area 0 to one or more non-backbone areas
- Performs route summarization and LSA Type 3 generation
- Separates intra-area and inter-area routing information
- Does not forward Type 5 LSAs into stub areas
ABRs are critical in OSPF hierarchical design.
49. What is an ASBR and what is its role in OSPF?
Answer:
An Autonomous System Boundary Router (ASBR):
- Redistributes routes from external protocols (e.g., BGP, RIP) into OSPF
- Generates Type 5 LSAs (or Type 7 in NSSA)
- Connects OSPF to external networks or AS domains
It must be located within an OSPF area, and its routes are marked as E1 or E2.
50. Can OSPF be used in a multi-vendor environment?
Answer:
Yes — OSPF is an open standard protocol defined by the IETF (RFC 2328).
It works seamlessly across routers from different vendors (e.g., Cisco, Juniper, MikroTik, Arista), making it ideal for multi-vendor or hybrid environments.
This interoperability is one of the main reasons OSPF is widely adopted in enterprise and service provider networks.
Conclusion:
That wraps up the Top 50 OSPF Interview Questions and Answers for 2025! Whether you’re preparing for certification exams or job interviews, this list is designed to help you succeed by providing clear, accurate, and practical answers to common OSPF questions.
Want more protocol deep dives like this? Be sure to check out our posts on EIGRP, BGP, and network troubleshooting techniques.