Implementing OSPF
Enabling basic OSPF functionality on a Cisco router is a simple process requiring just a few commands. However, more advanced commands must be applied once the basic setup is done and additional optimization and tuning settings are required.
Exam Note: Although OSPF supports very advanced features and tuning capabilities, for the CCNA exam, it is only necessary to go through a basic configuration to establish an OSPF neighbor adjacency between routers in a single-area OSPF, verify the configuration, and confirm the learning of networks through the routing protocol.
Basic OSPF configuration consists of a few commands such as enabling an OSPF process, manually defining the router ID (this is optional, but recommended), and starting OSPF on the desired interfaces:
- Router ospf [process-id]: Enables OSPF routing on the router and enters router configuration mode.
- Router-id [router-id]: Defines the router ID that uniquely identifies the router within the OSPF domain.
- Network [ip-address] [wildcard-mask] area [area-id]: Defines the interface on which OSPF runs (using the specified network) and defines the area ID to which the interface will belong.
Configuring Single-area OSPF
The image below shows the topology used in this example for configuring OSPF between routers R1 and R2 participating in Area 0.
Assuming that interfaces on both routers are already configured with IP addresses and are enabled, all that needs to be done is to enable the OSPF process, set the desired router ID (optionally), and then start OSPF on the desired interfaces.
As shown in the image above, the OSPF process ID 1 is used on both routers.
Note: Keep in mind that the router ID has local importance, so any number can be used on different routers to enable the OSPF processes.
Next, unique router IDs are defined on the routers, and finally, the OSPF protocol is started for the desired networks that put both routers in area 0.
Verifying OSPF
After configuring basic single-area OSPF, it is extremely important to verify that the configuration is correct and that OSPF is functioning properly between routers. Although there are plenty of “show” commands, the following are the most commonly used to verify that OSPF is enabled on the correct interfaces, to ensure the neighbor adjacency has been established between the routers, as well as networks are learned from OSPF:
- Show ip ospf interface brief: Provides miscellaneous information about the OSPF-enabled interfaces.
- Show ip ospf neighbor: Provides information about the router's OSPF neighbors.
- Show ip protocols: Provides detailed information about the protocols running on the router.
- Show ip route: Shows the routing table's content, including networks learned from OSPF.
Finally, to verify that the routers are learning networks through OSPF, the “show ip route” command can be used to check if there are any OSPF routes included in the routing table.