OSPF (Open Shortest Path First) is a dynamic link-state routing protocol widely used in IP networks. It is designed for scalability, fast convergence, and efficient network utilization. Unlike distance-vector protocols (e.g., RIP), OSPF builds a complete map of the network topology and uses Dijkstra’s Shortest Path First (SPF) algorithm to calculate the best path to a destination.
OSPF supports a hierarchical structure, which divides the network into logical segments called areas. This improves scalability, reduces overhead, and simplifies management.
Backbone Area (Area 0):
Stub Area:
0.0.0.0) is used to forward traffic.Totally Stubby Area:
Not-So-Stubby Area (NSSA):
Example of Area Design:
OSPF routers form neighbor relationships to exchange routing information.
How Routers Discover Neighbors:
Neighbor States:
DR and BDR Election:
Configuration Example:
set protocols ospf area 0.0.0.0 interface ge-0/0/1 priority 10
OSPF uses LSAs to exchange network topology information. LSAs are propagated within an area or between areas.
Types of LSAs:
Type 1: Router LSA:
Type 2: Network LSA:
Type 3: Summary LSA:
Type 4: ASBR Summary LSA:
Type 5: External LSA:
LSA Flooding:
OSPF assigns a cost to each link to determine the shortest path. Cost reflects the link’s bandwidth.
Cost Formula:
Cost = Reference Bandwidth / Interface Bandwidth
Adjusting Cost:
Configuration Example:
set protocols ospf area 0.0.0.0 interface ge-0/0/1 metric 10
OSPF uses timers to manage neighbor relationships and detect failures.
Configuration Example:
set protocols ospf area 0.0.0.0 interface ge-0/0/1 hello-interval 5
set protocols ospf area 0.0.0.0 interface ge-0/0/1 dead-interval 20
Virtual links allow connecting non-contiguous areas to the backbone (Area 0). They are used when:
Configuration Example:
set protocols ospf area 1 virtual-link 1.1.1.1
1.1.1.1 to the backbone.OSPF can authenticate Hello packets and LSAs to ensure security and integrity.
Configuration Example (MD5):
set protocols ospf area 0.0.0.0 authentication md5
set protocols ospf area 0.0.0.0 interface ge-0/0/1 authentication-key securekey
OSPF is a link-state interior gateway protocol (IGP) designed for speed, scalability, and efficient route computation. It uses areas to optimize network performance and the Dijkstra SPF algorithm to compute shortest paths. Below are some additional essential details to better understand OSPF’s operational depth and to prepare for exam-level questions.
In OSPF, routers are categorized based on their position in the topology and the type of routing information they handle. These roles are important for network design and OSPF behavior.
All interfaces belong to the same area.
Maintains a single link-state database for that area.
Has at least one interface in Area 0 (Backbone area).
Responsible for inter-area communication within the OSPF hierarchy.
Connects two or more OSPF areas, one of which must be Area 0.
Maintains separate link-state databases for each connected area.
Generates Type 3 and Type 4 LSAs to summarize and advertise routes between areas.
Redistributes routes from external sources (e.g., BGP, static routes) into OSPF.
Generates Type 5 LSAs (or Type 7 in NSSA areas) to advertise external routes.
While standard OSPF external routes are carried by Type 5 LSAs, Not-So-Stubby Areas (NSSAs) use a special LSA:
Type 7 LSA is used by ASBRs within an NSSA to advertise external routes.
ABRs connecting the NSSA to Area 0 translate Type 7 LSAs into Type 5 LSAs before flooding them into the rest of the OSPF domain.
NSSA areas use Type 7 LSAs to carry external routes, which are then translated into Type 5 LSAs by the ABR.
This mechanism preserves the stub-like nature of the NSSA while still allowing external route injection.
In Junos (and generally in OSPF implementations), different types of OSPF-learned routes are labeled to indicate their origin and type. These labels are visible using show route commands and can help identify the path type and decision-making process.
| Route Type | Routing Table Tag | Description |
|---|---|---|
| Intra-Area | O |
Routes learned within the same area |
| Inter-Area | O IA |
Routes learned from another area via an ABR |
| External Type 1 | O E1 |
External routes with internal OSPF cost considered |
| External Type 2 | O E2 |
External routes where only external cost is considered (default) |
inet.0: 15 destinations, 15 routes (15 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
O 10.10.10.0/24 [110/5] via ge-0/0/1.0, Area 0.0.0.0
O IA 10.20.20.0/24 [110/20] via ge-0/0/2.0, Area 0.0.0.1
O E2 192.168.1.0/24 [150/1] via 10.1.1.2, Area 0.0.0.0
O: intra-area
O IA: inter-area (from another area via ABR)
O E2: external (Type 2), originated from an ASBR
OSPF Router Roles: Internal Router, Backbone Router, ABR, and ASBR have distinct responsibilities.
Type 7 LSAs: Specific to NSSA areas, used by ASBRs and converted to Type 5 by ABRs.
Routing Table Labels: Understanding O, O IA, O E1, O E2 is essential for route origin interpretation and troubleshooting.
How does OSPF select the Designated Router (DR) on a broadcast network?
OSPF selects the router with the highest OSPF priority, and if tied, the highest router ID.
On broadcast networks such as Ethernet, OSPF reduces adjacency overhead by electing a Designated Router (DR) and Backup Designated Router (BDR). During the election process, routers exchange Hello packets containing their OSPF priority and router ID. The router with the highest priority becomes the DR. If multiple routers share the same priority, the router with the highest router ID wins. If priority is set to 0, the router is ineligible to become DR or BDR. Once elected, the DR maintains adjacencies with all other routers on the segment and distributes link-state updates, improving scalability.
Demand Score: 81
Exam Relevance Score: 88
Why might an OSPF neighbor remain stuck in the EXSTART state?
Usually due to MTU mismatch between neighbors.
The EXSTART state occurs during the database description (DBD) exchange process when routers negotiate master/slave roles and begin synchronizing their link-state databases. If the interface MTU values differ between neighbors, the DBD packets may be rejected, preventing the adjacency from progressing to the EXCHANGE state. This issue is common when tunnels or mismatched interface settings are used. Troubleshooting typically involves verifying interface MTU settings or enabling the mtu-ignore option in some implementations.
Demand Score: 85
Exam Relevance Score: 90
What is the difference between a stub area and an NSSA in OSPF?
A stub area blocks external routes, while an NSSA allows limited external route redistribution.
Stub areas are designed to reduce routing table size by blocking Type 5 LSAs, which carry external routes. Instead, the ABR injects a default route into the stub area. NSSA (Not-So-Stubby Area) behaves similarly but allows redistribution of external routes within the area using Type 7 LSAs. These Type 7 LSAs are translated into Type 5 LSAs by the ABR when they exit the NSSA. NSSA is often used when a branch network needs to redistribute routes while still benefiting from the reduced LSA overhead of a stub design.
Demand Score: 77
Exam Relevance Score: 86
What command can verify OSPF neighbor adjacency in Junos?
show ospf neighbor
The show ospf neighbor command displays all OSPF neighbors and their current adjacency state. Important fields include the neighbor router ID, priority, state, and interface. Engineers use this command during troubleshooting to confirm that neighbors have progressed to the FULL state, which indicates that link-state databases are synchronized. If neighbors remain in intermediate states such as INIT, EXSTART, or EXCHANGE, the output can help identify underlying problems such as authentication mismatches, MTU differences, or network type inconsistencies.
Demand Score: 70
Exam Relevance Score: 84
What role does the OSPF Area Border Router (ABR) perform?
An ABR connects multiple OSPF areas and distributes routing information between them.
An Area Border Router is a router with interfaces in at least two OSPF areas, including Area 0. Its main function is to summarize and distribute routing information between areas. ABRs generate Type 3 summary LSAs to advertise networks from one area into another. This hierarchical design improves scalability by limiting the scope of link-state updates. Without ABRs, large OSPF networks would require every router to maintain a complete topology database for the entire network.
Demand Score: 73
Exam Relevance Score: 87