Supported Platforms
Related Documentation
- ACX, M, MX, T Series
- OSPF Routing Policy Overview
- ACX, J, M, MX, SRX, T Series
- Examples: Configuring Static Routes in the Junos OS Routing Protocols Configuration Guide
- M, PTX, T Series
- Configuring Match Conditions in Routing Policy Terms in the Routing Policy Configuration Guide
- Configuring Actions in Routing Policy Terms in the Routing Policy Configuration Guide
Example: Redistributing Static Routes into OSPF
This example shows how to create a policy that redistributes static routes into OSPF.
Requirements
Before you begin:
- Configure the device interfaces. See the Junos® OS Network Interfaces.
- Configure static routes. See Examples: Configuring Static Routes in the Junos OS Routing Protocols Configuration Guide.
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.
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:
- Create the routing policy.[edit]user@host# edit policy-options policy-statement exportstatic1
- Create the policy term. [edit policy-options policy-statement exportstatic1]user@host# set term exportstatic1
- Specify static as a match condition.[edit policy-options policy-statement exportstatic1 term exportstatic1]user@host# set from protocol static
- 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
- 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 - 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.
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
- Verifying That AS External LSAs Are Added to the Routing Table
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
- ACX, M, MX, T Series
- OSPF Routing Policy Overview
- ACX, J, M, MX, SRX, T Series
- Examples: Configuring Static Routes in the Junos OS Routing Protocols Configuration Guide
- M, PTX, T Series
- Configuring Match Conditions in Routing Policy Terms in the Routing Policy Configuration Guide
- Configuring Actions in Routing Policy Terms in the Routing Policy Configuration Guide
Published: 2012-12-08
Supported Platforms
Related Documentation
- ACX, M, MX, T Series
- OSPF Routing Policy Overview
- ACX, J, M, MX, SRX, T Series
- Examples: Configuring Static Routes in the Junos OS Routing Protocols Configuration Guide
- M, PTX, T Series
- Configuring Match Conditions in Routing Policy Terms in the Routing Policy Configuration Guide
- Configuring Actions in Routing Policy Terms in the Routing Policy Configuration Guide