Implementing OSPFv2 Using Interface Subcommands
From the earliest days of OSPFv2 support in Cisco routers, the configuration used the OSPF network command as discussed in this chapter. However, that configuration style can be confusing, and it does require some interpretation. As a result, Cisco added another option for OSPFv2 configuration called OSPF interface configuration.
The newer interface-style OSPF configuration still enables OSPF on interfaces, but it does so directly with the ip ospf interface subcommand. Instead of matching interfaces with indirect logic using network commands, you directly enable OSPFv2 on interfaces by configuring an interface subcommand on each interface.
OSPF Interface Configuration Example
To show how OSPF interface configuration works, this example basically repeats the example shown earlier in the chapter using the traditional OSPFv2 configuration with network commands. So, before looking at the OSPFv2 interface configuration, take a moment to look back to review traditional OSPFv2 configuration with Figure 22-2 and Examples 22-2 and 22-3.
After reviewing the traditional configuration, consider this checklist, which details how to convert from the old-style configuration in Example 22-2 and Example 22-3 to use interface configuration:
Step 1. Use the no network network-id area area-id subcommands in OSPF configuration mode to remove the network commands.
Step 2. Add one ip ospf process-id area area-id command in interface configuration mode under each interface on which OSPF should operate, with the correct OSPF process (process-id) and the correct OSPF area number.
Figure 22-5 repeats the design for both the original examples in this chapter and for this upcoming interface configuration example.
Figure 22.5 Area Design Used in the Upcoming OSPF Interface Config Example
Example 22-2 shows a single network command: network 10.0.0.0 0.255.255.255 area 0. Example 22-12 follows the steps in the migration checklist, beginning with the removal of the previous configuration using the no network 10.0.0.0 0.255.255.255 area 0 command. The example then shows the addition of the ip ospf 1 area 0 command on each of the interfaces on Router R1, enabling OSPF process 1 on the interface and placing each interface into area 0.
Example 22-12 Migrating to Use OSPF Interface Subcommand Configuration
R1# configure terminal Enter configuration commands, one per line. End with CNTL/Z. R1(config)# router ospf 1 R1(config-router)# no network 10.0.0.0 0.255.255.255 area 0 R1(config-router)# *Apr 8 19:35:24.994: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet0/0/1 from FULL to DOWN, Neighbor Down: Interface down or detached *Apr 8 19:35:24.994: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on GigabitEthernet0/0/2 from FULL to DOWN, Neighbor Down: Interface down or detached *Apr 8 19:35:24.994: %OSPF-5-ADJCHG: Process 1, Nbr 4.4.4.4 on GigabitEthernet0/0/3 from FULL to DOWN, Neighbor Down: Interface down or detached R1(config-router)# interface g0/0/0 R1(config-if)# ip ospf 1 area 0 R1(config-if)# interface g0/0/1 R1(config-if)# ip ospf 1 area 0 R1(config-if)# *Apr 8 19:35:52.970: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet0/0/1 from LOADING to FULL, Loading Done R1(config-if)# interface g0/0/2 R1(config-if)# ip ospf 1 area 0 R1(config-if)# *Apr 8 19:36:13.362: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on GigabitEthernet0/0/2 from LOADING to FULL, Loading Done R1(config-if)# interface g0/0/3 R1(config-if)# ip ospf 1 area 0 R1(config-if)# *Apr 8 19:37:05.398: %OSPF-5-ADJCHG: Process 1, Nbr 4.4.4.4 on GigabitEthernet0/0/3 from LOADING to FULL, Loading Done R1(config-if)#
When reading the example, read from top to bottom, and also consider the details about the failed and recovered neighbor relationships shown in the log messages. Removing the network command disabled OSPF on all interfaces on Router R1, causing all three neighbor relationships to fail. The example then shows the addition of the ip ospf 1 area 0 command on the LAN interface, which enables OSPF but does not cause a neighbor relationship to form, because no other OSPF routers exist in that subnet. Then the example shows the same command added to each of the WAN links in succession, and in each case, the OSPF neighbor available over that WAN link comes up (as noted in the log messages).
Verifying OSPF Interface Configuration
OSPF operates the same way whether you use the new style or old style of configuration. The OSPF area design works the same, neighbor relationships form the same way, routers negotiate to become the DR and BDR the same way, and so on. However, you can see a few small differences in show command output when using the newer OSPFv2 configuration if you look closely.
The show ip protocols command relists most of the routing protocol configuration, so it does list some different details if you use interface configuration versus the network command. With the ip ospf interface subcommands, the output lists the phrase “Interfaces Configured Explicitly,” as highlighted in Example 22-13. The example first shows the relevant parts of the show ip protocols command when using interface configuration on Router R1, and then lists the same portions of the command from when R1 used network commands.
Example 22-13 Differences in show ip protocols Output: Old- and New-Style OSPFv2 Configuration
! First, with the new interface configuration R1# show ip protocols ! … beginning lines omitted for brevity Routing for Networks: Routing on Interfaces Configured Explicitly (Area 0): GigabitEthernet0/0/0 GigabitEthernet0/0/1 GigabitEthernet0/0/2 GigabitEthernet0/0/3 Routing Information Sources: Gateway Distance Last Update 4.4.4.4 110 00:09:30 2.2.2.2 110 00:10:49 3.3.3.3 110 05:20:07 Distance: (default is 110)
! For comparison, the old results with the use of the OSPF network command R1# show ip protocols ! … beginning lines omitted for brevity Routing for Networks: 10.1.0.0 0.0.255.255 area 0 ! … ending line omitted for brevity
Another small piece of different output exists in the show ip ospf interface [interface] command. The command lists details about OSPF settings for the interface(s) on which OSPF is enabled. The output also makes a subtle reference to whether that interface was enabled for OSPF with the old or new configuration style. Example 22-14 also begins with output based on interface configuration on Router R1, followed by the output that would exist if R1 still used the old-style network command.
Example 22-14 Differences in show ip ospf interface Output with OSPFv2 Interface Configuration
! First, with the new interface configuration R1# show ip ospf interface g0/0/1 GigabitEthernet0/0/0 is up, line protocol is up Internet Address 10.1.12.1/24, Area 0, Attached via Interface Enable ! Lines omitted for brevity
! For comparison, the old results with the use of the OSPF network command R1# show ip ospf interface g0/0/1 GigabitEthernet0/0/0 is up, line protocol is up Internet Address 10.1.12.1/24, Area 0, Attached via Network Statement ! … ending line omitted for brevity
Other than these small differences in a few show commands, the rest of the commands show nothing different depending on the style of configuration. For instance, the show ip ospf interface brief command does not change depending on the configuration style, nor do the show ip ospf database, show ip ospf neighbor, or show ip route commands.