Junos OSPF Configuration: Areas, Interfaces and Verification - 夜莺博客

Junos OSPF Configuration: Areas, Interfaces and Verification

OSPF configuration on Junos OS follows a different mental model than Cisco IOS: instead of typing network statements under a routing process, you attach interfaces directly to an area at the [edit protocols ospf] hierarchy. This guide walks through single-area and multiarea Junos OSPF configuration with copy-paste CLI commands, explains the router roles (internal, ABR, backbone and ASBR), and shows the exact operational commands that prove adjacencies and LSDBs are healthy.

Why OSPF Areas Matter on Junos

An OSPF autonomous system can be split into areas to reduce link-state advertisement (LSA) flooding, routing overhead and the size of the topology database each router must keep. Every router inside an area stores an identical LSDB; the area topology stays hidden from the rest of the AS. Before you configure anything, decide which roles your devices play: internal routers sit in one area, area border routers (ABRs) connect one or more areas to the backbone, and AS boundary routers (ASBRs) exchange routes with non-OSPF networks.

Junos OSPF Single-Area Configuration

The backbone always uses area ID 0.0.0.0. A single-area network is the simplest start — enable OSPF on each interface that should participate and commit:

[edit]
set protocols ospf area 0.0.0.0 interface ge-0/0/0
set protocols ospf area 0.0.0.0 interface ge-0/0/1
set protocols ospf area 0.0.0.0 interface lo0.0 passive
commit

Making the loopback passive advertises the router-id network without forming adjacencies on it. Set a stable router ID before bringing up neighbors:

set interfaces lo0 unit 0 family inet address 10.255.0.1/32
set routing-options router-id 10.255.0.1
commit

Junos OSPF Multiarea Configuration (ABR)

To make a device an ABR, configure interfaces in the backbone plus another area. Each area statement is independent:

[edit]
set protocols ospf area 0.0.0.0 interface ge-0/0/0
set protocols ospf area 0.0.0.7 interface ge-0/0/2
set protocols ospf area 0.0.0.7 stub
set protocols ospf area 0.0.0.7 stub default-metric 10
commit

Configure the stub statement on every router inside area 7; only the ABR needs default-metric, which injects the default route that lets stub routers reach external destinations. Adding no-summaries on the ABR blocks Type 3 summary LSAs and converts the area into a totally stubby area. Areas that must import redistributed external routes while still filtering Type 5 LSAs should use NSSA instead.

Verifying Junos OSPF Adjacencies

After commit, confirm the protocol stanza and then check neighbor state from operational mode:

show protocols ospf
show ospf interface detail
show ospf neighbor
show ospf neighbor detail

Neighbors should reach Full. If two devices never form an adjacency, check that area IDs match on the shared segment, the router IDs are unique, MTU matches (or ospf mtu-ignore is set), and no firewall filter silently drops protocol 89 traffic.

Design Notes and Related Reading

Understand how stub, totally stubby and NSSA areas interact with LSA types in our OSPF area types guide. All Junos configuration changes should be staged with commit confirmed and rollback, and once OSPF is running, inter-area traffic often needs static routes with qualified next hops for backup paths.

原文链接:https://www.juniper.net/documentation/us/en/software/junos/ospf/topics/topic-map/configuring-ospf-areas.html