Supported Platforms
Example: Advertising Label-Switched Paths into OSPFv2
Advertising Label-Switched Paths into OSPFv2
One main reason to configure label-switched paths (LSPs) in your network is to control the shortest path between two points on the network. You can advertise LSPs into OSPFv2 as point-to-point links so that all participating routing devices can take the LSP into account when performing SPF calculations. The advertisement contains a local address (the from address of the LSP), a remote address (the to address of the LSP), and a metric with the following precedence:
- Use the LSP metric defined under OSPFv2.
- Use the LSP metric configured for the label-switched path under MPLS.
- If you do not configure any of the above, use the default OSPFv2 metric of 1.
![]() | Note: If you want an LSP that is announced into OSPFv2 to be used in SPF calculations, there must be a reverse link (that is, a link from the tail end of the LSP to the head end). You can accomplish this by configuring an LSP in the reverse direction and also announcing it in OSPFv2. |
Example: Advertising Label-Switched Paths into OSPFv2
This example shows how to advertise LSPs into OSPFv2.
Requirements
Before you begin, configure the device interfaces. See the Junos® OS Network Interfaces.
Overview
To advertise an LSP into OSPFv2, you define the LSP and configure OSPFv2 to route traffic using the LSP. By doing this, you can use the LSP to control the shortest path between two points on the network. You might choose to do this if you want to have OSPF traffic routed along the LSP instead of having OSPF use the default best-effort routing.
In this example, you configure the following to advertise an LSP into OSPFv2:
- BGP
For all routing devices, configure the local AS number 65000 and define the IBGP group that recognizes the specified BGP systems as peers. All members are internal to the local AS, so you configure an internal group with a full list of peers. You also include the peer AS group, which is the same as the local AS number that you configure.
- MPLS
For all routing devices, configure the protocol family on each transit logical interface and enable MPLS on all interfaces, except for the management interface (fxp0.0). Specify the mpls protocol family type.
- RSVP
For all routing devices, enable RSVP on all interfaces, except for the management interface (fxp0.0). You enable RSVP on the devices in this network to ensure that the interfaces can signal the LSP.
- OSPFv2
For all routing devices, use the loopback address to assign the router ID, administratively group all of the devices into OSPF area 0.0.0.0, add all of the interfaces participating in OSPF to area 0.0.0.0, and disable OSPF on the management interface (fxp0.0).
- Label-switched path
On the ingress routing device R1, which is the beginning (or head end) of the LSP, configure an LSP with an explicit path. The explicit path indicates that the LSP must go to the next specified IP address in the path without traversing other nodes. In this example, you create an LSP named R1-to-R6, and you specify the IP address of the egress routing device R6.
- Advertise the LSP in OSPFv2
On the ingress routing device R1, you advertise the LSP as a point-to-point link into OSPFv2. You can optionally assign a metric to have the LSP be the more or less preferred path to the destination.
Figure 1 shows a sample network topology that consists of the following:
- BGP is configured on all routing devices, with one local
autonomous system (AS) 65000 that contains three routing devices:
- R1—Device R1 is the ingress device with a router ID of 10.0.0.1. Interface so-0/0/2 connects to Device R3.
- R3—Device R3 is the transit device with a router ID of 10.0.0.3. Interface so-0/0/2 connects to Device R1, and interface so-0/0/3 connects to Device R6.
- R6—Device R6 is the egress device with a router ID of 10.0.0.6. Interface so-0/0/3 connects to Device R3.
- OSPFv2 is configured on all routing devices.
- MPLS and RSVP are enabled on all routing devices.
- One RSVP-signaled LSP is configured on Device R1.
Figure 1: Advertising an LSP into OSPFv2

Configuration
The following examples require you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Modifying the Junos OS Configuration in CLI User Guide.
To configure the devices to advertise an LSP into OSPFv2, perform the following tasks:
- Configuring BGP
- Configuring MPLS
- Configuring RSVP
- Configuring OSPF
- Configuring the LSP
- Advertising the LSP into OSPFv2
Configuring BGP
CLI Quick Configuration
To quickly configure BGP on each routing device, copy the following commands and paste them into the CLI.
Configuration on Device R1:
Configuration on Device R3:
Configuration on Device R6:
Step-by-Step Procedure
To configure BGP:
- On each routing device, configure the local AS number.[edit]user@R1# set routing-options autonomous-system 65000[edit]user@R3# set routing-options autonomous-system 65000[edit]user@R6# set routing-options autonomous-system 65000
- On each routing device, configure the internal BGP neighbor
connections.[edit]user@R1# set protocols bgp group internal-peers type internaluser@R1# set protocols bgp group internal-peers local-address 10.0.0.1user@R1# set protocols bgp group internal-peers neighbor 10.0.0.3user@R1# set protocols bgp group internal-peers neighbor 10.0.0.6user@R1# set protocols bgp group internal-peers peer-as 65000[edit]user@R3# set protocols bgp group internal-peers type internaluser@R3# set protocols bgp group internal-peers local-address 10.0.0.3user@R3# set protocols bgp group internal-peers neighbor 10.0.0.1user@R3# set protocols bgp group internal-peers neighbor 10.0.0.6user@R3# set protocols bgp group internal-peers peer-as 65000[edit]user@R6# set protocols bgp group internal-peers type internaluser@R6# set protocols bgp group internal-peers local-address 10.0.0.6user@R6# set protocols bgp group internal-peers neighbor 10.0.0.1user@R6# set protocols bgp group internal-peers neighbor 10.0.0.3user@R6# set protocols bgp group internal-peers peer-as 65000
- If you are done configuring the devices, commit the configuration.[edit]user@host# commit
Results
Confirm your configuration by entering the show routing-options and show protocols bgp commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
Configuration on R1:
Configuration on R3:
Configuration on R6:
Configuring MPLS
CLI Quick Configuration
To quickly configure MPLS on all of the routing devices in AS 65000, copy the following commands and paste them into the CLI.
Configuration on Device R1:
Configuration on Device R3:
Configuration on Device R6:
Step-by-Step Procedure
To configure MPLS:
- Configure the transit interfaces for MPLS. [edit ]user@R1# set interfaces so-0/0/2 unit 0 family mpls[edit ]user@R3# set interfaces so-0/0/2 unit 0 family mplsuser@R3# set interfaces so-0/0/3 unit 0 family mpls[edit ]user@R6# set interfaces so-0/0/3 unit 0 family mpls
- Enable MPLS. [edit ]user@R1# set protocols mpls interface all[edit ]user@R3# set protocols mpls interface all[edit ]user@R6# set protocols mpls interface all
- Disable MPLS on the management interface (fxp0.0).[edit ]user@R1# set protocols mpls interface fxp0.0 disable[edit ]user@R3# set protocols mpls interface fxp0.0 disable[edit ]user@R6# set protocols mpls interface fxp0.0 disable
- If you are done configuring the devices, commit the configuration.[edit]user@host# commit
Results
Confirm your configuration by entering the show interfaces and show protocols mpls commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
Configuration on Device R1:
Configuration on Device R3:
Configuration on Device R6:
Configuring RSVP
CLI Quick Configuration
To quickly configure RSVP on all of the routing devices in AS 65000, copy the following commands and paste them into the CLI.
Configuration on Device R1:
Configuration on Device R3:
Configuration on Device R6:
Step-by-Step Procedure
To configure RSVP:
- Enable RSVP. [edit ]user@R1# set protocols rsvp interface so-0/0/2[edit ]user@R3# set protocols rsvp interface so-0/0/2user@R3# set protocols rsvp interface so-0/0/3[edit ]user@R6# set protocols rsvp interface so-0/0/3
- Disable RSVP on the management interface (fxp0.0).[edit ]user@R1# set protocols rsvp interface fxp0.0 disable[edit ]user@R3# set protocols rsvp interface fxp0.0 disable[edit ]user@R6# set protocols rsvp interface fxp0.0 disable
- If you are done configuring the devices, commit the configuration.[edit]user@host# commit
Results
Confirm your configuration by entering the show protocols rsvp command. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
Configuration on Device R1:
Configuration on Device R3:
Configuration on Device R6:
Configuring OSPF
CLI Quick Configuration
To quickly configure OSPF, copy the following commands and paste them into the CLI.
Configuration on Device R1:
Configuration on Device R3:
Configuration on Device R6:
Step-by-Step Procedure
To configure OSPF:
- Configure the router ID.[edit]user@R1# set routing-options router-id 10.0.0.1[edit]user@R3# set routing-options router-id 10.0.0.3[edit]user@R6# set routing-options router-id 10.0.0.6
- Configure the OSPF area and the interfaces. [edit]user@R1# set protocols ospf area 0.0.0.0 interface all[edit]user@R3# set protocols ospf area 0.0.0.0 interface all[edit]user@R6# set protocols ospf area 0.0.0.0 interface all
- Disable OSPF on the management interface (fxp0.0).[edit]user@R1# set protocols ospf area 0.0.0.0 interface fxp0.0 disable[edit]user@R3# set protocols ospf area 0.0.0.0 interface fxp0.0 disable[edit]user@R6# set protocols ospf area 0.0.0.0 interface fxp0.0 disable
- If you are done configuring the devices, commit the configuration.[edit ]user@host# commit
Results
Confirm your configuration by entering the show routing-options and the show protocols ospf commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
Configuration on Device R1:
Configuration on Device R3:
Configuration on Device R6:
Configuring the LSP
CLI Quick Configuration
To quickly configure the LSP on the ingress routing device Router R1, copy the following command and paste it into the CLI.
Step-by-Step Procedure
To configure the LSP on Device R1:
- Enter MPLS configuration mode.[edit]user@R1# edit protocols mpls
- Create the LSP. [edit protocols mpls]user@R1# set label-switched-path R1-to-R6 to 10.0.0.6
- If you are done configuring the device, commit the configuration.[edit ]user@R1# commit
Results
Confirm your configuration by entering the show protocols mpls command. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
Advertising the LSP into OSPFv2
CLI Quick Configuration
To quickly advertise the LSP into OSPFv2 and optionally include a metric for the LSP on Device R1, copy the following commands and paste them into the CLI.
Step-by-Step Procedure
To advertise the LSP into OSPFv2 on Router R1:
- Enter OSPF configuration mode.[edit]user@R1# edit protocols ospf
- Include the label-switched-path statement,
and specify the LSP R1-to-R6 that you created.[edit protocols ospf]user@R1# set protocols ospf area 0.0.0.0 label-switched-path R1-to-R6
- (Optional) Specify a metric for the LSP.[edit ]user@R1# set protocols ospf area 0.0.0.0 label-switched-path R1-to-R6 metric 2
- If you are done configuring the device, commit the configuration.[edit ]user@R1# commit
Results
Confirm your configuration by entering the show protocols ospf command. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
Verification
Confirm that the configuration is working properly.
Verifying the OSPF Neighbor
Purpose
Verify that another neighbor is listed and is reachable over the LSP. The interface field indicates the name of the LSP.
Action
From operational mode, enter the show ospf neighbor command.