Related Documentation
- ACX, J, M, MX, QFX, SRX, T Series
- OSPF Overview
- M, MX, PTX, T Series
- Introduction to Logical Systems in the Logical Systems Configuration Guide.
Examples: Configuring OSPF and Logical Systems
- OSPF Support for Logical Systems
- Example: Configuring OSPF on Logical Systems Within the Same Router
- Example: Configuring a Conditional OSPF Default Route Policy on Logical Systems
- Example: Configuring an OSPF Default Route Policy on Logical Systems
- Example: Configuring an OSPF Import Policy on Logical Systems
OSPF Support for Logical Systems
This topic describes the following information:
Introduction to Logical Systems
With Junos OS, you can partition a single physical router into multiple logical devices that perform independent routing tasks. Because logical systems perform a subset of the tasks once handled by the main router, logical systems offer an effective way to maximize the use of a single routing or switching platform. Logical systems have their own unique routing tables, interfaces, policies, and routing instances.
OSPF and Logical Systems
You can configure both OSPF Version 2 (OSPFv2) and OSPF Version 3 (OSPFv3) for logical systems. In the case of OSPFv3, you can also configure OSPFv3 realms for logical systems, which allows OSPFv3 to advertise address families other than unicast IPv6.
You configure OSPF for logical systems at the following hierarchy levels:
- [edit logical-systems logical-system-name protocols (ospf | ospf3)]
- [edit logical-systems logical-system-name protocols ospf3 realm (ipv4-unicast | ipv4-multicast | ipv6-multicast)]
- [edit logical-systems logical-system-name routing-instances routing-instance-name protocols (ospf | ospf3)]
- [edit logical-systems logical-system-name routing-instances routing-instance-name protocols ospf3 realm (ipv4-unicast | ipv4-multicast | ipv6-multicast)]
Example: Configuring OSPF on Logical Systems Within the Same Router
This example shows how to configure an OSPF network using multiple logical systems that are running on a single physical router. The logical systems are connected by logical tunnel interfaces.
Requirements
You must connect the logical systems by using logical tunnel (lt) interfaces. See Example: Connecting Logical Systems Within the Same Router Using Logical Tunnel Interfaces.
Overview
This example shows the configuration of a single OSPF area with three logical systems running on one physical router. Each logical system has its own routing table. The configuration enables the protocol on all logical system interfaces that participate in the OSPF domain and specifies the area that the interfaces are in.
Figure 1 shows the sample network.
Figure 1: OSPF on Logical Systems

Configuration
CLI Quick Configuration
To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.
Step-by-Step Procedure
The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.
To configure OSPF on logical systems:
Configure the logical tunnel interface on Logical System LS1 connecting to Logical System LS2.
[edit]user@host# set logical-systems LS1 interfaces lt-1/2/0 unit 2 description LS1->LS2 user@host# set logical-systems LS1 interfaces lt-1/2/0 unit 2 encapsulation ethernet user@host# set logical-systems LS1 interfaces lt-1/2/0 unit 2 peer-unit 1 user@host# set logical-systems LS1 interfaces lt-1/2/0 unit 2 family inet address 10.0.0.1/30Configure the logical tunnel interface on Logical System LS1 connecting to Logical System LS3.
[edit]user@host# set logical-systems LS1 interfaces lt-1/2/0 unit 0 description LS1->LS3 user@host# set logical-systems LS1 interfaces lt-1/2/0 unit 0 encapsulation ethernet user@host# set logical-systems LS1 interfaces lt-1/2/0 unit 0 peer-unit 5 user@host# set logical-systems LS1 interfaces lt-1/2/0 unit 0 family inet address 10.0.1.2/30Configure the logical tunnel interface on Logical System LS2 connecting to Logical System LS1.
[edit]user@host# set logical-systems LS2 interfaces lt-1/2/0 unit 1 description LS2->LS1 user@host# set logical-systems LS2 interfaces lt-1/2/0 unit 1 encapsulation ethernet user@host# set logical-systems LS2 interfaces lt-1/2/0 unit 1 peer-unit 2 user@host# set logical-systems LS2 interfaces lt-1/2/0 unit 1 family inet address 10.0.0.2/30Configure the logical tunnel interface on Logical System LS2 connecting to Logical System LS3.
[edit]user@host# set logical-systems LS2 interfaces lt-1/2/0 unit 4 description LS2->LS3 user@host# set logical-systems LS2 interfaces lt-1/2/0 unit 4 encapsulation ethernet user@host# set logical-systems LS2 interfaces lt-1/2/0 unit 4 peer-unit 3 user@host# set logical-systems LS2 interfaces lt-1/2/0 unit 4 family inet address 10.0.2.2/30Configure the logical tunnel interface on Logical System LS3 connecting to Logical System LS2.
[edit]user@host# set logical-systems LS3 interfaces lt-1/2/0 unit 3 description LS3->LS2 user@host# set logical-systems LS3 interfaces lt-1/2/0 unit 3 encapsulation ethernet user@host# set logical-systems LS3 interfaces lt-1/2/0 unit 3 peer-unit 4 user@host# set logical-systems LS3 interfaces lt-1/2/0 unit 3 family inet address 10.0.2.1/30Configure the logical tunnel interface on Logical System LS3 connecting to Logical System LS1.
[edit]user@host# set logical-systems LS3 interfaces lt-1/2/0 unit 5 description LS3->LS1 user@host# set logical-systems LS3 interfaces lt-1/2/0 unit 5 encapsulation ethernet user@host# set logical-systems LS3 interfaces lt-1/2/0 unit 5 peer-unit 0 user@host# set logical-systems LS3 interfaces lt-1/2/0 unit 5 family inet address 10.0.1.1/30Configure OSPF on all the interfaces.
[edit]user@host# set logical-systems LS1 protocols ospf area 0.0.0.0 interface lt-1/2/0.0 user@host# set logical-systems LS1 protocols ospf area 0.0.0.0 interface lt-1/2/0.2 user@host# set logical-systems LS2 protocols ospf area 0.0.0.0 interface lt-1/2/0.1 user@host# set logical-systems LS2 protocols ospf area 0.0.0.0 interface lt-1/2/0.4 user@host# set logical-systems LS3 protocols ospf area 0.0.0.0 interface lt-1/2/0.5 user@host# set logical-systems LS3 protocols ospf area 0.0.0.0 interface lt-1/2/0.3If you are done configuring the device, commit the configuration.
[edit]user@host# commit
Results
Confirm your configuration by issuing the show logical-systems command.
Verification
Confirm that the configuration is working properly.
Verifying That the Logical Systems Are Up
Purpose
Make sure that the interfaces are properly configured.
Action
user@host> show interfaces terse
Interface Admin Link Proto Local Remote ... lt-1/2/0 up up lt-1/2/0.0 up up inet 10.0.1.2/30 lt-1/2/0.1 up up inet 10.0.0.2/30 lt-1/2/0.2 up up inet 10.0.0.1/30 lt-1/2/0.3 up up inet 10.0.2.1/30 lt-1/2/0.4 up up inet 10.0.2.2/30 lt-1/2/0.5 up up inet 10.0.1.1/30 ...
Verifying Connectivity Between the Logical Systems
Purpose
Make sure that the OSPF adjacencies are established by checking the OSPF neighbor tables, checking the routing tables, and pinging the logical systems.
Action
user@host> show ospf neighbor logical-system
LS1
Address Interface State ID Pri Dead 10.0.1.1 lt-1/2/0.0 Full 10.0.1.1 128 37 10.0.0.2 lt-1/2/0.2 Full 10.0.0.2 128 33
user@host> show ospf neighbor logical-system
LS2
Address Interface State ID Pri Dead 10.0.0.1 lt-1/2/0.1 Full 10.0.0.1 128 32 10.0.2.1 lt-1/2/0.4 Full 10.0.1.1 128 36
user@host> show ospf neighbor logical-system
LS3
Address Interface State ID Pri Dead 10.0.2.2 lt-1/2/0.3 Full 10.0.0.2 128 36 10.0.1.2 lt-1/2/0.5 Full 10.0.0.1 128 37
user@host> show route logical-system LS1
inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.0.0.0/30 *[Direct/0] 00:28:00 > via lt-1/2/0.2 10.0.0.1/32 *[Local/0] 00:28:00 Local via lt-1/2/0.2 10.0.1.0/30 *[Direct/0] 00:28:00 > via lt-1/2/0.0 10.0.1.2/32 *[Local/0] 00:28:00 Local via lt-1/2/0.0 10.0.2.0/30 *[OSPF/10] 00:27:05, metric 2 > to 10.0.1.1 via lt-1/2/0.0 to 10.0.0.2 via lt-1/2/0.2 224.0.0.5/32 *[OSPF/10] 00:28:03, metric 1 MultiRecv
user@host> show route logical-system LS2
inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.0.0.0/30 *[Direct/0] 00:28:31 > via lt-1/2/0.1 10.0.0.2/32 *[Local/0] 00:28:32 Local via lt-1/2/0.1 10.0.1.0/30 *[OSPF/10] 00:27:38, metric 2 > to 10.0.0.1 via lt-1/2/0.1 to 10.0.2.1 via lt-1/2/0.4 10.0.2.0/30 *[Direct/0] 00:28:32 > via lt-1/2/0.4 10.0.2.2/32 *[Local/0] 00:28:32 Local via lt-1/2/0.4 224.0.0.5/32 *[OSPF/10] 00:28:34, metric 1 MultiRecv
user@host> show route logical-system LS3
inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.0.0.0/30 *[OSPF/10] 00:28:23, metric 2 > to 10.0.2.2 via lt-1/2/0.3 to 10.0.1.2 via lt-1/2/0.5 10.0.1.0/30 *[Direct/0] 00:29:13 > via lt-1/2/0.5 10.0.1.1/32 *[Local/0] 00:29:15 Local via lt-1/2/0.5 10.0.2.0/30 *[Direct/0] 00:29:14 > via lt-1/2/0.3 10.0.2.1/32 *[Local/0] 00:29:15 Local via lt-1/2/0.3 224.0.0.5/32 *[OSPF/10] 00:29:16, metric 1 MultiRecv
From LS1, Ping LS3
user@host> set cli logical-system LS1
user@host:LS1> ping 10.0.2.1
PING 10.0.2.1 (10.0.2.1): 56 data bytes 64 bytes from 10.0.2.1: icmp_seq=0 ttl=64 time=1.215 ms 64 bytes from 10.0.2.1: icmp_seq=1 ttl=64 time=1.150 ms 64 bytes from 10.0.2.1: icmp_seq=2 ttl=64 time=1.134 ms
From LS3, Ping LS1
user@host> set cli logical-system LS3
user@host:LS3> ping 10.0.0.1
PING 10.0.0.1 (10.0.0.1): 56 data bytes 64 bytes from 10.0.0.1: icmp_seq=0 ttl=64 time=1.193 ms 64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=1.114 ms 64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=1.190 ms
Example: Configuring a Conditional OSPF Default Route Policy on Logical Systems
This example shows how to configure a conditional default route on one logical system and inject the default route into OSPF area 0.
Requirements
Before you begin:
- Connect the logical systems by using logical tunnel (lt) interfaces. See Example: Connecting Logical Systems Within the Same Router Using Logical Tunnel Interfaces.
- Enable OSPF on the interfaces. See Example: Configuring OSPF on Logical Systems Within the Same Router.
Overview
In this example, OSPF area 0 contains three logical systems that are configured on a single physical router. Logical System LS3 has a BGP session with an external peer, for example, an ISP.
The ISP injects a default static route into BGP, which provides the customer network with a default static route to reach external networks. Logical System LS3 exports the default route into OSPF. The route policy on Logical System LS3 is conditional such that if the connection to the external peer goes down, the default route is no longer active in the routing tables of the logical systems in area 0. This policy prevents blackholing of traffic. Blackholing occurs when packets are dropped without notification.
Figure 2 shows the sample network.
Figure 2: OSPF with a Conditional Default Route to an ISP

Configuration
CLI Quick Configuration
To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.
Device LS1
Device LS2
Device LS3
Device ISP
Step-by-Step Procedure
The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.
To configure a conditional default route:
- Configure the interfaces.[edit logical-systems LS3 interfaces]user@R3# set lt-1/2/0 unit 3 description LS3->LS2user@R3# set lt-1/2/0 unit 3 encapsulation ethernetuser@R3# set lt-1/2/0 unit 3 peer-unit 4user@R3# set lt-1/2/0 unit 3 family inet address 10.0.2.1/30user@R3# set lt-1/2/0 unit 5 description LS3->LS1user@R3# set lt-1/2/0 unit 5 encapsulation ethernetuser@R3# set lt-1/2/0 unit 5 peer-unit 0user@R3# set lt-1/2/0 unit 5 family inet address 10.0.1.1/30user@R3# set so-0/0/2 unit 0 description LS3->ISPuser@R3# set so-0/0/2 unit 0 encapsulation ethernetuser@R3# set so-0/0/2 unit 0 peer-unit 7user@R3# set so-0/0/2 unit 0 family inet address 10.0.45.2/30
Configure the autonomous system (AS) number.
[edit logical-systems LS3 routing-options]user@R3# set autonomous-system 65001- Configure the BGP session with the ISP device.[edit logical-systems LS3 protocols bgp group ext]user@R3# set type externaluser@R3# set peer-as 65000user@R3# set neighbor 10.0.45.1
Configure OSPF.
[edit logical-systems LS3 protocols ospf area 0.0.0.0]user@R3# set interface lt-1/2/0.5user@R3# set interface lt-1/2/0.3Configure the routing policy.
[edit logical-systems LS3 policy-options policy-statement gendefault]user@R3# set term upstreamroutes from protocol bgpuser@R3# set term upstreamroutes from as-path upstreamuser@R3# set term upstreamroutes from route-filter 0.0.0.0/0 upto /16user@R3# set term upstreamroutes then next-hop 10.0.45.1user@R3# set term upstreamroutes then accept
user@R3# set term end then reject
[edit logical-systems LS3 policy-options]user@R3# set as-path upstream "^65000 "Configure the generated route.
[edit logical-systems LS3 routing-options]user@R3# set generate route 0.0.0.0/0 policy gendefaultApply the export policy to OSPF.
[edit logical-systems LS3 protocols ospf]user@R3# set export gendefaultIf you are done configuring the device, commit the configuration.
[edit]user@R3# commit
Results
Confirm your configuration by issuing the show logical-systems LS3 command.
Verification
Confirm that the configuration is working properly.
- Verifying that the Route to the ISP Is Working
- Verifying That the Static Route Is Redistributed
- Testing the Policy Condition
Verifying that the Route to the ISP Is Working
Purpose
Make sure connectivity is established between Logical System LS3 and the ISP’s router.
Action
user@host>set cli logical-system LS3
Logical system: LS3
user@host:LS3>ping 10.0.45.1
PING 10.0.45.1 (10.0.45.1): 56 data bytes 64 bytes from 10.0.45.1: icmp_seq=0 ttl=64 time=1.185 ms 64 bytes from 10.0.45.1: icmp_seq=1 ttl=64 time=1.199 ms 64 bytes from 10.0.45.1: icmp_seq=2 ttl=64 time=1.186 ms
Meaning
The ping command confirms reachability.
Verifying That the Static Route Is Redistributed
Purpose
Make sure that the BGP policy is redistributing the static route into Logical System LS3’s routing table. Also make sure that the OSPF policy is redistributing the static route into the routing tables of Logical System LS1 and Logical System LS2.
Action
user@host> show route logical-system LS3 protocol
bgp
inet.0: 9 destinations, 10 routes (9 active, 0 holddown, 1 hidden) + = Active Route, - = Last Active, * = Both 0.0.0.0/0 *[BGP/170] 00:00:25, localpref 100 AS path: 65000 I > to 10.0.45.1 via so-0/0/2.0
user@host> show route logical-system LS1 protocol
ospf
inet.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 0.0.0.0/0 *[OSPF/150] 00:03:58, metric 0, tag 0 > to 10.0.1.1 via lt-1/2/0.0 10.0.2.0/30 *[OSPF/10] 03:37:45, metric 2 to 10.0.1.1 via lt-1/2/0.0 > to 10.0.0.2 via lt-1/2/0.2 224.0.0.5/32 *[OSPF/10] 03:38:41, metric 1 MultiRecv
user@host> show route logical-system LS2 protocol
ospf
inet.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 0.0.0.0/0 *[OSPF/150] 00:04:04, metric 0, tag 0 > to 10.0.2.1 via lt-1/2/0.4 10.0.1.0/30 *[OSPF/10] 03:37:46, metric 2 to 10.0.0.1 via lt-1/2/0.1 > to 10.0.2.1 via lt-1/2/0.4 224.0.0.5/32 *[OSPF/10] 03:38:47, metric 1 MultiRecv
Meaning
The routing tables contain the default 0.0.0.0/0 route. If Logical System LS1 and Logical System LS2 receive packets destined for networks not specified in their routing tables, those packets will be sent to Logical System LS3 for further processing. If Logical System LS3 receives packets destined for networks not specified in its routing table, those packets will be sent to the ISP for further processing.
Testing the Policy Condition
Purpose
Deactivate the interface to make sure that the route is removed from the routing tables if the external network becomes unreachable.
Action
user@host> deactivate logical-systems LS3 interfaces
so-0/0/2 unit 0 family inet address 10.0.45.2/30
user@host> commit
user@host> show route logical-system LS1 protocol
ospf
inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.0.2.0/30 *[OSPF/10] 03:41:48, metric 2 to 10.0.1.1 via lt-1/2/0.0 > to 10.0.0.2 via lt-1/2/0.2 224.0.0.5/32 *[OSPF/10] 03:42:44, metric 1 MultiRecv
user@host> show route logical-system LS2 protocol
ospf
inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.0.1.0/30 *[OSPF/10] 03:42:10, metric 2 to 10.0.0.1 via lt-1/2/0.1 > to 10.0.2.1 via lt-1/2/0.4 224.0.0.5/32 *[OSPF/10] 03:43:11, metric 1 MultiRecv
Meaning
The routing tables on Logical System LS1 and Logical System LS2 do not contain the default 0.0.0.0/0. This verifies that the default route is no longer present in the OSPF domain. To reactivate the so-0/0/2.0 interface, issue the activate logical-systems LS3 interfaces so-0/0/2 unit 0 family inet address 10.0.45.2/30 configuration-mode command.
Example: Configuring an OSPF Default Route Policy on Logical Systems
This example shows how to configure a default route on one logical system and inject the default route into OSPF area 0. In this example, OSPF area 0 contains three logical systems that are configured on a single physical router.
Requirements
Before you begin:
- Connect the logical systems by using logical tunnel (lt) interfaces. See Example: Connecting Logical Systems Within the Same Router Using Logical Tunnel Interfaces.
- Enable OSPF on the interfaces. See Example: Configuring OSPF on Logical Systems Within the Same Router.
Overview
This example shows a logical system redistributing a default route to other logical systems. All logical systems are running OSPF. A common reason for a default route is to provide a path for sending traffic destined outside the OSPF domain.
In this example, the default route is not used for forwarding traffic. The no-install statement prevents the route from being installed in the forwarding table of Logical System LS3. If you configure a route so it is not installed in the forwarding table, the route is still eligible to be exported from the routing table to other protocols. The discard statement silently drops packets without notice.
Figure 3 shows the sample network.
Figure 3: OSPF with a Default Route to an ISP

Configuration
CLI Quick Configuration
To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.
Step-by-Step Procedure
The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.
To configure an OSPF default route policy on logical systems:
Change the context to Logical System LS3.
[edit]user@host> set cli logical-system LS3Configure the default route on Logical System LS3.
[edit]user@host:LS3# set routing-options static route 0.0.0.0/0 discard user@host:LS3# set routing-options static route 0.0.0.0/0 no-installConfigure the policy on Logical System LS3.
[edit]user@host:LS3# set policy-options policy-statement ospf-default from protocol static user@host:LS3# set policy-options policy-statement ospf-default from route-filter 0.0.0.0/0 exact user@host:LS3# set policy-options policy-statement ospf-default then acceptApply the export policy to OSPF on Logical System LS3.
[edit]user@host:LS3# set protocols ospf export ospf-defaultIf you are done configuring the device, commit the configuration.
[edit]user@host:LS3# commit
Results
Confirm your configuration by issuing the show logical-systems LS3 command.
Verification
Confirm that the configuration is working properly.
Verifying That the Static Route Is Redistributed
Purpose
Make sure that the OSPF policy is working by checking the routing tables.
Action
user@host> show route logical-system LS3
inet.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 0.0.0.0/0 *[Static/5] 01:04:38 Discard 10.0.0.0/30 *[OSPF/10] 11:53:55, metric 2 to 10.0.2.2 via lt-1/2/0.3 > to 10.0.1.2 via lt-1/2/0.5 10.0.1.0/30 *[Direct/0] 11:54:50 > via lt-1/2/0.5 10.0.1.1/32 *[Local/0] 11:54:54 Local via lt-1/2/0.5 10.0.2.0/30 *[Direct/0] 11:54:50 > via lt-1/2/0.3 10.0.2.1/32 *[Local/0] 11:54:54 Local via lt-1/2/0.3 224.0.0.5/32 *[OSPF/10] 11:56:55, metric 1 MultiRecv
user@host> show route logical-system LS1
inet.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 0.0.0.0/0 *[OSPF/150] 01:02:34, metric 0, tag 0 > to 10.0.1.1 via lt-1/2/0.0 10.0.0.0/30 *[Direct/0] 11:52:46 > via lt-1/2/0.2 10.0.0.1/32 *[Local/0] 11:52:50 Local via lt-1/2/0.2 10.0.1.0/30 *[Direct/0] 11:52:46 > via lt-1/2/0.0 10.0.1.2/32 *[Local/0] 11:52:50 Local via lt-1/2/0.0 10.0.2.0/30 *[OSPF/10] 11:51:56, metric 2 > to 10.0.1.1 via lt-1/2/0.0 to 10.0.0.2 via lt-1/2/0.2 224.0.0.5/32 *[OSPF/10] 11:54:50, metric 1 MultiRecv
user@host> show route logical-system LS2
inet.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 0.0.0.0/0 *[OSPF/150] 01:05:20, metric 0, tag 0 > to 10.0.2.1 via lt-1/2/0.4 10.0.0.0/30 *[Direct/0] 11:55:32 > via lt-1/2/0.1 10.0.0.2/32 *[Local/0] 11:55:36 Local via lt-1/2/0.1 10.0.1.0/30 *[OSPF/10] 11:54:37, metric 2 > to 10.0.0.1 via lt-1/2/0.1 to 10.0.2.1 via lt-1/2/0.4 10.0.2.0/30 *[Direct/0] 11:55:32 > via lt-1/2/0.4 10.0.2.2/32 *[Local/0] 11:55:36 Local via lt-1/2/0.4 224.0.0.5/32 *[OSPF/10] 11:57:36, metric 1 MultiRecv
Meaning
The routing table on Logical System LS3 contains the default 0.0.0.0/0 route from protocol Static. The routing tables on Logical System LS1 and Logical System LS2 contain the default 0.0.0.0/0 route from protocol OSPF. If Logical System LS1 and Logical System LS2 receive packets destined for networks not specified in their routing tables, those packets will be sent to Logical System LS3 for further processing. This configuration assumes that Logical System LS3 has a connection to an ISP or another external network.
Example: Configuring an OSPF Import Policy on Logical Systems
This example shows how to configure an OSPF import policy on logical systems. OSPF import policies apply to external routes only. An external route is a route that is outside the OSPF AS.
Requirements
This example shows logical systems that are configured within a single physical router. The logical systems connect to each other by using logical tunnel (lt) interfaces. See Example: Connecting Logical Systems Within the Same Router Using Logical Tunnel Interfaces. Alternatively, you can use multiple physical routers.
Overview
External routes are learned by Autonomous System Border Routers (ASBRs). External routes can be advertised throughout the OSPF domain if you configure the ASBR to redistribute the route into OSPF. An external route might be learned by the ASBR from a routing protocol other than OSPF, or the external route might be a static route that you configure on the ASBR.
OSPF import policy allows you to prevent external routes from being added to the routing tables of OSPF neighbors. The import policy does not impact the OSPF database. This means that the import policy has no impact on the link-state advertisements.
OSPF import policies have practical applications. Suppose, for example, that you are using OSPF to advertise a static route to the devices in your datacenter because you want some of the devices in the datacenter to use the static route. However, you want other devices in the datacenter to ignore the static route. So, you apply the OSPF import policy on the devices that you want to ignore the static route. The filtering is done only on external routes in OSPF. The intra-area and inter-area routes are not considered for filtering. The default action is to accept the route when the route does not match the policy.
Figure 4 shows the sample network.
Figure 4: OSPF Import Policy on Logical Systems

In this example, the logical systems operate as follows:
- LS3—Logical System LS3 has a static route to the 10.0.16.0/30 network. The next hop for the static route is 10.0.60.1. LS3 has an OSPF export policy configured. The export policy redistributes static routes from LS3’s routing table into LS3’s OSPF database. Because the static route is in LS3’s OSPF database, the route is advertised in a link state advertisement (LSA) to LS3’s OSPF neighbor. LS3’s OSPF neighbor is Logical System LS2.
- LS2—Logical System LS2 receives the route advertisement from LS3. LS2 then installs the route into LS2’s OSPF database. LS2 has an OSPF import policy configured that matches the static route to the 10.0.16.0/30 network and prevents the static route from being installed in LS2’s routing table. However, because the route is in LS2’s OSPF database, LS2 advertises the route to its OSPF neighbor, Logical System LS1.
- LS1—Logical System LS1 receives the route advertisement from LS2. LS1 then installs the route into LS1’s OSPF database. LS1 does not have an OSPF import policy configured that matches the static route to the 10.0.16.0/30 network . Therefore, the route gets installed in LS1’s routing table.
Configuration
CLI Quick Configuration
To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.
LS3
LS2
LS1
Step-by-Step Procedure
The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.
To configure an OSPF import policy on logical systems:
Configure the interfaces.
[edit]user@R1# set logical-systems LS3 interfaces so-0/0/0 unit 0 family inet address 10.0.60.2/30 user@R1# set logical-systems LS3 interfaces lt-1/2/0 unit 3 description LS3->LS2 user@R1# set logical-systems LS3 interfaces lt-1/2/0 unit 3 encapsulation ethernet user@R1# set logical-systems LS3 interfaces lt-1/2/0 unit 3 peer-unit 4 user@R1# set logical-systems LS3 interfaces lt-1/2/0 unit 3 family inet address 10.0.2.1/30 user@R1# set logical-systems LS2 interfaces lt-1/2/0 unit 1 description LS2->LS1 user@R1# set logical-systems LS2 interfaces lt-1/2/0 unit 1 encapsulation ethernet user@R1# set logical-systems LS2 interfaces lt-1/2/0 unit 1 peer-unit 2 user@R1# set logical-systems LS2 interfaces lt-1/2/0 unit 1 family inet address 10.0.0.2/30 user@R1# set logical-systems LS2 interfaces lt-1/2/0 unit 4 description LS2->LS3 user@R1# set logical-systems LS2 interfaces lt-1/2/0 unit 4 encapsulation ethernet user@R1# set logical-systems LS2 interfaces lt-1/2/0 unit 4 peer-unit 3 user@R1# set logical-systems LS2 interfaces lt-1/2/0 unit 4 family inet address 10.0.2.2/30 user@R1# set logical-systems LS1 interfaces lt-1/2/0 unit 2 description LS1->LS2 user@R1# set logical-systems LS1 interfaces lt-1/2/0 unit 2 encapsulation ethernet user@R1# set logical-systems LS1 interfaces lt-1/2/0 unit 2 peer-unit 1 user@R1# set logical-systems LS1 interfaces lt-1/2/0 unit 2 family inet address 10.0.0.1/30Enable OSPF on the interfaces.
[edit]user@R1# set logical-systems LS3 protocols ospf area 0.0.0.0 interface lt-1/2/0.3 user@R1# set logical-systems LS2 protocols ospf area 0.0.0.0 interface lt-1/2/0.1user@R1# set logical-systems LS2 protocols ospf area 0.0.0.0 interface lt-1/2/0.4user@R1# set logical-systems LS1 protocols ospf area 0.0.0.0 interface lt-1/2/0.2Configure the static route on Logical System LS3.
[edit]user@R1# set logical-systems LS3 routing-options static route 10.0.16.0/30 next-hop 10.0.60.1On Logical System LS3, redistribute the static route into OSPF.
[edit]user@R1# set logical-systems LS3 protocols ospf export export_static user@R1# set logical-systems LS3 policy-options policy-statement export_static from protocol static user@R1# set logical-systems LS3 policy-options policy-statement export_static then acceptOn Logical System LS2, configure the OSPF import policy.
[edit]user@R1# set logical-systems LS2 protocols ospf import filter_routes user@R1# set logical-systems LS2 policy-options policy-statement filter_routes from route-filter 10.0.16.0/30 exact user@R1# set logical-systems LS2 policy-options policy-statement filter_routes then rejectIf you are done configuring the device, commit the configuration.
[edit]user@R1# commit
Results
Confirm your configuration by issuing the show logical-systems command.
Verification
Confirm that the configuration is working properly.
Viewing the OSPF Databases of the Logical Systems
Purpose
Verify that OSPF is advertising the static route.
Action
user@R1> show ospf database logical-system all
logical-system: LS2 OSPF database, Area 0.0.0.0 Type ID Adv Rtr Seq Age Opt Cksum Len Router 10.0.0.1 10.0.0.1 0x8000001f 107 0x22 0x8f59 36 Router *10.0.0.2 10.0.0.2 0x80000025 101 0x22 0x4074 48 Router 10.0.2.1 10.0.2.1 0x80000018 107 0x22 0xab3a 36 Network 10.0.0.1 10.0.0.1 0x80000001 107 0x22 0x7b94 32 Network 10.0.2.1 10.0.2.1 0x8000000c 190 0x22 0x53ab 32 OSPF AS SCOPE link state database Type ID Adv Rtr Seq Age Opt Cksum Len Extern 10.0.16.0 10.0.2.1 0x80000007 1785 0x22 0x4147 36 ----- logical-system: LS1 OSPF database, Area 0.0.0.0 Type ID Adv Rtr Seq Age Opt Cksum Len Router *10.0.0.1 10.0.0.1 0x8000001f 107 0x22 0x8f59 36 Router 10.0.0.2 10.0.0.2 0x80000025 103 0x22 0x4074 48 Router 10.0.2.1 10.0.2.1 0x80000018 109 0x22 0xab3a 36 Network *10.0.0.1 10.0.0.1 0x80000001 107 0x22 0x7b94 32 Network 10.0.2.1 10.0.2.1 0x8000000c 192 0x22 0x53ab 32 OSPF AS SCOPE link state database Type ID Adv Rtr Seq Age Opt Cksum Len Extern 10.0.16.0 10.0.2.1 0x80000007 1787 0x22 0x4147 36 ----- logical-system: LS3 OSPF database, Area 0.0.0.0 Type ID Adv Rtr Seq Age Opt Cksum Len Router 10.0.0.1 10.0.0.1 0x8000001f 109 0x22 0x8f59 36 Router 10.0.0.2 10.0.0.2 0x80000025 103 0x22 0x4074 48 Router *10.0.2.1 10.0.2.1 0x80000018 107 0x22 0xab3a 36 Network 10.0.0.1 10.0.0.1 0x80000001 109 0x22 0x7b94 32 Network *10.0.2.1 10.0.2.1 0x8000000c 190 0x22 0x53ab 32 OSPF AS SCOPE link state database Type ID Adv Rtr Seq Age Opt Cksum Len Extern *10.0.16.0 10.0.2.1 0x80000007 1785 0x22 0x4147 36 ...
Meaning
The Extern *10.0.16.0 output shows that OSPF is advertising the external route.
Viewing the Routing Tables of the Logical Systems
Purpose
Make sure that Logical System LS3 and Logical System LS1 have the route to the 10.0.16.0/30 network installed in their respective routing tables. Make sure that Logical System LS2 does not have the route installed in its routing table.
Action
user@R1> show route logical-system all
logical-system: LS2 inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.0.0.0/30 *[Direct/0] 04:22:19 > via lt-1/2/0.1 10.0.0.2/32 *[Local/0] 04:22:19 Local via lt-1/2/0.1 10.0.2.0/30 *[Direct/0] 04:22:19 > via lt-1/2/0.4 10.0.2.2/32 *[Local/0] 04:22:19 Local via lt-1/2/0.4 224.0.0.5/32 *[OSPF/10] 04:22:23, metric 1 MultiRecv ----- logical-system: LS1 inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.0.0.0/30 *[Direct/0] 04:22:19 > via lt-1/2/0.2 10.0.0.1/32 *[Local/0] 04:22:19 Local via lt-1/2/0.2 10.0.2.0/30 *[OSPF/10] 00:07:52, metric 2 > to 10.0.0.2 via lt-1/2/0.2 10.0.16.0/30 *[OSPF/150] 00:07:52, metric 0, tag 0 > to 10.0.0.2 via lt-1/2/0.2 224.0.0.5/32 *[OSPF/10] 04:22:23, metric 1 MultiRecv ----- logical-system: LS3 inet.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.0.0.0/30 *[OSPF/10] 00:07:57, metric 2 > to 10.0.2.2 via lt-1/2/0.3 10.0.2.0/30 *[Direct/0] 04:22:19 > via lt-1/2/0.3 10.0.2.1/32 *[Local/0] 04:22:19 Local via lt-1/2/0.3 10.0.16.0/30 *[Static/5] 03:51:18 > to 10.0.60.1 via so-0/0/0.0 10.0.60.0/30 *[Direct/0] 03:53:52 > via so-0/0/0.0 10.0.60.2/32 *[Local/0] 03:53:58 Local via so-0/0/0.0 224.0.0.5/32 *[OSPF/10] 04:22:23, metric 1 MultiRecv
Meaning
The route to 10.0.16.0/30 is not installed in Logical System LS2’s routing table. The route to 10.0.16.0/30 is installed in Logical System LS1’s routing table as a route learned from OSPF. Because it is an OSPF external route, it has a preference value of 150 (instead of 10). By default, routes resulting from OSPF external LSAs are installed with a preference value of 150. The route to 10.0.16.0/30 is installed in Logical System LS3’s routing table as a static route.
Related Documentation
- ACX, J, M, MX, QFX, SRX, T Series
- OSPF Overview
- M, MX, PTX, T Series
- Introduction to Logical Systems in the Logical Systems Configuration Guide.
Published: 2013-02-01
Related Documentation
- ACX, J, M, MX, QFX, SRX, T Series
- OSPF Overview
- M, MX, PTX, T Series
- Introduction to Logical Systems in the Logical Systems Configuration Guide.