Before you can run MPLS on your network, you must have an IGP running on all specified routers and interfaces. The IGP can be either OSPF or IS-IS. For the steps to configure IS-IS, see Configure IS-IS as the IGP.
Figure 3: OSPF Network Topology

The OSPF IGP in the MPLS network in Figure 2 consists of the following:
When you configure OSPF as the IGP, you must enable OSPF and traffic engineering on the router. We also recommend that you manually configure the RID and include the loopback interface (lo0) at the [edit protocols ospf] hierarchy level.
You can enable OSPF throughout the rest of the network by repeating this step as appropriate on other routers until all routers and interfaces establish OSPF neighbors.
To configure OSPF and establish OSPF neighbors, follow these steps:
Action
To enable OSPF on routers in your MPLS network, follow these steps:
Sample Output
user@R6> edit
Entering configuration mode
[edit]
user@R6# edit protocols ospf
[edit protocols ospf]
user@R6# set area 0.0.0.0 interface so-0/0/0.0
[edit protocols ospf]
user@R6# set area 0.0.0.0 interface lo0
[edit protocols ospf]
user@R6# set area 0.0.0.0 interface lo0 passive
[edit protocols ospf]
user@R6# set traffic-engineering
[edit protocols ospf]
user@R6# show
traffic-engineering;
area 0.0.0.0 {
interface so-0/0/0.0;
interface so-0/0/1.0;
interface so-0/0/2.0;
interface so-0/0/3.0;
interface lo0.0 {
passive;
}
[edit protocols ospf]
user@R6# commit
commit complete
[edit]
user@R6# edit routing-options
[edit routing-options]
user@R6# set router-id 10.0.0.6
[edit routing-options]
user@R6# show
[...Output truncated...]
router-id 10.0.0.6;
autonomous-system 65432;
[edit routing-options]
user@R6# commit
commit complete
Meaning
The sample output shows that OSPF, with traffic engineering, is enabled on the interfaces on egress router R6. In addition, the RID is configured manually to avoid possible problems when the OSPF RID changes; for example, when multiple loopback addresses are configured. The RID uniquely identifies the router within the OSPF network. It is transmitted within the LSAs used to populate the link-state database and calculate the shortest-path tree. In a link-state network, it is important that two routers do not share the same RID value, otherwise IP routing problems may occur.
The sample outputs also shows the passive statement included in the configuration of the loopback (lo0) interface. Including the passive statement is considered best practice and ensures the following:
After configuring OSPF, you must verify that neighboring routers have formed adjacencies with each other.
To verify OSPF neighbors, enter the following JUNOS CLI operational mode command:
user@R1> show ospf neighbor Address Interface State ID Pri Dead 10.1.12.2 so-0/0/0.0 Full 10.0.0.2 128 37 10.1.15.2 so-0/0/1.0 Full 10.0.0.5 128 35 10.1.13.2 so-0/0/2.0 Full 10.0.0.3 128 38 user@R3> show ospf neighbor Address Interface State ID Pri Dead 10.1.34.2 so-0/0/0.0 Full 10.0.0.4 128 38 10.1.23.1 so-0/0/1.0 Full 10.0.0.2 128 35 10.1.13.1 so-0/0/2.0 Full 10.0.0.1 128 37 10.1.36.2 so-0/0/3.0 Full 10.0.0.6 128 36 user@R6> show ospf neighbor Address Interface State ID Pri Dead 10.1.56.1 so-0/0/0.0 Full 10.0.0.5 128 39 10.1.46.1 so-0/0/1.0 Full 10.0.0.4 128 37 10.1.26.1 so-0/0/2.0 Full 10.0.0.2 128 36 10.1.36.1 so-0/0/3.0 Full 10.0.0.3 128 37
The sample output from the ingress, transit, and egress routers shows that all routers in the network shown in Figure 1 have formed OSPF neighbor adjacencies.