ON THIS PAGE
Example: Configuring a Route Filter Policy to Specify Priority for Prefixes Learned Through OSPF
This example shows how to create an OSPF import policy that prioritizes specific prefixes learned through OSPF.
Requirements
Before you begin:
Configure the device interfaces. See the Interfaces User Guide for Security Devices.
Configure the router identifiers for the devices in your OSPF network. See Example: Configuring an OSPF Router Identifier.
Control OSPF designated router election See Example: Controlling OSPF Designated Router Election
Configure a single-area OSPF network. See Example: Configuring a Single-Area OSPF Network .
Configure a multiarea OSPF network. See Example: Configuring a Multiarea OSPF Network.
Overview
In a network with a large number of OSPF routes, it can be useful to control the order in which routes are updated in response to a network topology change. In Junos OS Release 9.3 and later, you can specify a priority of high, medium, or low for prefixes included in an OSPF import policy. In the event of an OSPF topology change, high priority prefixes are updated in the routing table first, followed by medium and then low priority prefixes.
OSPF import policy can only be used to set priority or to filter
OSPF external routes. If an OSPF import policy is applied that results
in a reject
terminating action for a nonexternal route,
then the reject
action is ignored and the route is accepted
anyway. By default, such a route is now installed in the routing table
with a priority of low. This behavior prevents traffic black holes,
that is, silently discarded traffic, by ensuring consistent routing
within the OSPF domain.
In general, OSPF routes that are not explicitly assigned a priority are treated as priority medium, except for the following:
Summary discard routes have a default priority of low.
Local routes that are not added to the routing table are assigned a priority of low.
External routes that are rejected by import policy and thus not added to the routing table are assigned a priority of low.
Any available match criteria applicable to OSPF routes can be
used to determine the priority. Two of the most commonly used match
criteria for OSPF are the route-filter
and tag
statements.
In this example, the routing device is in area 0.0.0.0, with
interfaces fe-0/1/0
and fe-1/1/0
connecting
to neighboring devices. You configure an import routing policy named
ospf-import to specify a priority for prefixes learned through OSPF.
Routes associated with these prefixes are installed in the routing
table in the order of the prefixes’ specified priority. Routes
matching 192.0.2.0/24 orlonger
are installed first because
they have a priority of high
. Routes matching 198.51.100.0/24
orlonger
are installed next because they have a priority of medium
. Routes matching 203.0.113.0/24 orlonger
are
installed last because they have a priority of low
. You
then apply the import policy to OSPF.
The priority value takes effect when a new route is installed, or when there is a change to an existing route.
Topology
Configuration
CLI Quick Configuration
To quickly configure an OSPF import policy
that prioritizes specific prefixes learned through OSPF, 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.
[edit] set interfaces fe-0/1/0 unit 0 family inet address 192.168.8.4/30 set interfaces fe-0/1/0 unit 0 family inet address 192.168.8.5/30 set policy-options policy-statement ospf-import term t1 from route-filter 203.0.113.0/24 orlonger set policy-options policy-statement ospf-import term t1 then priority low set policy-options policy-statement ospf-import term t1 then accept set policy-options policy-statement ospf-import term t2 from route-filter 198.51.100.0/24 orlonger set policy-options policy-statement ospf-import term t2 then priority medium set policy-options policy-statement ospf-import term t2 then accept set policy-options policy-statement ospf-import term t3 from route-filter 192.0.2.0/24 orlonger set policy-options policy-statement ospf-import term t3 then priority high set policy-options policy-statement ospf-import term t3 then accept set protocols ospf import ospf-import set protocols ospf area 0.0.0.0 interface fe-0/1/0 set protocols ospf area 0.0.0.0 interface fe-1/1/0
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 Modifying the Junos OS Configuration in theCLI User Guide.
To configure an OSPF import policy that prioritizes specific prefixes:
Configure the interfaces.
[edit] user@host# set interfaces fe-0/1/0 unit 0 family inet address 192.168.8.4/30 user@host# set interfaces fe-0/2/0 unit 0 family inet address 192.168.8.5/30
Enable OSPF on the interfaces.
Note:For OSPFv3, include the
ospf3
statement at the[edit protocols]
hierarchy level.[edit] user@host# set protocols ospf area 0.0.0.0 interface fe-0/1/0 user@host# set protocols ospf area 0.0.0.0 interface fe-0/2/0
Configure the policy to specify the priority for prefixes learned through OSPF.
[edit ] user@host# set policy-options policy-statement ospf-import term t1 from route-filter 203.0.113.0/24 orlonger user@host# set policy-options policy-statement ospf-import term t1 then priority low user@host# set policy-options policy-statement ospf-import term t1 then accept user@host# set policy-options policy-statement ospf-import term t2 from route-filter 198.51.100.0/24 orlonger user@host# set policy-options policy-statement ospf-import term t2 then priority medium user@host# set policy-options policy-statement ospf-import term t2 then accept user@host# set policy-options policy-statement ospf-import term t3 from route-filter 192.0.2.0/24 orlonger user@host# set policy-options policy-statement ospf-import term t3 then priority high user@host# set policy-options policy-statement ospf-import term t3 then accept
Apply the policy to OSPF.
[edit] user@host# set protocols ospf import ospf-import
If you are done configuring the device, commit the configuration.
[edit] user@host# commit
Results
Confirm your configuration by entering the show
interfaces
, show policy-options
, and the 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 interfaces fe-0/1/0 { unit 0 { family inet { address 192.168.8.4/30; } } } fe-0/2/0 { unit 0 { family inet { address 192.168.8.5/30; } } }
user@host# show protocols ospf import ospf-import; area 0.0.0.0 { interface fe-0/1/0.0; interface fe-0/2/0.0; }
user@host# show policy-options policy-statement ospf-import { term t1 { from { route-filter 203.0.113.0/24 orlonger; } then { priority low; accept; } } term t2 { from { route-filter 198.51.100.0/24 orlonger; } then { priority medium; accept; } } term t3 { from { route-filter 192.0.2.0/24 orlonger; } then { priority high; accept; } } }
user@host# show protocols ospf import ospf-import; area 0.0.0.0 { interface fe-0/1/0.0; interface fe-0/2/0.0; }
To confirm your OSPFv3 configuration, enter the show interfaces
, show policy-options
, and show protocols ospf3
commands.
Verification
Confirm that the configuration is working properly.