The configuration and verification of OSPFv3 and multiarea OSPF in both OSPFv2 and OSPFv3 are not part of the blueprint for the new edition of the CCNA certification exam (200-301). Troubleshooting OSPF (v2 and v3) is part of the Implementing Cisco Enterprise Advanced Routing and Services exam (300-410), an optional concentration exam of the new CCNP Enterprise certification. Configuring multiarea OSPF is part of the Implementing Cisco Enterprise Network Core Technologies exam (300-401). Both of these CCNP exam topics will be in the new CCNP Portable Command Guide, to be released in early 2020.
This article provides information about the following topics:
OSPFv2 Versus OSPFv3
The current version of Open Shortest Path First (OSPF), OSPFv2, was developed back in the late 1980s, when some parts of OSPF were designed to compensate for the inefficiencies of routers at that time. Now that router technology has dramatically improved, and with the arrival of IPv6, rather than modify OSPFv2 for IPv6, it was decided to create a new version of OSPF (OSPFv3), not just for IPv6, but for other newer technologies, too.
In most Cisco documentation, if you see something refer to OSPF, it is assumed to be referring to OSPFv2, and working with the IPv4 protocol stack.
The earliest release of the OSPFv3 protocol worked with IPv6 exclusively; if you needed to run OSPF for both IPv4 and IPv6, you had to have OSPFv2 and OSPFv3 running concurrently. Newer updates to OSPFv3 are allowing for OSPFv3 to handle both IPv4 and IPv6 addressing. The combining of IPv4 and IPv6 into OSPFv3 is not part of the CCNA certification; it is part of the CCNP Enterprise certification and therefore out of scope for this guide. This guide works with the understanding that anything related to IPv4 will be using OSPFv2.
Configuring OSPF
Router(config)# router ospf 123 | Starts OSPF process 123. The process ID is any positive integer value between 1 and 65,535. The process ID is not related to the OSPF area. The process ID merely distinguishes one process from another within the device |
Router(config-router)# network 172.16.10.0 0.0.0.255 area 0 | OSPF advertises interfaces, not networks. It uses the wildcard mask to determine which interfaces to advertise. Read this line to say, “Any interface with an address of 172.16.10.x is to run OSPF and be put into area 0” The process ID number of one router does not have to match the process ID of any other router. Unlike Enhanced Interior Gateway Routing Protocol (EIGRP), matching this number across all routers does not ensure that network adjacencies will form |
Router(config-router)# log-adjacency-changes detail | Configures the router to send a syslog message when there is a change of state between OSPF neighbors Although the log-adjacency-changes command is on by default, only up/down events are reported unless you use the detail keyword |
Running two different OSPF processes does not create multiarea OSPF; it merely creates two separate instances of OSPF that do not communicate with each other. To create multiarea OSPF, you use two separate network statements and advertise two different links into different areas. Remember that multiarea OSPF is not part of the CCNA (200-301) vendor exam topics.
You can enable OSPF directly on an interface with the ip ospf process ID area area number command. Because this command is configured directly on the interface, it takes precedence over the network area command entered in router configuration mode.
Using Wildcard Masks with OSPF Areas
When compared to an IP address, a wildcard mask identifies what addresses are matched to run OSPF and to be placed into an area:
A 0 (zero) in a wildcard mask means to check the corresponding bit in the address for an exact match.
A 1 (one) in a wildcard mask means to ignore the corresponding bit in the address—can be either 1 or 0.
Example 1: 172.16.0.0 0.0.255.255
172.16.0.0 = 10101100.00010000.00000000.00000000
0.0.255.255 = 00000000.00000000.11111111.11111111
Result = 10101100.00010000.xxxxxxxx.xxxxxxxx
172.16.x.x (Anything between 172.16.0.0 and 172.16.255.255 matches the example statement)
An octet in the wildcard mask of all 0s means that the octet has to match the address exactly. An octet in the wildcard mask of all 1s means that the octet can be ignored.
Example 2: 172.16.8.0 0.0.7.255
172.16.8.0 = 10101100.00010000.00001000.00000000
0.0.0.7.255 = 00000000.007000000.00000111.11111111
Result = 10101100.00010000.00001xxx.xxxxxxxx
00001xxx = 00001000 to 00001111 = 8–15
xxxxxxxx = 00000000 to 11111111 = 0–255
Anything between 172.16.8.0 and 172.16.15.255 matches the example statement
Router(config-router)# network 172.16.10.1 0.0.0.0 area 0 | Read this line to say, “Any interface with an exact address of 172.16.10.1 is to run OSPF and be put into area 0” |
Router(config-router)# network 172.16.0.0 0.0.255.255 area 0 | Read this line to say, “Any interface with an address of 172.16.x.x is to run OSPF and be put into area 0” |
Router(config-router)# network 0.0.0.0 255.255.255.255 area 0 | Read this line to say, “Any interface with any address is to run OSPF and be put into area 0” |
If you have problems determining which wildcard mask to use to place your interfaces into an OSPF area, use the ip ospf process ID area area number command directly on the interface.
Router(config)# interface fastethernet 0/0 | Moves to interface configuration mode |
Router(config-if)# ip ospf 1 area 51 | Places this interface into area 51 of OSPF process 1 |
Router(config-if)# interface gigabitethernet 0/0 | Moves to interface configuration mode |
Router(config-if)# ip ospf 1 area 0 | Places this interface into area 0 of OSPF process 1 |
If you assign interfaces to OSPF areas without first using the router ospf x command, the router creates the router process for you, and it shows up in a show running-config output.
Loopback Interfaces
Loopback interfaces are always “up and up” and do not go down unless manually shut down. This makes loopback interfaces great for use as an OSPF router ID.
Router(config)# interface loopback0 | Creates a virtual interface named Loopback 0 and then moves the router to interface configuration mode |
Router(config-if)# ip address 192.168.100.1 255.255.255.255 | Assigns the IP address to the interface |
Router ID
Router(config)# router ospf 1 | Starts OSPF process 1 |
Router(config-router)# router-id 10.1.1.1 | Sets the router ID to 10.1.1.1. If this command is used on an OSPF router process that is already active (has neighbors), the new router ID is used at the next reload or at a manual OSPF process restart |
Router(config-router)# no router-id 10.1.1.1 | Removes the static router ID from the configuration. If this command is used on an OSPF router process that is already active (has neighbors), the old router ID behavior is used at the next reload or at a manual OSPF process restart |
To choose the router ID at the time of OSPF process initialization, the router uses the following criteria in this specific order:
Use the router ID specified in the router-id w.x.y.z command.
Use the highest IP address of all active loopback interfaces on the router.
Use the highest IP address among all active nonloopback interfaces.
To have the manually configured router ID take effect, you must clear the OSPF routing process with the clear ip ospf process command.
There is no IPv6 form of router ID. All router IDs are 32-bit numbers in the form of an IPv4 address. Even if a router is running IPv6 exclusively, the router ID is still in the form of an IPv4 address.
DR/BDR Elections
Router(config)# interface fastethernet0/0 | Enters interface configuration mode |
Router(config-if)# ip ospf priority 50 | Changes the OSPF interface priority to 50 The assigned priority can be between 0 and 255. A priority of 0 makes the router ineligible to become a designated router (DR) or backup designated router (BDR). The highest priority wins the election and becomes the DR; the second highest priority becomes the BDR. A priority of 255 guarantees at least a tie in the election—assuming another router is also set to 255. If all routers have the same priority, regardless of the priority number, they tie. Ties are broken by the highest router ID. The default priority setting is 1 Do not assign the same priority value to more than one router |
Timers
Router(config-if)# ip ospf hello-interval 20 | Changes the hello interval timer to 20 seconds |
Router(config-if)# ip ospf dead-interval 80 | Changes the dead interval timer to 80 seconds |
Hello and dead interval timers must match between two routers for those routers to become neighbors.
The default hello timer is 10 seconds on multiaccess and point-to-point segments. The default hello timer is 30 seconds on nonbroadcast multiaccess (NBMA) segments such as Frame Relay, X.25, and ATM.
The default dead interval timer is 40 seconds on multiaccess and point-to-point segments. The default dead timer is 120 seconds on NBMA segments such as Frame Relay, X.25, and ATM.
If you change the hello interval timer, the dead interval timer is automatically adjusted to four times the new hello interval timer.
Verifying OSPFv2 Configurations
Router# show ip protocol | Displays parameters for all routing protocols running on the router |
Router# show ip route | Displays a complete IP routing table |
Router# show ip route ospf | Displays the OSPF routes in the routing table |
Router# show ip ospf | Displays basic information about OSPF routing processes |
Router# show ip ospf border-routers | Displays border and boundary router information |
Router# show ip ospf database | Displays the contents of the OSPF database |
Router# show ip ospf database summary | Displays a summary of the OSPF database |
Router# show ip ospf interface | Displays OSPF info as it relates to all interfaces |
Router# show ip ospf interface fastethernet0/0 | Displays OSPF information for interface fastethernet 0/0 |
Router# show ip ospf neighbor | Lists all OSPF neighbors and their states |
Router# show ip ospf neighbor detail | Displays a detailed list of neighbors |
Troubleshooting OSPFv2
Router# clear ip route * | Clears the entire routing table, forcing it to rebuild |
Router# clear ip route a.b.c.d | Clears a specific route to network a.b.c.d |
Router# clear ip ospf counters | Resets OSPF counters |
Router# clear ip ospf process | Resets the entire OSPF process, forcing OSPF to re-create neighbors, the database, and the routing table |
Router# clear ip ospf 3 process | Resets OSPF process 3, forcing OSPF to re-create neighbors, the database, and the routing table |
Router# debug ip ospf events | Displays all OSPF events |
Router# debug ip ospf adj | Displays various OSPF states and DR/BDR election between adjacent routers |
Router# debug ip ospf packets | Displays OSPF packets |
Router# undebug all | Turns off all debug commands |
Configuration Example: Single-Area OSPF
Figure 16-1 shows the network topology for the configuration that follows, which demonstrates how to configure single-area OSPF using the commands covered in this post.
Austin Router
Router> enable | Moves to privileged EXEC mode |
Router# configure terminal | Moves to global configuration mode |
Router(config)# hostname Austin | Sets the host name |
Austin(config)# interface fastethernet 0/0 | Moves to interface configuration mode |
Austin(config-if)# ip address 172.16.10.1 255.255.255.0 | Assigns an IP address and a netmask |
Austin(config-if)# no shutdown | Enables the interface |
Austin(config-if)# interface serial 0/0/0 | Moves to interface configuration mode |
Austin(config-if)# ip address 172.16.20.1 255.255.255.0 | Assigns an IP address and netmask |
Austin(config-if)# clock rate 2000000 | DCE cable plugged in this side |
Austin(config-if)# no shutdown | Enables the interface |
Austin(config-if)# exit | Returns to global configuration mode |
Austin(config)# router ospf 1 | Starts OSPF process 1 |
Austin(config-router)# network 172.16.10.0 0.0.0.255 area 0 | Read this line to say, “Any interface with an address of 172.16.10.x is to run OSPF and be put into area 0” |
Austin(config-router)# network 172.16.20.0 0.0.0.255 area 0 | Read this line to say, “Any interface with an address of 172.16.20.x is to run OSPF and be put into area 0” |
Austin(config-router)# | Returns to privileged EXEC mode |
Austin# copy running-config startup-config | Saves the configuration to NVRAM |
Houston Router
Router> enable | Moves to privileged EXEC mode |
Router# configure terminal | Moves to global configuration mode |
Router(config)# hostname Houston | Sets the host name |
Houston(config)# interface fastethernet 0/0 | Moves to interface configuration mode |
Houston(config-if)# ip address 172.16.30.1 255.255.255.0 | Assigns an IP address and netmask |
Houston(config-if)# no shutdown | Enables the interface |
Houston(config-if)# interface serial0/0/0 | Moves to interface configuration mode |
Houston(config-if)# ip address 172.16.40.1 255.255.255.0 | Assigns an IP address and netmask |
Houston(config-if)# clock rate 2000000 | DCE cable plugged in this side |
Houston(config-if)# no shutdown | Enables the interface |
Houston(config)# interface serial 0/0/1 | Moves to interface configuration mode |
Houston(config-if)# ip address 172.16.20.2 255.255.255.0 | Assigns an IP address and netmask |
Houston(config-if)# no shutdown | Enables the interface |
Houston(config-if)# exit | Returns to global configuration mode |
Houston(config)# router ospf 1 | Starts OSPF process 1 |
Houston(config-router)# network 172.16.0.0 0.0.255.255 area 0 | Read this line to say, “Any interface with an address of 172.16.x.x is to run OSPF and be put into area 0” One statement now enables OSPF on all three interfaces |
Houston(config-router)# | Returns to privileged EXEC mode |
Houston# copy running-config startup-config | Saves the configuration to NVRAM |
Galveston Router
Router> enable | Moves to privileged EXEC mode |
Router# configure terminal | Moves to global configuration mode |
Router(config)# hostname Galveston | Sets the host name |
Galveston(config)# interface fastethernet 0/0 | Moves to interface configuration mode |
Galveston(config-if)# ip address 172.16.50.1 255.255.255.0 | Assigns an IP address and netmask |
Galveston(config-if)# no shutdown | Enables the interface |
Galveston(config-if)# interface serial 0/0/1 | Moves to interface configuration mode |
Galveston(config-if)# ip address 172.16.40.2 255.255.255.0 | Assigns an IP address and netmask |
Galveston(config-if)# no shutdown | Enables the interface |
Galveston(config-if)# exit | Returns to global configuration mode |
Galveston(config)# router ospf 1 | Starts OSPF process 1 |
Galveston(config-router)# network 172.16.40.2 0.0.0.0 area 0 | Any interface with an exact address of 172.16.40.2 is to run OSPF and be put into area 0. This is the most precise way to place an exact address into the OSPF routing process |
Galveston(config-router)# network 172.16.50.1 0.0.0.0 area 0 | Read this line to say, “Any interface with an exact address of 172.16.50.1 is to be put into area 0” |
Galveston(config-router)# | Returns to privileged EXEC mode |
Galveston# copy running-config startup-config | Saves the configuration to NVRAM |