Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation
 

Related Documentation

 

Example: Redistributing Static Routes into OSPF

This example shows how to create a policy that redistributes static routes into OSPF.

Requirements

Before you begin:

Overview

In this example, you create a routing policy called exportstatic1 and a routing term called exportstatic1. The policy injects static routes into OSPF. This example includes the following settings:

  • policy-statement—Defines the routing policy. You specify the name of the policy and further define the elements of the policy. The policy name must be unique and can contain letters, numbers, and hyphens ( - ) and be up to 255 characters long.
  • term—Defines the match condition and applicable actions for the routing policy. The term name can contain letters, numbers, and hyphens ( - ) and be up to 255 characters long. You specify the name of the term and define the criteria that an incoming route must match by including the from statement and the action to take if the route matches the conditions by including the then statement. In this example you specify the static protocol match condition and the accept action.
  • export—Applies the export policy you created to be evaluated when routes are being exported from the routing table into OSPF.

Configuration

CLI Quick Configuration

To quickly create a policy that injects static routes into OSPF, copy the following commands and paste them into the CLI.

[edit]set policy-options policy-statement exportstatic1 term exportstatic1 from protocol staticset policy-options policy-statement exportstatic1 term exportstatic1 then acceptset protocols ospf export exportstatic1

Step-by-Step Procedure

The following example requires 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 inject static routes into OSPF:

  1. Create the routing policy.
    [edit]user@host# edit policy-options policy-statement exportstatic1
  2. Create the policy term.
    [edit policy-options policy-statement exportstatic1]user@host# set term exportstatic1
  3. Specify static as a match condition.
    [edit policy-options policy-statement exportstatic1 term exportstatic1]user@host# set from protocol static
  4. Specify that the route is to be accepted if the previous condition is matched.
    [edit policy-options policy-statement exportstatic1 term exportstatic1]user@host# set then accept
  5. Apply the routing policy to OSPF.

    Note: For OSPFv3, include the ospf3 statement at the [edit protocols] hierarchy level.

    [edit]user@host# set protocols ospf export exportstatic1
  6. If you are done configuring the device, commit the configuration.
    [edit]user@host# commit

Results

Confirm your configuration by entering the show policy-options and show protocols ospf commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.

user@host# show policy-optionspolicy-statement exportstatic1 {term exportstatic1 {from protocol static;then accept;}}
user@host# show protocols ospfexport exportstatic1;

To confirm your OSPFv3 configuration, enter the show policy-options and the show protocols ospf3 commands.

Verification

Confirm that the configuration is working properly.

Verifying That the Expected Static Routes Are Present

Purpose

Verify the effect of the export policy.

Action

From operational mode, enter the show route command.

Verifying That AS External LSAs Are Added to the Routing Table

Purpose

On the routing device where you configured the export policy, verify that the routing device originates an AS external LSA for the static routes that are added to the routing table.

Action

From operational mode, enter the show ospf database command for OSPFv2, and enter the show ospf3 database command for OSPFv3.

 

Related Documentation

 

Published: 2012-12-08

 

Related Documentation

 

Published: 2012-12-08