How to Configure and Monitor OSPF on a Junos Router

By Walter J. Goralski, Cathy Gadecki, Michael Bushong

OSPF is a feature rich, multi-topology protocol that requires some effort to set up for your network’s specific needs. But, configuring and monitoring OSPF on a Junos OS router is straightforward and easy.

First, you must define the OSPF areas to which the router will connect, and then you must enable OSPF on the interfaces on which you want OSPF to run. You can configure these two properties as follows:

[edit protocols]
user@junos-router# set ospf area 0.0.0.0
user@junos-router# set ospf area 0.0.0.0 interface interface-name 

Once OSPF is configured, you can use these commands to monitor OSPF routing on your network:

Command Purpose
show ospf database Displays entries in the OSPF link-state database.
show ospf interface Displays the interfaces on which OSPF is configured.
show ospf neighbor Displays the router’s OSPF neighbors.
show ospf route Displays the contents of the OSPF routing table.
show route protocol ospf Displays the routes learned by OSPF.

You can use the interface all statement to run OSPF on all interfaces. But be careful — be sure to disable OSPF (or any routing protocol) on the management interface or you might find customer traffic on your network management devices!