Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

OSPF on Logical Systems

Logical Systems enable you to configure an OSPF network, running on a single physical router. For more information, see the following topics:

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

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.

Topology

Figure 1 shows the sample network.

Figure 1: OSPF on Logical SystemsOSPF 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, copy and paste the commands into the CLI at the [edit] hierarchy level, and then enter commit from configuration mode.

Procedure

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:

  1. Configure the logical tunnel interface on Logical System LS1 connecting to Logical System LS2.

  2. Configure the logical tunnel interface on Logical System LS1 connecting to Logical System LS3.

  3. Configure the logical tunnel interface on Logical System LS2 connecting to Logical System LS1.

  4. Configure the logical tunnel interface on Logical System LS2 connecting to Logical System LS3.

  5. Configure the logical tunnel interface on Logical System LS3 connecting to Logical System LS2.

  6. Configure the logical tunnel interface on Logical System LS3 connecting to Logical System LS1.

  7. Configure OSPF on all the interfaces.

  8. If you are done configuring the device, commit the configuration.

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

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

From LS1, Ping LS3

From LS3, Ping LS1

Understanding OSPF Routing Policy

Each routing policy is identified by a policy name. The name can contain letters, numbers, and hyphens (-) and can be up to 255 characters long. To include spaces in the name, enclose the entire name in double quotation marks. Each routing policy name must be unique within a configuration. Once a policy is created and named, it must be applied before it is active.

In the import statement, you list the name of the routing policy used to filter OSPF external routes from being installed into the routing tables of OSPF neighbors. You can filter the routes, but not link-state address (LSA) flooding. An external route is a route that is outside the OSPF Autonomous System (AS). The import policy does not impact the OSPF database. This means that the import policy has no impact on the link-state advertisements. The default import policy for OSPF is to accept all learned routes and import them into the routing table.

In the export statement, you list the name of the routing policy to be evaluated when routes are being exported from the routing table into OSPF. The default export policy for OSPF is to reject everything, except LSA type1 and type 2. OSPF does not actually export its internally learned routes (the directly connected routes on interfaces that are running the protocol). OSPF uses link-state advertisement (LSA) flooding to advertise both local routes and learned routes, and LSA flooding is not affected by the export policy.

By default, if a routing device has multiple OSPF areas, learned routes from other areas are automatically installed into area 0 of the routing table.

To specify more than one policy and create a policy chain, you list the policies using a space as a separator. If multiple policies are specified, the policies are evaluated in the order in which they are specified. As soon as an accept or reject action is executed, the policy chain evaluation ends.

This topic describes the following information:

Routing Policy Terms

Routing policies are made up of one or more terms. A term is a named structure in which match conditions and actions are defined. You can define one or more terms. The name can contain letters, numbers, and hyphens ( - ) and can be up to 255 characters long. To include spaces in the name, enclose the entire name in double quotation marks.

Each term contains a set of match conditions and a set of actions:

  • Match conditions are criteria that a route must match before the actions can be applied. If a route matches all criteria, one or more actions are applied to the route.

  • Actions specify whether to accept or reject the route, control how a series of policies are evaluated, and manipulate the characteristics associated with a route.

Routing Policy Match Conditions

A match condition defines the criteria that a route must match for an action to take place. You can define one or more match conditions for each term. If a route matches all of the match conditions for a particular term, the actions defined for that term are processed.

Each term can include two statements, from and to, that define the match conditions:

  • In the from statement, you define the criteria that an incoming route must match. You can specify one or more match conditions. If you specify more than one, they all must match the route for a match to occur.

    The from statement is optional. If you omit the from and the to statements, all routes are considered to match.

    Note:

    In export policies, omitting the from statement from a routing policy term might lead to unexpected results.

  • In the to statement, you define the criteria that an outgoing route must match. You can specify one or more match conditions. If you specify more than one, they all must match the route for a match to occur.

The order of the match conditions in a term is not important because a route must match all match conditions in a term for an action to be taken.

For a complete list of match conditions, see Configuring Match Conditions in Routing Policy Terms.

Routing Policy Actions

An action defines what the routing device does with the route when the route matches all the match conditions in the from and to statements for a particular term. If a term does not have from and to statements, all routes are considered to match and the actions apply to all routes.

Each term can have one or more of the following types of actions. The actions are configured under the then statement.

  • Flow control actions, which affect whether to accept or reject the route and whether to evaluate the next term or routing policy.

  • Actions that manipulate route characteristics.

  • Trace action, which logs route matches.

The then statement is optional. If you omit it, one of the following occurs:

  • The next term in the routing policy, if one exists, is evaluated.

  • If the routing policy has no more terms, the next routing policy, if one exists, is evaluated.

  • If there are no more terms or routing policies, the accept or reject action specified by the default policy is executed.

For a complete list of routing policy actions, see Configuring Actions in Routing Policy Terms.

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

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.

Topology

Figure 2 shows the sample network.

Figure 2: OSPF with a Default Route to an ISPOSPF 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, copy and paste the commands into the CLI at the [edit] hierarchy level, and then enter commit from configuration mode.

Procedure

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:

  1. Change the context to Logical System LS3.

  2. Configure the default route on Logical System LS3.

  3. Configure the policy on Logical System LS3.

  4. Apply the export policy to OSPF on Logical System LS3.

  5. If you are done configuring the device, commit the configuration.

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
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 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

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 null-route filtering of traffic. Null-route Filtering occurs when packets are dropped without notification.

Topology

Figure 3 shows the sample network.

Figure 3: OSPF with a Conditional Default Route to an ISPOSPF 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, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, copy and paste the commands into the CLI at the [edit] hierarchy level, and then enter commit from configuration mode.

Device LS1

Device LS2

Device LS3

Device ISP

Procedure

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:

  1. Configure the interfaces.

  2. Configure the autonomous system (AS) number.

  3. Configure the BGP session with the ISP device.

  4. Configure OSPF.

  5. Configure the routing policy.

  6. Configure the generated route.

  7. Apply the export policy to OSPF.

  8. If you are done configuring the device, commit the configuration.

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

Purpose

Make sure connectivity is established between Logical System LS3 and the ISP’s router.

Action
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
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
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 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 Device Using Logical Tunnel Interfaces on MX Series Routers and EX Series Switches. 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.

Topology

Figure 4 shows the sample network.

Figure 4: OSPF Import Policy on Logical SystemsOSPF Import Policy on Logical Systems

In this example, the logical systems operate as follows:

  1. 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.

  2. 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.

  3. 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, copy and paste the commands into the CLI at the [edit] hierarchy level, and then enter commit from configuration mode.

LS3

LS2

LS1

Procedure

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:

  1. Configure the interfaces.

  2. Enable OSPF on the interfaces.

  3. Configure the static route on Logical System LS3.

  4. On Logical System LS3, redistribute the static route into OSPF.

  5. On Logical System LS2, configure the OSPF import policy.

  6. If you are done configuring the device, commit the configuration.

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
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
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.