PermitANY
JuniperConfig712 downloads

Juniper JunOS Multi-area OSPF

Multi-area OSPFv2 configuration for Juniper routers: areas, stub/NSSA, route summarization, authentication, and redistribution via JunOS set commands.

↓ example.txt

What is it?

Juniper OSPF configuration differs from Cisco in two key ways: (1) Interfaces are enabled per-area under the protocol stanza — not with 'network' statements. (2) Route redistribution uses explicit export policies ('policy-options policy-statement') rather than 'redistribute' commands. JunOS supports both OSPFv2 (IPv4) and OSPFv3 (IPv6) as separate protocol instances. Traffic engineering extensions (OSPF-TE) are commonly enabled on Juniper for MPLS/RSVP path computation. The loopback interface (lo0.0) should always be in OSPF as passive.

When to use

  • ·Multi-router Juniper deployments needing dynamic routing
  • ·Mixed-vendor environments — OSPF is an open standard that works with Cisco, Arista, etc.
  • ·MPLS provider networks where OSPF carries TE extensions for label-switched paths
  • ·Data center underlay routing for VXLAN EVPN fabrics

When NOT to use

  • ·ISP peering or inter-AS routing — use BGP for external routing
  • ·Very small networks with 2-3 routers — static routes are simpler

How it compares

vs Cisco IOS OSPFIOS uses 'network <ip> <wildcard> area <id>' to enable OSPF on interfaces. Juniper uses 'set protocols ospf area <id> interface <if>'. Juniper export policies are more powerful than IOS 'redistribute' — they support fine-grained filtering with route-filters and conditions.
vs Cisco NX-OS OSPFNX-OS uses named OSPF instances ('router ospf UNDERLAY'). Juniper OSPF doesn't need a name — it's simply 'protocols ospf'. Both support per-interface configuration.

Prerequisites

  • →Interfaces must have IP addresses configured before enabling OSPF on them
  • →Router ID should be a loopback address — configure loopback before OSPF
  • →Area 0 (backbone) must exist for multi-area designs
  • →Export policies must be created before referencing them in 'protocols ospf export'

Config Generator

Verification commands

show ospf neighbor

Verify OSPF adjacency state with all neighbors

ExpectedNeighbors should show 'Full' state. '2Way' on broadcast links means DR/BDR election issue.

show ospf route

Show OSPF routes in the OSPF routing table

ExpectedLists all OSPF-learned routes with area, metric, and next-hop

show route protocol ospf

Show OSPF routes installed in the main routing table

ExpectedRoutes marked with 'OSPF' source. Missing routes indicate export policy or redistribution issue.

Debug commands

show ospf interface detail

Show OSPF interface state, hello/dead timers, and DR/BDR election

Common mistakes & fixes

SymptomOSPF neighbor stuck in 'ExStart' or 'Exchange'
CauseMTU mismatch between neighbors
FixMatch MTU on both sides, or disable MTU checking: 'set protocols ospf area <id> interface <if> ignore-mtu'
SymptomRoutes not being redistributed into OSPF
CauseExport policy missing or not attached to OSPF process
FixVerify policy exists: 'show policy OSPF-EXPORT'. Attach: 'set protocols ospf export OSPF-EXPORT'. Check 'show ospf route' includes the redistributed prefix.
SymptomOSPF adjacency flapping
CauseHello/dead timer mismatch or interface MTU issue
FixVerify hello and dead timers match on both sides: 'show ospf interface detail'. Default JunOS: hello 10s, dead 40s — same as Cisco IOS.

Further learning

Recommended books to go deeper on this topic.

OSPF: Anatomy of an Internet Routing Protocol

John T. Moy · Addison-Wesley · The protocol from its author: LSA types, flooding, SPF and the design reasoning behind them

Routing TCP/IP, Volume 1

Jeff Doyle & Jennifer Carroll · Cisco Press · The definitive OSPF and IS-IS reference — essential for CCNP/CCIE

CCNP Enterprise Core ENCOR 350-401 Official Cert Guide

Brad Edgeworth et al. · Cisco Press · OSPF single-area, multi-area, LSA types, route summarization

Related configs