OSPF Interview Questions
DR/BDR Election and OSPF Network Types
1. What are DR and BDR in OSPF?
- DR: Handles the exchange of OSPF updates within the multi-access network.
- BDR: Functions as a backup router that acts as a DR whenever the existing one fails.
This helps in avoiding unnecessary overhead in OSPF and increases its scalability.
2. How does OSPF elect DR and BDR?
DR and BDR elections are based on the OSPF interface priority and Router ID.
- The router with the highest OSPF priority becomes the DR.
- The router with the second-highest priority becomes the BDR.
- If priorities are equal, the highest Router ID wins.
Once elected, the DR and BDR retain their roles unless a failure occurs or the OSPF process is restarted.
3. Can a router with priority 0 become DR or BDR?
No. A router with an OSPF priority of 0 is excluded from the DR/BDR election process and cannot become either the DR or the BDR.
This setting is often used when a router should participate in OSPF but must never assume a DR or BDR role.
4. What are OSPF network types?
Common OSPF network types include Broadcast, Non-Broadcast (NBMA), Point-to-Point, Point-to-Multipoint, and Point-to-Multipoint Non-Broadcast. These types determine how routers discover neighbors, exchange updates, and whether a DR/BDR election is required.
5. Why is the DR/BDR election not required on point-to-point links?
The reason for this is that a point-to-point connection involves just two routers connected via OSPF, hence making it unnecessary for DR and BDR elections. Therefore, adjacency can be made directly between the two and communication can occur without any intermediaries.
As a result, OSPF neighbor formation is simpler and more efficient on point-to-point links.
Learn via our Video Courses
LSA, LSD, B, and OSPF Route Types
1. What is the difference between Type 1 and Type 2 external routes?
While both E1 and E2 types are injected into OSPF from an external routing domain, their difference lies in how the routing cost is computed.
For an E1 Route, the overall metric equals the sum of the external metric and the internal OSPF metric to the ASBR.
On the other hand, for an E2 Route, only the external metric is taken into account, irrespective of the internal metric to the ASBR.
An OSPF router by default uses the E2 type for external route redistribution. The E1 type is usually recommended if internal costs affect routing decisions.
2. What is an LSA in OSPF?
An LSA stands for Link-State Advertisement, which is what OSPF routers use to exchange topology information between themselves. In the LSA, there are specifics regarding the routers, networks, or routes, such that all of the routers are able to create an accurate LSDB (Link State Database).
Whenever the network topology changes, updated LSAs are flooded throughout the OSPF domain.
3. What is the difference between the LSDB and the routing table?
Even though both the routing table and LSDB are similar to each other, their roles in an organization are different. LSDB is a complete snapshot of the OSPF topology based on the exchange of LSAs in the OSPF domain. The routing table, on the other hand, consists of only the routes chosen after conducting SPF.
The LSDB represents everything OSPF knows about the network, while the routing table contains only the routes selected for forwarding traffic.
4. Explain common OSPF LSA types used in interviews.
The following LSA types appear most frequently in OSPF interviews:
| LSA Type | Purpose |
|---|---|
| Type 1 (Router LSA) | Describes a router's links within an area. |
| Type 2 (Network LSA) | Generated by the DR to describe a multi-access network. |
| Type 3 (Summary LSA) | Advertises routes between OSPF areas. |
| Type 4 (ASBR Summary LSA) | Identifies the path to an ASBR. |
| Type 5 (External LSA) | Advertises routes redistributed from outside OSPF. |
| Type 7 (NSSA External LSA) | Carries external routes within an NSSA. |
For most CCNA and CCNP interviews, candidates are expected to be familiar with Types 1, 2, 3, and 5, while Types 4 and 7 are commonly discussed in advanced OSPF scenarios.
5. What is the difference between O, O IA, E1, and E2 routes?
These route codes indicate how a route was learned and how its cost is calculated within OSPF.
| Route Type | Description |
|---|---|
| O | An intra-area route is learned within the same OSPF area. |
| O IA | An inter-area route is learned from another OSPF area through an ABR. |
| E1 | External route where both the external cost and internal OSPF cost are considered. |
| E2 | External route where only the external cost is considered (default behavior). |
In practice, E1 routes are preferred when the internal path to the ASBR should influence route selection, whereas E2 routes use only the redistributed metric regardless of the internal OSPF path.
OSPF Areas, Backbone, ABR, and ASBR
1. What is an OSPF area, and why is area design important?
In the same OSPF area, the routers will have the exact LSDB. This is because it enables the routers to have a synchronized idea of the topology structure of the network.
In contrast to flooding the topology information throughout the network, it only floods the topology information in the area.
With the growth of networks, good area design helps with scalability and lowers the number of SPF calculations, among other advantages. For this reason, in large enterprise implementations, several OSPF areas are used instead of one flat area.
2. Why is Area 0 called the backbone area in OSPF?
Area 0 serves as the central transit area in an OSPF network. All other areas, apart from the backbone area, must link to the backbone either directly or virtually, thus making possible the exchange of routing information across different areas.
In the absence of Area 0, inter-area route exchange will not work properly, and for this reason, it is referred to as the backbone area.
3. What is the difference between an internal router, a backbone router, an ABR, and an ASBR?
The role of an OSPF router depends on its position within the OSPF domain and the type of routes it handles.
| Router Type | Role |
|---|---|
| Internal Router | All interfaces belong to the same OSPF area. |
| Backbone Router | Has at least one interface in Area 0. |
| ABR (Area Border Router) | Connects Area 0 to one or more non-backbone areas. |
| ASBR (Autonomous System Boundary Router) | Redistributes routes from other routing protocols or external sources into OSPF. |
In enterprise networks, ABRs are responsible for inter-area communication, while ASBRs act as the gateway between OSPF and external routing domains.
4. What is a stub area, a totally stubby area, and NSSA in OSPF?
These area types are designed to reduce the number of routing updates and LSAs that routers need to process.
| Area Type | Description |
|---|---|
| Stub Area | Blocks external LSAs and uses a default route to reach external networks. |
| Totally Stubby Area | Blocks both external and inter-area routes, relying heavily on a default route. |
| NSSA (Not-So-Stubby Area) | Allows limited external route redistribution while still reducing LSA flooding. |
Stub and totally stubby areas are commonly used in branch networks, while NSSA is preferred when a branch site needs to redistribute routes from another routing domain.
5. What is an OSPF virtual link, and when would you use it?
A virtual link is a logical connection that extends Area 0 through another OSPF area. It is typically used when a non-backbone area cannot be connected directly to the backbone area.
Although virtual links can restore OSPF connectivity, they are generally considered a temporary solution. In most cases, redesigning the area structure is preferred over relying on virtual links long-term.
OSPF Basics Interview Questions
1. Is OSPF a distance-vector or link-state routing protocol?
OSPF falls under the category of link-state routing protocols. Unlike distance-vector routing protocols that establish routes based on information from nearby routers, OSPF considers the entire network topology and uses the Shortest Path First algorithm.
2. What is the difference between OSPF and RIP?
While OSPF and RIP are both examples of interior gateway protocols (IGPs), they have notable differences in route computation as well as scalability in networks.
| Feature | OSPF | RIP |
|---|---|---|
| Routing Type | Link-state | Distance-vector |
| Metric | Cost | Hop count |
| Maximum Hops | No practical limit | 15 hops |
| Convergence | Fast | Slow |
| Scalability | Suitable for large networks | Best for small networks |
| Algorithm | SPF (Dijkstra) | Bellman-Ford |
Due to its quick convergence and scalability advantages, OSPF is the preferred routing protocol in most enterprise networks, while RIP is only deployed in very small or obsolete networks.
3. What is the role of the SPF or Dijkstra algorithm in OSPF?
The SPF algorithm is used to calculate routes in OSPF and performs the following key roles:
- Analyses the Link State Database (LSDB)
- Builds the shortest-path tree
- Calculates the lowest-cost path to each destination
- Updates the routing table when topology changes occur
4. What is an OSPF Router ID, and how is it selected?
The Router ID (RID) is a 32-bit value that uniquely identifies a router within an OSPF network. It is included in OSPF packets and plays an important role in neighbor relationships as well as DR/BDR elections.
OSPF selects the Router ID using the following order of preference:
- A manually configured Router ID
- The highest IP address on any loopback interface
- The highest IP address on any active physical interface
Once the Router ID has been selected, it remains unchanged until the OSPF process is restarted or the router is rebooted.
5. What is the difference between OSPFv2 and OSPFv3?
While both versions use the same link-state routing principles, OSPFv2 is designed for IPv4 networks, whereas OSPFv3 adds support for IPv6.
| Feature | OSPFv2 | OSPFv3 |
|---|---|---|
| IP Version | IPv4 | IPv6 |
| RFC | RFC 2328 | RFC 5340 |
| Neighbor Formation | Uses IPv4 addresses | Uses IPv6 link-local addresses |
| Authentication | Built into the protocol | Relies on IPv6 security mechanisms such as IPsec |
| Configuration | Interface and network-based | Primarily interface-based |
Apart from its compatibility with IPv6, the general functioning of OSPFv3 is almost similar to OSPFv2. It makes the task easier for network engineers who are familiar with OSPF protocols.
6. What is OSPF, and why is it used in enterprise networks?
OSPF (Open Shortest Path First) is a widely utilized dynamic routing protocol. Instead of relying on route advertisement messages to periodically find routes, OSPF employs the SPF (Dijkstra’s) algorithm to identify the shortest paths between destinations.
OSPF is widely used for its rapid convergence, scalability, and hierarchical design using areas.
OSPF Configuration and Troubleshooting Questions
1. Which commands would you use to verify OSPF neighbors and routes?
Some of the commonly used OSPF verification commands are:
-
Show ip OSPF neighbor- Displays OSPF neighbor relationships and states. -
Show ip route OSPF- Shows routes learned through OSPF. -
Show ip OSPF interface- Displays interface-level OSPF settings. -
Show ip OSPF database- Shows the OSPF LSDB. -
Show ip protocols- Displays OSPF process information and advertised networks.
These OSPF verification commands are usually the thing we look at when we need to verify that OSPF is working correctly or when we are trying to figure out routing issues with OSPF.
2. How would you troubleshoot OSPF adjacency not forming?
I would begin by confirming that both routers are sending Hello packets and are within the same OSPF area. The other thing would be checking for the possible mismatches, such as Hello/Dead timer, authentication, subnet, and stub area.
In case this does not solve the problem, one should run commands such as show ip ospf neighbor and show ip ospf interface to find out at what stage the adjacencies are falling off due to a particular parameter.
3. How would you troubleshoot missing OSPF routes?
How one troubleshoots such an issue depends on where along the chain the route disappears. Should the route exist in the LSDB but not in the routing table, then one needs to look at route selection and filtering. Should the route disappear even before getting to the LSDB, one must investigate the advertisement of the network and OSPF adjacencies.
4. How do passive interfaces work in OSPF?
A passive interface allows a network to be advertised through OSPF without sending or receiving Hello packets on that interface. In such a case, although the adjacent network will be visible in the OSPF update, no neighbor relationship will be established through the passive interface.
A common use case is a LAN interface connected to end-user devices where no OSPF neighbors are expected.
5. How does OSPF authentication work, and why is it used?
- Neighboring routers must use matching authentication settings to establish an OSPF adjacency.
- Any mismatch in the authentication method or key prevents route exchange.
- Authentication helps protect the OSPF domain from unauthorized routers and invalid routing updates.
OSPF Metrics, Summarization, and Path Selection
1. How is OSPF cost calculated?
OSPF determines the best path using a metric called cost, which is calculated as:
Cost = Reference Bandwidth / Interface Bandwidth
Because lower costs are preferred, faster links typically have a lower OSPF cost. Network engineers can also modify interface costs manually to influence routing decisions.
2. How does OSPF choose the best path?
Once the network topology is learned, OSPF runs the SPF algorithm and selects the path with the lowest cumulative cost. If multiple paths have the same cost, OSPF can use Equal-Cost Multi-Path (ECMP) routing.
3. What is equal-cost multipath in OSPF?
Equal-Cost Multipath routing helps OSPF use multiple paths to reach a common destination whose costs are equal. Traffic can be distributed across all available paths, improving link utilization and providing redundancy.
ECMP is a typical scenario that occurs within an organization’s network where there are multiple links to a destination having the same path cost.
4. What is route summarization in OSPF, and where can it be configured?
With an increase in the size of the OSPF network, routers have to handle more route information than before, which makes it harder to scale.
Route summarization solves this problem through the process of consolidation, wherein different routes are consolidated to form a single advertisement. Thus, the number of routes being advertised becomes fewer.
In OSPF, route summarization is usually applied at ABRs for inter-area routes and ASBRs for external routes.
5. What happens when OSPF has multiple routes to the same destination?
When OSPF learns multiple routes to the same destination, it compares their costs and selects the route with the lowest metric. If multiple paths have identical costs, OSPF can install them simultaneously in the routing table and distribute traffic across those paths using Equal-Cost Multi-Path (ECMP) routing.
OSPF Neighbor Adjacency and States
1. Why can OSPF neighbors get stuck in INIT, 2-Way, ExStart, or Exchange state?
Different states point to different issues. INIT often indicates one-way Hello communication, 2-Way may be normal on broadcast networks, ExStart is commonly linked to MTU mismatches or Router ID conflicts, and Exchange issues usually occur during LSDB synchronization.
The neighbor state often provides the first clue when troubleshooting OSPF adjacency problems.
2. What are the OSPF neighbor states?
Before two OSPF routers can exchange routing information, they move through a series of neighbor states:
- Down - No Hellos have been received.
- Init - A Hello packet has been received from a neighbor.
- 2-Way -Bidirectional communication is established.
- ExStart - Routers negotiate master/slave roles.
- Exchange - Database Description (DBD) packets are exchanged.
- Loading - Missing LSAs are requested and synchronized.
- Full – The routers have a fully synchronized LSDB.
For interviews, especially, you should keep in mind that the states that receive the most attention are 2-Way, ExStart, Exchange, and Full because adjacency issues commonly occur during these stages.
3. What is the difference between 2-Way and Full state in OSPF?
The 2-Way state shows that both routers can receive each other’s Hello messages, but the adjacency has not been built. It is a typical state for broadcast network types because the two routers exchange their routing information using DR and BDR.
However, the Full state demonstrates that the two routers exchange all their LSDB data, and the adjacency is already established.
4. Which parameters must match for two OSPF routers to become neighbors?
For OSPF neighbor adjacency to form successfully, the following parameters must match:
- Area ID
- Hello interval
- Dead interval
- Authentication settings
- Stub area configuration
- IP subnet (on most network types)
A mismatch in any of these values can prevent neighbor formation or cause routers to get stuck in intermediate states such as INIT, ExStart, or Exchange.
5. What are Hello and Dead intervals in OSPF?
OSPF neighbors discovery and monitoring are controlled by Hello and Dead intervals. The Hello interval sets the frequency of transmission of Hello packets, whereas the Dead interval sets the amount of time the router will wait to declare a neighbor to be unreachable before receiving any Hello packets.
These timers must match between neighboring routers; otherwise, OSPF adjacency will not form.
Scenario-Based OSPF Interview Questions for Network Engineers
1. Two routers are in the same subnet, but OSPF is not forming. What would you check first?
First, I will make sure that both routers are sending each other the Hello packets. If both routers are sending Hello packets to each other, then I will make sure that they do not have any mismatch issues, such as the area ID, Hello/Dead timers, authentication, subnet mask, and stub area.
In general, the adjacency problem arises when one of these parameters does not match between the two routers.
2. An OSPF route is present in the LSDB but not in the routing table. How would you troubleshoot it?
If the route already exists in the LSDB, OSPF has successfully learned it. The next step is to determine why it was not installed in the routing table. Common causes include a lower administrative distance route from another protocol, route filtering, summarization, or a better OSPF path being selected.
In short, the focus should shift from route advertisement to route selection.
3. A branch router is receiving too many external routes. Which OSPF area design would you consider?
A full OSPF area is rarely necessary for a typical branch location. In most cases, converting the branch to a Stub Area or Totally Stubby Area is enough to reduce the routing information it receives while still maintaining connectivity through a default route.
If route redistribution is required at the branch, NSSA is usually the preferred design because it limits external route flooding without preventing redistribution.
4. After changing the OSPF cost, traffic is still using the old path. What would you verify?
Things I'd check include:
- Whether the new OSPF cost is applied correctly
- Whether the route in the routing table reflects the expected path
- Whether SPF recalculation has occurred
- Whether another routing protocol has a lower administrative distance
- Whether ECMP is still distributing traffic across multiple paths
5. How would you explain OSPF vs BGP in an interview for an enterprise network role?
OSPF is generally used for routing within an organization, while BGP is used to exchange routes between different autonomous systems. OSPF focuses on selecting the shortest path inside a network, whereas BGP emphasizes routing policies, scalability, and control over route advertisement. In enterprise environments, OSPF typically handles internal routing, while BGP is commonly used for internet connectivity and ISP peering.