Supported Platforms
Related Documentation
- J, M, MX, SRX, T Series
- Understanding OSPF Traffic Control
- J, M, MX, PTX, QFX, SRX, T Series
- Example: Controlling the Cost of Individual OSPF Network Segments
- Example: Controlling OSPF Route Preferences
Example: Dynamically Adjusting OSPF Interface Metrics Based on Bandwidth
This example shows how to dynamically adjust OSPF interface metrics based on bandwidth.
Requirements
Before you begin:
- Configure the device interfaces. See the Junos OS Network Interfaces Configuration Guide.
- 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.
Overview
You can specify a set of bandwidth threshold values and associated metric values for an OSPF interface. When the bandwidth of an interface changes, the Junos OS automatically sets the interface metric to the value associated with the appropriate bandwidth threshold value. When you configure bandwidth-based metric values, you typically configure multiple bandwidth and metric values.
In this example, you configure OSPF interface ae0 for bandwidth-based metrics by including the bandwidth-based-metrics statement and the following settings:
- bandwidth—Specifies the bandwidth threshold in bits per second. The range is 9600 through 1,000,000,000,000,000.
- metric—Specifies the metric value to associate with a specific bandwidth value. The range is 1 through 65,535.
Configuration
CLI Quick Configuration
To quickly configure bandwidth threshold values and associated metric values for an OSPF interface, copy the following commands, remove any line breaks, and then paste the commands into the CLI.
Step-by-Step Procedure
To configure the metric for a specific OSPF interface:
- Create an OSPF area.
Note: To specify OSPFv3, include the ospf3 statement at the [edit protocols] hierarchy level.
[edit]user@host# edit protocols ospf area 0.0.0.0 - Configure the metric of the OSPF network segment.[edit protocols ospf area 0.0.0.0 ]user@host# set interface ae0 metric 5
- Configure the bandwidth threshold values and associated
metric values.[edit protocols ospf area 0.0.0.0 ]user@host# set interface ae0.0 bandwidth-based-metrics bandwidth 1g metric 60user@host# set interface ae0.0 bandwidth-based-metrics bandwidth 10g metric 50
- If you are done configuring the device, commit the configuration.[edit protocols ospf area 0.0.0.0 ]user@host# commit
Results
Confirm your configuration by entering the show protocols ospf command. 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 protocols ospf3 command.
Verification
Confirm that the configuration is working properly.
Verifying the Configured Metric
Purpose
Verify the metric setting on the interface. Confirm that the Cost field displays the interface’s configured metric (cost). When choosing paths to a destination, OSPF uses the path with the lowest cost.
Action
From operational mode, enter the show ospf interface detail command for OSPFv2, and enter the show ospf3 interface detail command for OSPFv3.
Related Documentation
- J, M, MX, SRX, T Series
- Understanding OSPF Traffic Control
- J, M, MX, PTX, QFX, SRX, T Series
- Example: Controlling the Cost of Individual OSPF Network Segments
- Example: Controlling OSPF Route Preferences
Published: 2012-06-13
Supported Platforms
Related Documentation
- J, M, MX, SRX, T Series
- Understanding OSPF Traffic Control
- J, M, MX, PTX, QFX, SRX, T Series
- Example: Controlling the Cost of Individual OSPF Network Segments
- Example: Controlling OSPF Route Preferences