Description

This article describes how to create a routing policy to export all local static and direct routes for OSPF. For information about configuring OSPF, see KB16570 [juniper.net] .

For other topics, go to the SRX Getting Started main page.

Symptoms

By default, OSPF imports all learned routes into the routing table and exports routes only from interfaces that are members of the OSPF area. To export all other routes or filter inbound routes, you must use routing policies.

Solution

This section contains the following:

 

J-Web Configuration

Note: This example does not use every option available for routing policy configuration. For information about additional routing policy configuration options, see Technical Documentation for links to Junos documentation.

To create a routing policy that exports all local static and direct routes:
  1. Select Configure>Routing>Policies . The Policy Configuration page appears.
  2. Click Add . The Add Policy dialog box appears.
  3. In the Policy Name box, type the name of the routing policy (for example, all-local).
  4. In the Terms area, click Add . The Add Term dialog box appears.
  5. In the Term Name box, type the name of the term (for example, 1).
  6. In the Protocol area of the Source tab, click Add . The Available Protocols dialog box appears.
  7. Select the protocol (in this example, direct), and click OK .
  8. Click the Action tab.
  9. In the Action list, select the action to be taken (in this example, accept).
  10. Click OK .
To add more terms, repeat steps 4 through 10. For this example, use the following values when repeating these steps:
  • Term name: 2
  • Protocol: static
  • Action: accept
Next, you must apply the routing policy.

To apply the routing policy:
  1. Select Configure>Routing>OSPF . The OSPF configuration page appears.
  2. In the OSPF Global Settings area (lower half of the page), click Edit .
  3. In the Edit Global Settings dialog box, click the Policies tab.
  4. In the Export Policy area, click Add . The Add dialog box appears.
  5. Select the policy that you previously created (in this example, all-local), and click OK .
  6. In the Edit Global Settings dialog box, click OK .
If you are finished configuring the device, click Commit to commit the configuration.

 

CLI Configuration

1. Create a routing policy that defines matching criteria and the action to be taken for traffic that matches the criteria. In this example, a policy named  all-local  is created with matching criteria of traffic from direct routes, static routes and local routes and action as  accept  for matching traffic.

user@host# set policy-options policy-statement all-local term 1 from protocol direct
user@host# set policy-options policy-statement all-local term 1 then accept

user@host# set policy-options policy-statement all-local term 2 from protocol static
user@host# set policy-options policy-statement all-local term 2 then accept

user@host# set policy-options policy-statement all-local term 2 from protocol local
user@host# set policy-options policy-statement all-local term 2 then accept

2. Apply the policy as below:

user@host# set protocols ospf export all-local   


 

Technical Documentation

Policy Framework Overview

 

Verification

For information about verifying OSPF, see Verifying and Monitoring OSPF Configuration .

 

Troubleshooting

To troubleshoot OSPF issues, use the following traceoptions commands. For information about configuring traceoptions, see KB16108 - SRX Getting Started -- Configuring Traceoptions for Debugging and Trimming Output [juniper.net] .

user@host# set protocols ospf traceoptions file ospf.debug size 5m files 5
user@host#
set protocols ospf traceoptions flag all

This file collected via traceoptions is saved in /var/log and can be viewed as:

- file list detail /var/log | match ospf.debug
- show log ospf.debug

Use the traceroute tool on each loopback address in the network to verify that all hosts in the network are reachable from device. For more information, see Verifying and Monitoring OSPF Configuration.

Modification History

2020-06-29:  Article reviewed for accuracy; troubleshooting commands added.