8.1 OSPF Architecture & Neighbor Adjacency Formation
Key Takeaways
OSPF is an open-standard link-state interior gateway protocol running Dijkstra's Shortest Path First (SPF) algorithm over an identical Link-State Database (LSDB) maintained across all routers in an area.
Junos selects the OSPF Router ID (RID) based on explicit configuration under [edit routing-options router-id], falling back to the lowest appropriate IPv4 loopback address, and finally the lowest suitable IPv4 interface address.
OSPF encapsulates directly into IP protocol 89, defining five functional packet types: Hello, Database Description (DBD), Link-State Request (LSR), Link-State Update (LSU), and Link-State Acknowledgment (LSAck).
Neighbor adjacency progression traverses a deterministic seven-state machine: Down, Init, 2-Way, ExStart, Exchange, Loading, and Full.
On broadcast multi-access networks, routers elect a Designated Router (DR) and Backup Designated Router (BDR) using priority (default 128 in Junos) and RID; election is non-preemptive, and non-DR routers remain in 2-Way state with each other.
OSPF Architecture & Neighbor Adjacency Formation
Open Shortest Path First (OSPF) is an open-standard link-state Interior Gateway Protocol (IGP) designed by the Internet Engineering Task Force (IETF) to overcome the scalability, convergence, and metric limitations of distance-vector protocols such as RIP. Standardized in RFC 2328 for IPv4 (OSPFv2) and RFC 5340 for IPv6 (OSPFv3), OSPF provides fast convergence, loop-free path determination, hierarchical area partitioning, and equal-cost multipath (ECMP) forwarding across complex enterprise campus and core topologies.
1. Link-State Routing Concepts & The Dijkstra SPF Algorithm
Unlike distance-vector protocols that operate on "routing by rumor"—where each router merely advertises its compiled routing table with hop counts to immediate neighbors—link-state protocols provide full topological transparency. In OSPF, every participating router describes its local interfaces, attached networks, and neighbor adjacencies by generating Link-State Advertisements (LSAs). These LSAs are flooded throughout the area so that every router builds an identical Link-State Database (LSDB).
+---------------------------------------------------------------------------------------------------+
| LINK-STATE CONVERGENCE WORKFLOW |
| |
| 1. Neighbor Discovery Routers exchange periodic Hello packets to discover neighbors. |
| 2. Adjacency Formation Routers synchronize databases through DBD, LSR, LSU, and LSAck packets.|
| 3. LSDB Synchronization Every router in the area maintains an identical map of all links. |
| 4. Dijkstra SPF Execution Each router places itself at the root of a Shortest Path Tree (SPT). |
| 5. Routing Table Install Best loop-free next hops are calculated and committed to inet.0 (RIB). |
+---------------------------------------------------------------------------------------------------+
Once the LSDB achieves synchronization, each router independently executes Dijkstra's Shortest Path First (SPF) algorithm using the LSDB as a directed graph. The algorithm places the executing router at the root of a shortest-path tree (SPT) and calculates the lowest cumulative metric cost to reach every destination subnet. Because all routers within an area share an identical LSDB and run the deterministic Dijkstra algorithm, OSPF guarantees a loop-free intra-area topology.
2. Router ID (RID) Selection Hierarchy in Junos
The Router ID (RID) is a 32-bit unsigned integer, formatted in standard dotted-decimal notation (such as 10.255.0.1), that uniquely identifies an OSPF router within the entire Autonomous System (AS). The RID is mandatory for OSPF operation because it serves as the key for identifying originating routers in LSAs and resolving DR/BDR election ties.
In Junos OS, the active OSPF Router ID is determined according to a strict hierarchical sequence:
+---------------------------------------------------------------------------------------------------+
| JUNOS ROUTER ID SELECTION HIERARCHY |
+------------------------------------+--------------------------------------------------------------+
| 1. Explicit Configuration | set routing-options router-id <ipv4-address> |
| | (Highest precedence; strictly recommended best practice) |
+------------------------------------+--------------------------------------------------------------+
| 2. Loopback IPv4 | Loopback address, honoring an explicit primary address |
| | (Commonly lo0.0; stable virtual interface) |
+------------------------------------+--------------------------------------------------------------+
| 3. Lowest Suitable Interface IPv4 | Lowest eligible IPv4 address; non-P2P preferred to P2P |
| | or logical interface (excluding lo0) |
+------------------------------------+--------------------------------------------------------------+
| 4. Failure State | If no operational IPv4 address exists on any interface, |
| | the OSPF protocol process cannot start |
+------------------------------------+--------------------------------------------------------------+
Operational Gotcha: Router ID Stability
Explicitly configure a stable, unique routing-options router-id and verify it with show ospf overview. Automatic selection can change when interface addressing changes. A router-ID change can reset protocol relationships and leave old LSAs until they expire; schedule it as a disruptive change rather than casually restarting all routing.
3. OSPF Protocol Packet Types
OSPF operates directly over the Internet Protocol using IP protocol number 89, bypassing Layer 4 transport protocols like TCP and UDP. OSPF implements its own reliable transport, flow control, and sequencing mechanisms through five standardized protocol packet types:
| Packet Type | Packet Name | Primary Function | Transport & Reliability |
|---|---|---|---|
| Type 1 | Hello | Discovers neighbors, negotiates operational parameters, establishes bidirectionality, and maintains liveness | On broadcast/P2P links, sent to 224.0.0.5; NBMA uses unicast; unacknowledged |
| Type 2 | Database Description (DBD / DD) | Exchanges summary headers of all known LSAs during initial database synchronization | Unicast; sequence-number acknowledged by slave |
| Type 3 | Link-State Request (LSR) | Solicits complete, updated LSAs from a neighbor when local copies are missing or older | Unicast; acknowledged by LSU response |
| Type 4 | Link-State Update (LSU) | Transports one or more full Link-State Advertisements (LSAs) across adjacent routers | Multicast or unicast; explicitly acknowledged by LSAck |
| Type 5 | Link-State Acknowledgment (LSAck) | Confirms receipt of LSUs to guarantee reliable flooding | Multicast or unicast; matches LSA header parameters |
4. The Common Neighbor State Progression
Before two OSPF routers can share topology details, they must progress through a formalized seven-state finite state machine:
- Down: The initial state of an OSPF neighbor conversation. No Hello packets have been received from the remote router on the local interface.
- Init: A Hello packet has been received from the remote neighbor, but the local router's own Router ID is not listed in the neighbor's received Hello packet. This confirms unidirectional reception only.
- 2-Way: The local router observes its own Router ID in the
Neighborsfield of the received Hello packet. Bidirectional communication is confirmed. On broadcast multi-access links, the Designated Router (DR) and Backup Designated Router (BDR) election takes place in this state. Routers that are neither DR nor BDR (DROthers) stop here with one another, remaining in the2-Waystate. - ExStart: The beginning of database synchronization between adjacent routers. The two routers establish a master/slave relationship and negotiate an initial Database Description sequence number. The router with the higher Router ID becomes the Master; the master drives sequence number increments, while the slave acknowledges.
- Exchange: The routers exchange Database Description (DBD) packets containing the headers of all LSAs in their local databases. Each router compares the received LSA headers against its own LSDB to identify missing, older, or corrupted entries.
- Loading: Routers send Link-State Request (LSR) packets for any missing or outdated LSAs identified during the Exchange state. The neighbor answers with Link-State Update (LSU) packets containing the full LSAs, which the receiving router acknowledges with Link-State Acknowledgment (LSAck) packets.
- Full: The Link-State Databases of the two adjacent routers are completely synchronized. The routers can now compute shortest paths using Dijkstra's algorithm.
5. Network Types & DR/BDR Election Mechanics
OSPF behavior depends directly on the underlying network medium type. The two primary network types encountered in enterprise campus and core networks are Broadcast Multi-Access and Point-to-Point (P2P).
+---------------------------------------------------------------------------------------------------+
| BROADCAST MULTI-ACCESS ADJACENCY MESH COMPARISON |
| |
| Without DR/BDR (Full Mesh): With DR/BDR Architecture: |
| N * (N - 1) / 2 adjacencies 2N - 3 adjacencies |
| Example: 6 Routers = 15 Adjacencies Example: 6 Routers = 9 Adjacencies |
| |
| [R1]-------[R2] [R1]-------[DR] |
| | \ / | | / | |
| | \ / | | / | |
| | \ / | | / | |
| [R3]-------[R4] [R2]----+ [BDR] |
| | / \ | | \ | |
| [R5]-------[R6] [R3] +-[DROther] |
+---------------------------------------------------------------------------------------------------+
The Multi-Access Flooding Challenge
On a multi-access broadcast segment (such as an Ethernet VLAN switch fabric) with participating routers, requiring every router to establish full adjacencies with every other router produces an full mesh. In a segment with 10 routers, this generates 45 separate adjacencies, creating redundant LSA flooding, duplicate acknowledgments, and high CPU overhead.
To solve this, OSPF elects a Designated Router (DR) and a Backup Designated Router (BDR) on all broadcast networks:
- Designated Router (DR): Acts as the central hub for the multi-access segment. It forms full adjacencies with all routers on the link, receives updates, and originates the Type 2 Network LSA representing the pseudo-node subnet.
- Backup Designated Router (BDR): Maintains concurrent full adjacencies with all routers on the segment and listens to all updates, ready to assume the DR role instantly without database resynchronization if the active DR fails.
- DROther: Routers that are neither DR nor BDR form full adjacencies only with the DR and BDR. Between two DROther routers, the adjacency stops permanently in the 2-Way state.
Junos DR/BDR Election Rules
- Interface Priority: Priority ranges from 0 to 255. In Junos OS, the default priority is 128 (unlike Cisco IOS, which defaults to 1). A priority of
0renders an interface completely ineligible to become DR or BDR. - Tiebreaker: When priority values tie, the router with the highest Router ID is elected.
- Non-Preemptive Nature: The election is non-preemptive. If a router with a higher priority or higher RID joins an existing segment where a DR and BDR are already operational, the newcomer will not usurp either role. It remains a DROther until the existing DR or BDR fails, reboots, or has its interface reset.
Dedicated Multicast Addressing
OSPF uses two reserved IPv4 link-local multicast addresses on broadcast networks:
224.0.0.5(AllSPFRouters): Listened to by all active OSPF routers. The DR and BDR transmit LSUs and Hellos to this address to reach all segment participants. Point-to-point links also communicate exclusively on224.0.0.5.224.0.0.6(AllDRouters): Listened to exclusively by the DR and BDR. DROther routers transmit their Link-State Updates and Link-State Acknowledgments to this address, preventing other DROther routers from processing transit flooding.
Point-to-Point Interfaces
On dedicated point-to-point links (such as routed switch-to-switch interconnects configured with interface-type p2p), no DR or BDR is elected. Both routers form a direct full adjacency, optimizing convergence by eliminating DR election timers and reducing packet processing.
The seven states shown are the usual broadcast/point-to-point progression. OSPF also defines Attempt for configured NBMA neighbors; the complete standard state set has eight states. Router-ID address selection is separate from DR election: Junos automatically favors a low address for identity, while the DR election favors the highest RID after interface priority ties.
Official references checked 2026-10-18: Router ID selection.
In Junos OS, what is the default tie-breaking hierarchy used to select the OSPF Router ID (RID) if it is not explicitly configured under [edit routing-options router-id]?
The lowest IPv4 address on any active physical interface, followed by loopback interface lo0
The loopback address (honoring primary selection), otherwise the lowest suitable interface IPv4 address
The lowest MAC address among all participating physical interfaces in Area 0
The first IPv4 address configured on the management interface fxp0 or me0
During the OSPF neighbor adjacency process, which actions occur specifically within the ExStart state?
Routers elect the Designated Router (DR) and Backup Designated Router (BDR) using priority values
Routers transmit Link-State Request (LSR) packets to retrieve out-of-date link-state advertisements
Routers establish a master/slave relationship and negotiate the initial Database Description sequence number
Routers verify bidirectional communication by inspecting the neighbor list in received Hello packets
What is the default OSPF interface priority in Junos OS on broadcast networks, and how does the election behave when a router with a higher priority joins an active segment?
Default priority is 128; the election is non-preemptive, so an active DR remains in role until it fails or restarts
Default priority is 1; the new router preempts the active DR immediately after transmitting three Hello packets
Default priority is 0; routers never participate in DR election unless explicitly configured with priority 255
Default priority is 128; the new router immediately triggers an election and usurps the BDR role through preemption
Sections you finish are checked off in the contents.