Configure OSPF
Learn how to configure the OSPF protocol on your MX204, MX301, MX304, MX10004, or MX10008 router.
Configuring OSPF on a Juniper MX204, MX301, MX304, MX10004, or MX10008 router involves
defining the area, assigning interfaces to that area, and enabling the protocol under the
[edit protocols ospf]hierarchy. Core commands include set protocols ospf area <area-id> interface
<interface-name> and commit to apply
changes.
Before you begin:
-
Configure the device interfaces. See the Junos OS Network Interfaces Library for Routing Devices.
-
Configure the router identifiers for the devices in your OSPF network. See Example: Configuring an OSPF Router Identifier.
-
Control OSPF designated router election. See Example: Controlling OSPF Designated Router Election
To configure OSPF on a Juniper MX router (Junos OS), perform the following steps:
-
Navigate to the configuration mode and set up the OSPF area and interfaces:
Configure OSPF area 0 and add interfaces set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 set protocols ospf area 0.0.0.0 interface ge-0/0/1.0
Set passive interface if you want to advertise a network without forming adjacencies set protocols ospf area 0.0.0.0 interface lo0.0 passive.
Enable P2P mode on an ethernet port with only two routers on a segment:
set protocols ospf area 0 interface et-x/x/x interface-type p2p
-
Manually configure a unique Router ID:
set protocols ospf router-id 1.1.1.1
-
If using high-speed links (10G+), adjust the reference bandwidth to ensure accurate cost calculations:
set protocols ospf reference-bandwidth 10g
Commit the configuration:
user@host# commit
Verify the configuration:
show ospf neighbor: Verify OSPF adjacency with neighbors. show ospf interface: View OSPF-enabled interfaces. show route protocol ospf: View routes learned via OSPF.
For more information on configuring the OSPF Routing protocol in Junos OS, see Configuring OSPF Routing Policy.