Configuring basic OSPF isn’t as simple as RIP, IGRP and EIGRP, and it can get can really complex once the many options that are available within OSPF are factored in.
Two basic elements of OSPF configuration are:
-Enabling OSPF
This is accomplished with the “router ospf process-id” command.
-Configuring OSPF areas
This is accomplished with the “network address wildcard-mask area area-id” command.
The easiest, and also least scalable way to configure OSPF is to just use a single area. Doing this requires a minimum of two commands.
router ospf
A value in the range 0 – 65535 identifies the OSPF Process ID.
network address mask area area-id
The area-id should be 0 if only a single area is configured.
After identifying the OSPF process, you need to identify the interfaces that you want to activate OSPF communications on, as well as the area in which each resides.
This will also configure the networks you’re going to advertise to others. OSPF uses wildcards in the configuration. In the example the wildcard mask utilized on both network statements was 0.0.0.0 which means match exactly as a 0 in the bit position means match exactly while a 1 in the bit position means match anything. For example a wildcard mask of 0.0.0.255 means match the first three octets exactly and the fourth octet can be any value.
There are various ways to configure OSPF.
The configuration of R3 shows how the 0.0.0.0 wildcard is used to place each interface individually into area 0
R2 show how two interface can be configured into area 0 with one wildcard network statement of 0.255.255.255
R1 shows the wildcards of 0.0.255.255 and 0.0.0.0
It doesn’t matter how you configure the network statements, the results are the same.
Remember, the process ID is irrelevant and can be the same on each router, or different on each router, as they are in this example.
There are several ways to verify proper OSPF configuration and operation. Some of the commands are as follows:
show ip protocols: This command is useful in debugging routing operations. Information in the Routing Information Sources field of the show ip protocols output can help you identify a router suspected of delivering bad routing information.
show ip route or show ip route ospf: Displays the current state of the routing table
show ip ospf interface: Displays general information about Open Shortest Path First (OSPF) routing processes.
show ip ospf neighbor: Displays OSPF-neighbor information on a per-interface basis.
OSPF is great if you configure it properly. Now let’s look at other ways to do that.
Notice from the output of the “show ip route” command, the default administrative distance (AD) of OSPF is 110. The AD for an external (E2) OSPF route is 170 as shown in the output of the show ip route command.
The show ip ospf command is great for troubleshooting OSPF as it has a significant amount of valuable information in the output. Things such as timer settings, Link State Advertisement (LSA) information, area information, etc.
Another good command for troubleshooting OSPF is the show ip ospf neighbor command. As you can see from the output on the slide, fields that are displayed are as follows:
ID – Router ID of the OSPF neighbor
Priority – OSPF priority of the OSPF neighbor
State – Displays the state of the OSPF router. Is it a DR, BDR, etc.
Dead Time – Expected time before Cisco IOS software will declare the neighbor dead.
Address – Actual address of the interface the OSPF router is assigned.
Interface – Interface the neighbor is learned on.
To control the maximum number of parallel routes an IP routing protocol can support, use the maximum-paths command in router configuration mode. To restore the default value, use the no form of this command.
maximum-paths number-paths
no maximum-paths
By default OSPF places up to four equal-cost routes in the routing table.
Example:
maximum-paths 6
The ip ospf cost
Answer:
Any packet destined for a network that is not in the routing table for R2 will be directed to R1. R1 will then send that packet back to R2 and a routing loop will occur.
To display information on Open Shortest Path First (OSPF)-related events, such as adjacencies, flooding information, designated router selection, and shortest path first (SPF) calculation, use the debug ip ospf events command in privileged EXEC mode.
To display general IP debugging information and IP security option (IPSO) security transactions, use the debug ip packet command in privileged EXEC mode.
By issuing the debug ip ospf adj command, you can capture the authentication process and DR/BDR entries.