Verifying and Monitoring OSPF Configuration
Verifying an OSPF Configuration
To verify an OSPF configuration, perform these tasks:
- Verifying OSPF-Enabled Interfaces
- Verifying OSPF Neighbors
- Verifying the Number of OSPF Routes
- Verifying Reachability of All Hosts in an OSPF Network
Verifying OSPF-Enabled Interfaces
Purpose
Verify that OSPF is running on a particular interface and that the interface is in the desired area.
Action
From the CLI, enter the show ospf interface command.
Sample Output
command-name
user@host> show ospf interface Intf State Area DR ID BDR ID Nbrs at-5/1/0.0 PtToPt 0.0.0.0 0.0.0.0 0.0.0.0 1 ge-2/3/0.0 DR 0.0.0.0 192.168.4.16 192.168.4.15 1 lo0.0 DR 0.0.0.0 192.168.4.16 0.0.0.0 0 so-0/0/0.0 Down 0.0.0.0 0.0.0.0 0.0.0.0 0 so-6/0/1.0 PtToPt 0.0.0.0 0.0.0.0 0.0.0.0 1 so-6/0/2.0 Down 0.0.0.0 0.0.0.0 0.0.0.0 0 so-6/0/3.0 PtToPt 0.0.0.0 0.0.0.0 0.0.0.0 1
Meaning
The output shows a list of the device interfaces that are configured for OSPF. Verify the following information:
Each interface on which OSPF is enabled is listed.
Under Area, each interface shows the area for which it was configured.
Under Intf and State, the device loopback (lo0.0) interface and LAN interface that are linked to the OSPF network's designated router (DR) are identified.
Under DR ID, the IP address of the OSPF network's designated router appears.
Under State, each interface shows a state of PtToPt to indicate a point-to-point connection. If the state is Waiting, check the output again after several seconds. A state of Down indicates a problem.
The designated router addresses always show a state of DR.
Verifying OSPF Neighbors
Purpose
OSPF neighbors are interfaces that have an immediate adjacency. On a point-to-point connection between the device and another router running OSPF, verify that each router has a single OSPF neighbor.
Action
From the CLI, enter the show ospf neighbor command.
Sample Output
command-name
user@host> show ospf neighbor Address Intf State ID Pri Dead 192.168.254.225 fxp3.0 2Way 10.250.240.32 128 36 192.168.254.230 fxp3.0 Full 10.250.240.8 128 38 192.168.254.229 fxp3.0 Full 10.250.240.35 128 33 10.1.1.129 fxp2.0 Full 10.250.240.12 128 37 10.1.1.131 fxp2.0 Full 10.250.240.11 128 38 10.1.2.1 fxp1.0 Full 10.250.240.9 128 32 10.1.2.81 fxp0.0 Full 10.250.240.10 128 33
Meaning
The output shows a list of the device's OSPF neighbors and their addresses, interfaces, states, router IDs, priorities, and number of seconds allowed for inactivity (“dead” time). Verify the following information:
Each interface that is immediately adjacent to the device is listed.
The device's own loopback address and the loopback addresses of any routers with which the device has an immediate adjacency are listed.
Under State, each neighbor shows a state of Full. Because full OSPF connectivity is established over a series of packet exchanges between clients, the OSPF link might take several seconds to establish. During that time, the state might be displayed as Attempt, Init, or 2way, depending on the stage of negotiation.
If, after 30 seconds, the state is not Full, the OSPF configuration between the neighbors is not functioning correctly.
Verifying the Number of OSPF Routes
Purpose
Verify that the OSPF routing table has entries for the following:
Each subnetwork reachable through an OSPF link
Each loopback address reachable on the network
For example, Figure 1 shows a sample network with an OSPF topology.
In this topology, OSPF is being run on all interfaces. Each segment in the network is identified by an address with a /24 prefix, with interfaces on either end of the segment being identified by unique IP addresses.
Action
From the CLI, enter the show ospf route command.
Sample Output
command-name
user@host> show ospf route Prefix Path Route NH Metric NextHop Nexthop Type Type Type Interface addr/label 10.10.10.1/24 Intra Network IP 1 ge-0/0/2.0 10.0.21.1 10.10.10.2/24 Intra Network IP 1 ge-0/0/2.0 10.0.21.1 10.10.10.4/24 Intra Network IP 1 ge-0/0/1.0 10.0.13.1 10.10.10.5/24 Intra Network IP 1 ge-0/0/2.0 10.0.21.1 10.10.10.6/24 Intra Network IP 1 ge-0/0/1.0 10.0.13.1 10.10.10.10/24 Intra Network IP 1 ge-0/0/2.0 10.0.21.1 10.10.10.11/24 Intra Network IP 1 ge-0/0/1.0 10.0.13.1 10.10.10.13/24 Intra Network IP 1 ge-0/0/1.0 10.10.10.16/24 Intra Network IP 1 ge-0/0/1.0 10.0.13.1 10.10.10.19/24 Intra Network IP 1 ge-0/0/1.0 10.0.13.1 10.10.10.20/24 Intra Network IP 1 ge-0/0/2.0 10.0.21.1 10.10.10.21/24 Intra Network IP 1 ge-0/0/2.0 192.168.5.1 Intra Router IP 1 ge-0/0/2.0 10.0.21.1 192.168.5.2 Intra Router IP 1 lo0 192.168.5.3 Intra Router IP 1 ge-0/0/1.0 10.0.13.1 192.168.5.4 Intra Router IP 1 ge-0/0/1.0 10.0.13.1 192.168.5.5 Intra Router IP 1 ge-0/0/1.0 10.0.13.1 192.168.5.6 Intra Router IP 1 ge-0/0/2.0 10.0.21.1 192.168.5.7 Intra Router IP 1 ge-0/0/2.0 10.0.21.1 192.168.5.8 Intra Router IP 1 ge-0/0/2.0 10.0.21.1 192.168.5.9 Intra Router IP 1 ge-0/0/1.0 10.0.13.1
Meaning
The output lists each route, sorted by IP address. Routes are shown with a route type of Network, and loopback addresses are shown with a route type of Router.
For the example shown in Figure 1, verify that the OSPF routing table has 21 entries, one for each network segment and one for each router's loopback address.
Verifying Reachability of All Hosts in an OSPF Network
Purpose
By using the traceroute tool on each loopback address in the network, verify that all hosts in the network are reachable from each device.
Action
For each device in the OSPF network:
In the J-Web interface, select Troubleshoot>Traceroute.
In the Host Name box, type the name of a host for which you want to verify reachability from the device.
Click Start. Output appears on a separate page.
Sample Output
command-name
1 172.17.40.254 (172.17.40.254) 0.362 ms 0.284 ms 0.251 ms 2 routera-fxp0.englab.mycompany.net (192.168.71.246) 0.251 ms 0.235 ms 0.200 ms
Meaning
Each numbered row in the output indicates a routing “hop” in the path to the host. The three-time increments indicate the round-trip time (RTT) between the device and the hop, for each traceroute packet. To ensure that the OSPF network is healthy, verify the following information:
The final hop in the list is the host you want to reach.
The number of expected hops to the host matches the number of hops in the traceroute output. The appearance of more hops than expected in the output indicates that a network segment is likely not reachable. In this case, verify the routes with the show ospf route command.
For information about show ospf route, see Verifying the Number of OSPF Routes
Tracing OSPF Protocol Traffic
Tracing operations record detailed messages about the operation of OSPF. You can trace OSPF protocol traffic to help debug OSPF protocol issues. When you trace OSPF protocol traffic, you specify the name of the file and the type of information you want to trace.
You can specify the following OSPF protocol-specific trace options:
database-description—All database description packets, which are used in synchronizing the OSPF topological database
error—OSPF error packets
event—OSPF state transitions
flooding—Link-state flooding packets
graceful-restart—Graceful-restart events
hello—Hello packets, which are used to establish neighbor adjacencies and to determine whether neighbors are reachable
ldp-synchronization—Synchronization events between OSPF and LDP
lsa-ack—Link-state acknowledgment packets, which are used in synchronizing the OSPF topological database
lsa-analysis—Link-state analysis. Specific to the Juniper Networks implementation of OSPF, Junos OS performs LSA analysis before running the shortest-path-first (SPF) algorithm. LSA analysis helps to speed the calculations performed by the SPF algorithm.
lsa-request—Link-state request packets, which are used in synchronizing the OSPF topological database
lsa-update—Link-state updates packets, which are used in synchronizing the OSPF topological database
nsr-synchronization—Nonstop routing synchronization events
on-demand—Trace demand circuit extensions
packet-dump—Dump the contents of selected packet types
packets—All OSPF packets
restart-signaling—(OSPFv2 only) Restart-signaling graceful restart events
spf—Shortest path first (SPF) calculations
You can optionally specify one or more of the following flag modifiers:
detail—Detailed trace information
receive—Packets being received
send—Packets being transmitted
Use the detail flag modifier with caution as it might cause the CPU to become very busy.
Global tracing options are inherited from the configuration set by the traceoptions statement at the [edit routing-options] hierarchy level. You can override the following global trace options for the OSPF protocol using the traceoptions flag statement included at the [edit protocols ospf] hierarchy level:
all—All tracing operations
general—All normal operations and routing table changes (a combination of the normal and route trace operations)
normal—Normal events
policy—Policy processing
route—Routing information
state—State transitions
task—Routing protocol task processing
timer—Routing protocol timer processing
Use the trace flag all with caution as it might cause the CPU to become very busy.
Example: Tracing OSPF Protocol Traffic
This example shows how to trace OSPF protocol traffic.
Requirements
This example assumes that OSPF is properly configured and running in your network, and you want to trace OSPF protocol traffic for debugging purposes.
Overview
You can trace OSPF protocol traffic to help debug OSPF protocol issues. When you trace OSPF protocol traffic, you specify the name of the file and the type of information you want to trace. All files are placed in a directory on the routing device’s hard disk. On M Series and T Series routers, trace files are stored in the /var/log directory.
This example shows a few configurations that might be useful when debugging OSPF protocol issues. The verification output displayed is specific to each configuration.
To keep track of your log files, create a meaningful and descriptive name so it is easy to remember the content of the trace file. We recommend that you place global routing protocol tracing output in the file routing-log, and OSPF tracing output in the file ospf-log.
In the first example, you globally enable tracing operations for all routing protocols that are actively running on your routing device to the file routing-log. With this configuration, you keep the default settings for the trace file size and the number of trace files. After enabling global tracing operations, you enable tracing operations to provide detailed information about OSPF packets, including link-state advertisements, requests, and updates, database description packets, and hello packets to the file ospf-log, and you configure the following options:
size—Specifies the maximum size of each trace file, in KB, MB, or GB. In this example, you configure 10 KB as the maximum size. When the file reaches its maximum size, it is renamed with a .0 extension. When the file again reaches its maximum size, it is renamed with a .1 extension, and the newly created file is renamed with a .0 extension. This renaming scheme continues until the maximum number of trace files is reached. Then, the oldest trace file is overwritten. If you specify a maximum file size, you must also specify a maximum number of trace files with the files option. You specify k for KB, m for MB, and g for GB. By default, the trace file size is 128 KB. The file size range is 10 KB through the maximum file size supported on your system.
files—Specifies the maximum number of trace files. In this example, you configure a maximum of 5 trace files. When a trace file reaches its maximum size, it is renamed with a .0 extension, then a .1 extension, and so on until the maximum number of trace files is reached. When the maximum number of files is reached, the oldest trace file is overwritten. If you specify a maximum number of files, you must also specify a maximum file size with the size option. By default, there are 10 files. The range is 2 through 1000 files.
In the second example, you trace all SPF calculations to the file ospf-log by including the spf flag. You keep the default settings for the trace file size and the number of trace files.
In the third example, you trace the creation, receipt, and retransmission of all LSAs to the file ospf-log by including the lsa-request, lsa-update, and lsa-ack flags. You keep the default settings for the trace file size and the number of trace files.
Configuration
- Configuring Global Tracing Operations and Tracing OSPF Packet Information
- Tracing SPF Calculations
- Tracing Link-State Advertisements
Configuring Global Tracing Operations and Tracing OSPF Packet Information
CLI Quick Configuration
To quickly enable global tracing operations for all routing protocols actively running on your routing device and to trace detailed information about OSPF packets, copy the following commands and paste them into the CLI.
[edit] set routing-options traceoptions file routing-log set protocols ospf traceoptions file ospf-log set protocols ospf traceoptions file files 5 size 10k set protocols ospf traceoptions flag lsa-ack set protocols ospf traceoptions flag database-description set protocols ospf traceoptions flag hello set protocols ospf traceoptions flag lsa-update set protocols ospf traceoptions flag lsa-request
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 the CLI User Guide.
To configure global routing tracing operations and tracing operations for OSPF packets:
Configure tracing at the routing options level to collect information about the active routing protocols on your routing device.
[edit] user@host# edit routing-options traceoptions
Configure the filename for the global trace file.
[edit routing-options traceoptions] user@host# set file routing-log
Configure the filename for the OSPF trace file.
Note:To specify OSPFv3, include the ospf3 statement at the [edit protocols] hierarchy level.
[edit] user@host# edit protocols ospf traceoptions user@host# set file ospf-log
Configure the maximum number of trace files.
[edit protocols ospf traceoptions] user@host# set file files 5
Configure the maximum size of each trace file.
[edit protocols ospf traceoptions] user@host# set file size 10k
Configure tracing flags.
[edit protocols ospf traceoptions] user@host# set flag lsa-ack user@host# set flag database-description user@host# set flag hello user@host# set flag lsa-update user@host# set flag lsa-request
If you are done configuring the device, commit the configuration.
[edit protocols ospf traceoptions] user@host# commit
Results
Confirm your configuration by entering the show routing-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 routing-options traceoptions { file routing-log; }
user@host# show protocols ospf traceoptions { file ospf-log size 10k files 5; flag lsa-ack; flag database-description; flag hello; flag lsa-update; flag lsa-request; }
To confirm your OSPFv3 configuration, enter the show routing-options and the show protocols ospf3 commands.
Tracing SPF Calculations
CLI Quick Configuration
To quickly trace SPF calculations, copy the following commands and paste them into the CLI.
[edit] set protocols ospf traceoptions file ospf-log set protocols ospf traceoptions flag spf
Step-by-Step Procedure
To configure SPF tracing operations for OSPF:
Configure the filename for the OSPF trace file.
Note:To specify OSPFv3, include the ospf3 statement at the [edit protocols] hierarchy level.
[edit] user@host# edit protocols ospf traceoptions user@host# set file ospf-log
Configure the SPF tracing flag.
[edit protocols ospf traceoptions] user@host# set flag spf
If you are done configuring the device, commit the configuration.
[edit protocols ospf traceoptions] 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.
user@host# show protocols ospf traceoptions { file ospf-log ; flag spf; }
To confirm your OSPFv3 configuration, enter the show protocols ospf3 command.
Tracing Link-State Advertisements
CLI Quick Configuration
To quickly trace the creation, receipt, and retransmission of all LSAs, copy the following commands and paste them into the CLI.
[edit] set protocols ospf traceoptions file ospf-log set protocols ospf traceoptions flag lsa-request set protocols ospf traceoptions flag lsa-update set protocols ospf traceoptions flag lsa-ack
Step-by-Step Procedure
To configure link-state advertisement tracing operations for OSPF:
Configure the filename for the OSPF trace file.
Note:To specify OSPFv3, include the ospf3 statement at the [edit protocols] hierarchy level.
[edit] user@host# edit protocols ospf traceoptions user@host# set file ospf-log
Configure the link-state advertisement tracing flags.
[edit protocols ospf traceoptions] user@host# set flag lsa-request user@host# set flag lsa-update user@host# set flag lsa-ack
If you are done configuring the device, commit the configuration.
[edit protocols ospf traceoptions] 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.
user@host# show protocols ospf traceoptions { file ospf-log; flag lsa-request; flag lsa-update; flag lsa-ack; }
To confirm your OSPFv3 configuration, enter the show protocols ospf3 command.
Verification
Confirm that the configuration is working properly.
Verifying Trace Operations
Purpose
Verify that the Trace options field displays the configured trace operations, and verify that the Trace file field displays the location on the routing device where the file is saved, the name of the file to receive the output of the tracing operation, and the size of the file.
Action
From operational mode, enter the show ospf overview extensive command for OSPFv2, and enter the show ospf3 overview extensive command for OSPFv3.