Scenarios
The following scenarios are designed to draw together and further explore the content described earlier in this chapter and some of the content you have seen in your own networks or practice labs. There is not always one right way to accomplish the tasks presented, and using good practice and defining your end goal are important in any real-life design or solution.
Scenario 3-1: Configuring OSPF in a Single Area
In this scenario, you configure two Cisco routers for OSPF routing using a Class B (/16) network (131.108.0.0) with a Class C subnet mask (255.255.255.0, or /24 mask). You build a small network and an OSPF routing table.
You must also configure a number of loopback interfaces to populate the IP routing table. Figure 3-1 displays two routers named R1 and R2 connected through Ethernet. Configure the routers of OSPF area 1 and place the loopbacks in area 1 also.
Figure 3-1 displays the IP addressing and area assignments for Routers R1 and R2.
Figure 3-1 Basic OSPF
Configure R1 for OSPF first. Assign all interfaces with the area assignment 1. Also note that this scenario uses VLSM. Use the network command and match the IP subnet exactly. Example 3-2 displays the OSPF configuration performed on R1.
NOTE
Routers R1 and R2 reside in one area; so, in fact, you could apply the one IOS command to enable all interfaces configured with an IP address in the range 131.108.0.0 through 131.108.255.255 with the command network 131.108.0.0 0.0.255.255 area 1.
Example 3-2 R1 OSPF Configuration
router ospf 1 |
network 131.108.1.0 0.0.0.255 area 1 |
network 131.108.4.0 0.0.0.127 area 1 |
network 131.108.4.128 0.0.0.127 area 1 |
network 131.108.5.0 0.0.0.31 area 1 |
Example 3-3 displays the OSPF configuration performed on R2.
Example 3-3 R2 OSPF Configuration
router ospf 2 |
network 131.108.1.0 0.0.0.255 area 1 |
network 131.108.5.32 0.0.0.31 area 1 |
network 131.108.6.1 0.0.0.0 area 1 |
network 131.108.6.2 0.0.0.0 area 1 |
NOTE
R1 has a process ID of 1 and R2 has a process ID of 2. The process ID is locally significant only and doesn't need to match between routers. The process ID can be any number between 165535. Also, because R2 has host (or /32 subnets) masks on loopbacks 2 and 3, the inverse mask is 0.0.0.0, or an exact match.
Example 3-4 displays the three remote networks reachable through OSPF with a cost metric of 11 for all three. The next hop address is 131.108.1.2 through Ethernet 0/0. You might ask yourself why some of the remote networks are displayed as a /32 route when you used a /27 mask.
To discover why loopbacks appear as /32 host routers, examine Example 3-4, which displays the IP routing table on R1.
Example 3-4 R1's IP Routing Table
R1>show ip route |
131.108.0.0/16 is variably subnetted, 7 subnets, 4 masks |
C 131.108.4.128/25 is directly connected, Loopback1 |
O 131.108.5.33/32 [110/11] via 131.108.1.2, 00:02:22, Ethernet0/0 |
O 131.108.6.1/32 [110/11] via 131.108.1.2, 00:02:22, Ethernet0/0 |
C 131.108.5.0/27 is directly connected, Loopback2 |
O 131.108.6.2/32 [110/11] via 131.108.1.2, 00:02:22, Ethernet0/0 |
C 131.108.4.0/25 is directly connected, Loopback0 |
C 131.108.1.0/24 is directly connected, Ethernet0/0 |
R1# |
The remote network is displayed as a /32 route when a /27 mask is used because, by default, OSPF advertises loopbacks as host addresses, or as /32 routes. Change this default configuration and make the routes appear as /27 with the configuration on R2, as displayed in Example 3-5. To make things a little more interesting, modify the cost as well to 1000.
Example 3-5 Advertising Loopbacks as /27 on R2 and Changing the Default Cost to 1000
R2>conf t |
Enter configuration commands, one per line. End with CNTL/Z. |
R2(config)#int loopback0 |
R2(config-if)#ip ospf cost 1000 |
R2(config-if)#ip ospf network point-to-point |
The command ip ospf cost 1000 changes the cost to 1000. The command ip ospf network point-to-point changes the route advertisement to /27. Example 3-6 displays R1's routing table after these changes.
Example 3-6 R1 Routing Table
R1>show ip route |
131.108.0.0/16 is variably subnetted, 7 subnets, 4 masks |
C 131.108.4.128/25 is directly connected, Loopback1 |
O 131.108.5.32/27 [110/1010] via 131.108.1.2, 00:01:19, Ethernet0/0 |
O 131.108.6.1/32 [110/11] via 131.108.1.2, 00:01:19, Ethernet0/0 |
C 131.108.5.0/27 is directly connected, Loopback2 |
O 131.108.6.2/32 [110/11] via 131.108.1.2, 00:01:19, Ethernet0/0 |
C 131.108.4.0/25 is directly connected, Loopback0 |
C 131.108.1.0/24 is directly connected, Ethernet0/0 |
R1# |
In Example 3-6, the subnet 131.108.5.32 displayed is 27 bits. The remaining loopbacks are still /32, so you need to modify them also.
The associated cost of the remote network 131.108.5.32/27 is 1010. To figure out why, remember that OSPF calculates the total cost from source to destination. The 1000 is the cost R2 assigns and advertises to R1. When R1 receives the update, it makes a calculation on total cost. The path taken to the remote network 131.108.5.32 is through Ethernet 0/0. Find out the cost associated with R1 Ethernet 0/0 by using the show ip ospf interface ethernet 0/0 command as displayed in Example 3-7.
Example 3-7 show ip ospf interface ethernet 0/0 on R1
R1>show ip ospf interface ethernet 0/0 |
Ethernet0/0 is up, line protocol is up |
Internet Address 131.108.1.1/24, Area 1 |
Process ID 1, Router ID 131.108.5.1, Network Type BROADCAST, Cost: 10 |
Transmit Delay is 1 sec, State DR, Priority 1 |
Designated Router (ID) 131.108.5.1, Interface address 131.108.1.1 |
Backup Designated router (ID) 131.108.1.2, Interface address 131.108.1.2 |
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 |
Hello due in 00:00:06 |
Neighbor Count is 1, Adjacent neighbor count is 1 |
Adjacent with neighbor 131.108.1.2 (Backup Designated Router) |
Suppress hello for 0 neighbor(s) |
R1# |
The cost associated with the path on the Ethernet segment is 10. Therefore, the total cost is 1000 (as advertised by R2) plus 10, which equals 1010. Another method you can use to determine the cost with an Ethernet segment is to use the cost calculation, cost = 108 / Bandwidth = 108 / 107 = 10. Example 3-8 displays the full routing configuration on R1.
Example 3-8 R1 Full Configuration
version 12.0 |
! |
hostname R1 |
! |
enable password cisco |
! |
no ip domain-lookup |
interface Loopback0 |
ip address 131.108.4.1 255.255.255.128 |
! |
interface Loopback1 |
ip address 131.108.4.129 255.255.255.128 |
! |
interface Loopback2 |
ip address 131.108.5.1 255.255.255.224 |
! |
interface Ethernet0/0 |
ip address 131.108.1.1 255.255.255.0 |
! |
interface Serial0/0 |
shutdown |
! |
interface Serial0/1 |
shutdown |
router ospf 1 |
network 131.108.1.0 0.0.0.255 area 1 |
network 131.108.4.0 0.0.0.127 area 1 |
network 131.108.4.128 0.0.0.127 area 1 |
network 131.108.5.0 0.0.0.31 area 1 |
! |
line con 0 |
line aux 0 |
line vty 0 4 |
! |
end |
Example 3-9 displays the full routing configuration on R2.
Example 3-9 R2 Full Configuration
version 12.0 |
! |
hostname R2 |
! |
enable password cisco |
! |
no ip domain-lookup |
! |
interface Loopback0 |
ip address 131.108.5.33 255.255.255.224 |
ip ospf network point-to-point |
ip ospf cost 1000 |
! |
interface Loopback1 |
ip address 131.108.6.1 255.255.255.255 |
! |
interface Loopback2 |
ip address 131.108.6.2 255.255.255.255 |
! |
interface Ethernet0/0 |
ip address 131.108.1.2 255.255.255.0 |
! |
interface Serial1/0 |
shutdown |
! |
interface Serial1/1 |
shutdown |
! |
interface Serial1/2 |
shutdown |
! |
interface Serial1/3 |
shutdown |
! |
router ospf 2 |
network 131.108.1.0 0.0.0.255 area 1 |
network 131.108.5.32 0.0.0.31 area 1 |
network 131.108.6.1 0.0.0.0 area 1 |
network 131.108.6.2 0.0.0.0 area 1 |
! |
line con 0 |
line aux 0 |
line vty 0 4 |
end |
Now, apply the OSPF principles to a larger, more complex network in Scenario 3-2.
Scenario 3-2: Configuring OSPF in Multiple Areas
Turn your attention to a far more complex OSPF scenario and apply some of the advanced features in OSPF.
This scenario uses four routers: R1 and R2 from scenario 3-1 and two new routers named R6 and R3. Figure 3-2 displays the routers in this scenario.
Figure 3-2 OSPF Topology and IP Addressing
In this scenario, you add two new routers, R3 and R6, and create an additional two new areas: Area 0 and Area 2. That makes a total of three areas: the backbone Area 0 between R3 and R6, Area 2 covering the link between R6 and R2, and Area 1 covering the Ethernets between R1 and R2.
Routers R2 and R6 in this case are referred to area border routers (ABRs) because more than one area is configured on each router. OSPF includes a number of different router types. Table 3-3 displays all the possible routers types.
Table 3-3 OSPF Router Types
Router type |
Description |
Internal router |
This router is within a specific area only. Internal router functions include maintaining the OSPF database and forwarding data to other networks. All interfaces on internal routers are in the same area. |
Area border router (ABR) |
ABRs are responsible for connecting two or more areas. ABRs contain the full topological database of each area they are connected to and send this information to other areas. |
Autonomous system border router (ASBR) |
ASBRs connect to the outside world or perform some form of redistribution into OSPF. |
Backbone router |
Backbone routers are connected to area 0, also know as area 0.0.0.0. Backbone routers can be internal routers and ASBRs. |
In Figure 3-2, R1 is an internal router; R2 is an ABR; R6 is a backbone router and ABR, and R3 is a backbone router.
Router R1 requires no configuration change, but you need to modify R2 and enable OSPF on R3 and R6. Example 3-10 displays the modifications required on R2. Remember that you have a link to R6, so you need to set IP addressing and clocking as you did in the Chapter 2, "Routing Principles." Example 3-5 uses Cisco serial back-to-back V.35 cables.
Example 3-10 Configuration of R2 as ABR
R2(config)#router ospf 2 |
R2(config-router)#network 141.108.10.0 0.0.0.3 area 2 |
Now, enable OSPF on R3 and R6. Notice the IP addressing in Figure 3-2 has a mixture of the Class B networks 131.108.0.0 and 141.108.0.0 with different subnets. Hence, this scenario uses VLSM extensively to illustrate the capability of OSPF to handle VLSM.
To enable OSPF on R6, start the OSPF process with the process ID 6 and enable the interfaces to advertise the networks as displayed by Example 3-11.
Example 3-11 Enable OSPF on R6 with Process ID 6
r6(config)#router ospf 6 |
r6(config-router)# network 141.108.9.0 0.0.0.127 area 0 |
r6(config-router)# network 141.108.9.128 0.0.0.127 area 0 |
r6(config-router)# network 141.108.10.0 0.0.0.3 area 2 |
r6(config-router)# network 141.108.10.4 0.0.0.3 area 0 |
r6(config-router)# network 141.108.12.0 0.0.0.255 area 0 |
r6(config-router)# network 141.108.12.26 0.0.0.255 area 0 |
Similarly, Example 3-12 displays the OSPF configuration required on R3.
Example 3-12 Enable OSPF on R3
R3(config)#router ospf 3 |
R3(config-router)#network 141.108.10.4 0.0.0.3 area 0 |
R3(config-router)#network 141.108.1.0 0.0.0.127 area 0 |
R3(config-router)#network 141.108.1.128 0.0.0.127 area 0 |
R3(config-router)#network 141.108.2.0 0.0.0.31 area 0 |
R3(config-router)#network 131.108.33.0 0.0.0.255 area 0 |
Now that OSPF is configured on all four routers, examine the routing table on the backbone network to ensure that all networks are routable. Example 3-13 displays the IP routing table on R6.
Example 3-13 IP Routing Table on R6
r6>show ip route |
141.108.0.0/16 is variably subnetted, 7 subnets, 3 masks |
O 141.108.1.128/25 [110/65] via 141.108.10.5, 00:00:32, Serial0 |
C 141.108.9.128/25 is directly connected, Loopback1 |
O 141.108.1.0/25 [110/65] via 141.108.10.5, 00:00:32, Serial0 |
C 141.108.9.0/25 is directly connected, Loopback0 |
C 141.108.10.0/30 is directly connected, Serial1 |
C 141.108.12.0/24 is directly connected, Loopback2 |
C 141.108.10.4/30 is directly connected, Serial0 |
131.108.0.0/24 is subnetted, 2 subnets |
O 131.108.33.0 [110/74] via 141.108.10.5, 00:00:32, Serial0 |
C 131.108.26.0 is directly connected, Ethernet0 |
r6# |
Example 3-13 displays the remote networks on Router R3, but not the networks from R1 or R2. For example, the Ethernet network 131.108.1.0/24 in area 1 is not routable from R6. Examine R3's routing table. Example 3-14 displays R3's IP routing table.
Example 3-14 R3's IP Routing Table
R3>show ip route |
141.108.0.0/16 is variably subnetted, 8 subnets, 4 masks |
C 141.108.1.128/25 is directly connected, Loopback1 |
O 141.108.9.128/25 [110/65] via 141.108.10.6, 00:23:42, Serial1 |
C 141.108.1.0/25 is directly connected, Loopback0 |
C 141.108.2.0/27 is directly connected, Loopback2 |
O 141.108.9.0/25 [110/65] via 141.108.10.6, 00:23:42, Serial1 |
O IA 141.108.10.0/30 [110/128] via 141.108.10.6, 00:23:42, Serial1 |
O 141.108.12.0/24 [110/65] via 141.108.10.6, 00:23:42, Serial1 |
C 141.108.10.4/30 is directly connected, Serial1 |
131.108.0.0/24 is subnetted, 1 subnets |
C 131.108.33.0 is directly connected, Ethernet0 |
Once more, Example 3-14 doesn't display the networks in area 1 on Routers R1 and R2. Example 3-15 displays R2's IP routing table.
Example 3-15 R2's IP Routing Table
R2>show ip route |
141.108.0.0/16 is variably subnetted, 7 subnets, 3 masks |
O IA 141.108.1.128/25 [110/846] via 141.108.10.2, 00:08:05, Serial1/0 |
O IA 141.108.9.128/25 [110/782] via 141.108.10.2, 00:26:20, Serial1/0 |
O IA 141.108.1.0/25 [110/846] via 141.108.10.2, 00:08:15, Serial1/0 |
O IA 141.108.9.0/25 [110/782] via 141.108.10.2, 00:26:20, Serial1/0 |
C 141.108.10.0/30 is directly connected, Serial1/0 |
O IA 141.108.12.0/24 [110/782] via 141.108.10.2, 00:26:20, Serial1/0 |
O IA 141.108.10.4/30 [110/845] via 141.108.10.2, 00:26:20, Serial1/0 |
131.108.0.0/16 is variably subnetted, 8 subnets, 3 masks |
O 131.108.4.129/32 [110/11] via 131.108.1.1, 00:46:09, Ethernet0/0 |
C 131.108.5.32/27 is directly connected, Loopback0 |
O IA 131.108.33.0/24 [110/855] via 141.108.10.2, 00:09:06, Serial1/0 |
C 131.108.6.1/32 is directly connected, Loopback1 |
O 131.108.4.1/32 [110/11] via 131.108.1.1, 00:46:09, Ethernet0/0 |
O 131.108.5.1/32 [110/11] via 131.108.1.1, 00:46:09, Ethernet0/0 |
C 131.108.6.2/32 is directly connected, Loopback2 |
C 131.108.1.0/24 is directly connected, Ethernet0/0 |
R2> |
Notice, however, that R2 has access to the remote networks in area 0 or on the backbone, but not vice versa, because Router R2 is connected to area 2.
Area 2 is not partitioned from the backbone. In fact, area 2 is directly connected to the backbone through Router R6.
Area 1 is not directly connected to the backbone. Therefore, Router R1 is missing IP networks.
The golden rule in any OSPF network is that all areas must be contiguous or all areas must be connected to the backbone. Scenario 3-2 includes three areas. If an area cannot be assigned to the backbone or is partitioned from the backbone, a virtual link is required. When designing a network, you use a virtual link to attach areas that do not have a physical connection to the backbone or in cases in which the backbone is partitioned, as in the example shown in Figure 3-2.
Figure 3-3 displays the areas and the requirement for a virtual link.
Figure 3-3 Area Assignments and the Virtual Link Requirement
The virtual link in this scenario is required from R2 to R6. The virtual link allows information about area 1 to be sent to the backbone. Another solution to this problem is to change the area 1 assignment to area 2 or to connect a physical link from area 1 to the backbone. In this scenario, configure a virtual link between R2 and R6.
To create a virtual link, you use the following command:
[no] area area-id virtual-link router-id [hello-interval seconds] [retransmit-interval seconds] [transmit-delay seconds] [dead-interval seconds] [[authentication-key key] | [message-digest-key keyid md5 key]]
As you can see, this command has many options. The following is a simplification:
area area-id virtual-link router-id
The area-id is the transit network between the two partitioned areas, in this case area 2. You can find the router-id by using the show ip ospf database command, which displays the complete OSPF database. Example 3-16 shows you how to discover the router IDs on R2 and R6. Note that the extensive amount of information typically supplied by the show ip ospf database command is not all displayed in Example 3-16.
Example 3-16 show ip ospf database Command on R2 and R6
R2>show ip ospf database |
OSPF Router with ID (131.108.6.2) (Process ID 2) |
r6>show ip ospf database |
OSPF Router with ID (141.108.12.1) (Process ID 6) |
You now have the information required to configure a virtual link between R3 and R6. Examples 3-17 and 3-18 display the configuration performed on Routers R2 and R6.
Example 3-17 Configuring a Virtual Link on R2
R2(config)#router ospf 2 |
R2(config-router)#area 2 virtual-link 141.108.12.1 |
Example 3-18 Configuring a Virtual Link on R6
R6(config)#router ospf 6 |
r6(config-router)#area 2 virtual-link 131.108.6.2 |
Use the show ip ospf virtual-links command on R2, demonstrated in Example 3-19, to ensure that the virtual link is active.
Example 3-19 show ip ospf virtual-links
R2>show ip ospf virtual-links |
Virtual Link OSPF_VL0 to router 141.108.12.1 is up |
Run as demand circuit |
DoNotAge LSA allowed. |
Transit area 2, via interface Serial1/0, Cost of using 781 |
Transmit Delay is 1 sec, State POINT_TO_POINT, |
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 |
Hello due in 00:00:07 |
Adjacency State FULL (Hello suppressed) |
Example 3-19 displays an active link to the remote OSPF router with the ID 141.108.12.1. Now, view the routing tables on R3 to determine whether the area 1 networks have been inserted into the IP routing table, as demonstrated in Example 3-20.
Example 3-20 show ip route on R3
R3>show ip route |
141.108.0.0/16 is variably subnetted, 8 subnets, 4 masks |
C 141.108.1.128/25 is directly connected, Loopback1 |
O 141.108.9.128/25 [110/65] via 141.108.10.6, 00:01:43, Serial1 |
C 141.108.1.0/25 is directly connected, Loopback0 |
C 141.108.2.0/27 is directly connected, Loopback2 |
O 141.108.9.0/25 [110/65] via 141.108.10.6, 00:01:43, Serial1 |
O IA 141.108.10.0/30 [110/128] via 141.108.10.6, 00:01:43, Serial1 |
O 141.108.12.0/24 [110/65] via 141.108.10.6, 00:01:43, Serial1 |
C 141.108.10.4/30 is directly connected, Serial1 |
131.108.0.0/16 is variably subnetted, 9 subnets, 3 masks |
O IA 131.108.4.129/32 [110/139] via 141.108.10.6, 00:01:43, Serial1 |
O IA 131.108.5.32/27 [110/1128] via 141.108.10.6, 00:01:43, Serial1 |
C 131.108.33.0/24 is directly connected, Ethernet0 |
O IA 131.108.6.1/32 [110/129] via 141.108.10.6, 00:01:43, Serial1 |
O IA 131.108.4.1/32 [110/139] via 141.108.10.6, 00:01:43, Serial1 |
O IA 131.108.6.2/32 [110/129] via 141.108.10.6, 00:01:43, Serial1 |
O IA 131.108.5.1/32 [110/139] via 141.108.10.6, 00:01:43, Serial1 |
O IA 131.108.1.0/24 [110/138] via 141.108.10.6, 00:01:43, Serial1 |
O 131.108.26.0/24 [110/74] via 141.108.10.6, 00:01:44, Serial1 |
Router R3 discovers the remote networks from the partitioned area 1 through the virtual link between the routers R2 and R6 as demonstrated by the IP routing table in Example 3-20.
Examples 3-21, 3-22, and 3-23 show the three configurations of routers R2, R3, and R6, respectively. R1's configuration is unchanged from Scenario 3-1.
Example 3-21 Full Configuration on R2
Current configuration: |
! |
version 12.0 |
service timestamps debug uptime |
service timestamps log uptime |
no service password-encryption |
! |
hostname R2 |
! |
enable password cisco |
! |
no ip domain-lookup |
! |
interface Loopback0 |
ip address 131.108.5.33 255.255.255.224 |
ip ospf network point-to-point |
ip ospf cost 1000 |
! |
interface Loopback1 |
ip address 131.108.6.1 255.255.255.255 |
! |
interface Loopback2 |
ip address 131.108.6.2 255.255.255.255 |
! |
interface Ethernet0/0 |
ip address 131.108.1.2 255.255.255.0 |
! |
interface TokenRing0/0 |
shutdown |
! |
interface Serial1/0 |
ip address 141.108.10.1 255.255.255.252 |
! |
interface Serial1/1 |
shutdown |
! |
interface Serial1/2 |
shutdown |
! |
interface Serial1/3 |
shutdown |
! |
router ospf 2 |
area 2 virtual-link 141.108.12.1 |
network 131.108.1.0 0.0.0.255 area 1 |
network 131.108.5.32 0.0.0.31 area 1 |
network 131.108.6.1 0.0.0.0 area 1 |
network 131.108.6.2 0.0.0.0 area 1 |
network 141.108.10.0 0.0.0.3 area 2 |
! |
line con 0 |
line aux 0 |
line vty 0 4 |
login |
! |
end |
Example 3-22 displays R3's full configuration.
Example 3-22 Full Configuration on R3
version 12.0 |
! |
hostname R3 |
! |
enable password cisco |
! |
interface Loopback0 |
ip address 141.108.1.1 255.255.255.128 |
ip ospf network point-to-point |
! |
interface Loopback1 |
ip address 141.108.1.129 255.255.255.128 |
ip ospf network point-to-point |
! |
interface Loopback2 |
ip address 141.108.2.1 255.255.255.224 |
ip ospf network point-to-point |
! |
interface Ethernet0 |
ip address 131.108.33.1 255.255.255.0 |
! |
interface Ethernet1 |
shutdown |
! |
interface Serial0 |
shutdown |
! |
interface Serial1 |
ip address 141.108.10.5 255.255.255.252 |
! |
router ospf 3 |
network 131.108.33.0 0.0.0.255 area 0 |
network 141.108.1.0 0.0.0.127 area 0 |
network 141.108.1.128 0.0.0.127 area 0 |
network 141.108.2.0 0.0.0.31 area 0 |
network 141.108.10.4 0.0.0.3 area 0 |
line con 0 |
line aux 0 |
line vty 0 4 |
! |
end |
Example 3-23 displays R6's full configuration.
Example 3-23 Full Configuration on R6
! |
version 12.0 |
! |
hostname r6 |
! |
enable password cisco |
! |
interface Loopback0 |
ip address 141.108.9.1 255.255.255.128 |
ip ospf network point-to-point |
! |
interface Loopback1 |
ip address 141.108.9.129 255.255.255.128 |
ip ospf network point-to-point |
! |
interface Loopback2 |
ip address 141.108.12.1 255.255.255.0 |
ip ospf network point-to-point |
! |
interface Ethernet0 |
ip address 131.108.26.1 255.255.255.0 |
media-type 10BaseT |
! |
interface Ethernet1 |
shutdown |
! |
interface Serial0 |
ip address 141.108.10.6 255.255.255.252 |
clockrate 125000 |
! |
interface Serial1 |
ip address 141.108.10.2 255.255.255.252 |
clockrate 125000 |
! |
interface Serial2 |
shutdown |
! |
interface Serial3 |
shutdown |
! |
interface TokenRing0 |
shutdown |
! |
interface TokenRing1 |
shutdown |
! |
router ospf 6 |
area 2 virtual-link 131.108.6.2 |
network 141.108.9.0 0.0.0.127 area 0 |
network 141.108.9.128 0.0.0.127 area 0 |
network 141.108.10.0 0.0.0.3 area 2 |
network 141.108.10.4 0.0.0.3 area 0 |
network 131.108.26.0 0.0.0.255 area 0 |
! |
line con 0 |
line aux 0 |
line vty 0 4 |
end |
Now, you move on to learn about some common OSPF commands you can use to ensure that remote networks are reachable.
Scenario 3-3: How OSPF Monitors, Manages, and Maintains Routes
In this scenario, you re-examine in detail the network in Figure 3-2 and discover some of the common OSPF commands for monitoring, managing, and maintaining IP routing tables. This scenario also looks at ways to configure OSPF to modify IP routing table entries, such as cost metrics and DR/BDR election.
Table 3-4 displays a summary of the commands executed in this scenario.
Table 3-4 OSPF Commands for Monitoring, Managing, and Maintaining IP Routing Tables
Command |
Description |
show ip ospf |
Displays the OSPF process and details such as OSPF process ID and router ID. |
show ip ospf database |
Displays routers topological database. |
show ip ospf neighbor |
Displays OSPF neighbors. |
show ip ospf neighbor detail |
Displays OSPF neighbors in detail, providing parameters, such as neighbor address, hello interval, and dead interval. |
show ip ospf interface |
Displays information on how OSPF has been configured for a given interface. |
ip ospf priority |
Interface command used to change the DR/BDR election process. |
ip ospf cost |
Interface command used to change the cost of an OSPF interface. |
Example 3-24 shows the output of the command show ip ospf taken from the backbone Router R3 in Figure 3-2. Table 3-5 explains how to read the most important information contained within the output.
NOTE
Scenario 3-2, and thus this scenario, have four routers with the following router IDs:
- R1131.108.5.1
- R2131.108.6.2
- R3141.108.12.1
- R6141.108.2.1
NOTE
This information is shown in the examples that follow.
Example 3-24 show ip ospf Output
R3>show ip ospf |
Routing Process "ospf 3" with ID 141.108.2.1 |
Supports only single TOS(TOS0) routes |
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs |
Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs |
Number of external LSA 0. Checksum Sum 0x0 |
Number of DCbitless external LSA 0 |
Number of DoNotAge external LSA 0 |
Number of areas in this router is 1. 1 normal 0 stub 0 nssa |
Area BACKBONE(0) |
Number of interfaces in this area is 4 |
Area has no authentication |
SPF algorithm executed 3 times |
Area ranges are |
Number of LSA 13. Checksum Sum 0x54D76 |
Number of DCbitless LSA 0 |
Number of indication LSA 0 |
Number of DoNotAge LSA 9 |
Table 3-5 Explanation of the show ip ospf Command Output Taken from R3
Field |
Explanation |
Routing process ID |
Displays the process ID. In this case 141.108.2.1. |
Minimum LSA interval 5 secs Minimum |
|
LSA arrival 1 sec |
The amount of time that the IOS waits before the SPF calculation is completed after receiving an update. The minimum LSA interval is five seconds and the minimum LSA arrival is one second on R3. |
Number of areas in this router is 1 |
Displays the number of areas configured on the local router. In this example, R3 has all interfaces in the backbone, or area 0. So only one area is displayed by this command. |
Area BACKBONE(0) |
Displays the area the router is configured for. R3 is a backbone router, so this output advises the area in backbone 0. |
Number of interfaces in this area is 4 |
Displays the number of interfaces in area 0. R3 has four interfaces in area 0. |
Area has no authentication |
Displays the fact that no authentication is used on R3. |
Example 3-25 shows the output of the command show ip ospf database taken from the backbone R3 in Figure 3-2. Table 3-6 explains how to read the most important information contained within the output.
Example 3-25 show ip ospf database Output
R3>show ip ospf database |
OSPF Router with ID (141.108.2.1) (Process ID 3) |
Router Link States (Area 0) |
Link ID ADV Router Age Seq# Checksum Link count |
131.108.6.2 131.108.6.2 7 (DNA) 0x80000002 0x38EB 1 |
141.108.2.1 141.108.2.1 559 0x80000003 0xCC2 5 |
141.108.10.5 141.108.10.5 3110 0x8000000B 0x1AC 5 |
141.108.12.1 141.108.12.1 153 0x80000010 0xC3A 7 |
Summary Net Link States (Area 0) |
Link ID ADV Router Age Seq# Checksum |
131.108.1.0 131.108.6.2 82 (DNA) 0x80000001 0xE663 |
131.108.4.1 131.108.6.2 82 (DNA) 0x80000001 0xC57F |
131.108.4.129 131.108.6.2 82 (DNA) 0x80000001 0xC004 |
131.108.5.1 131.108.6.2 82 (DNA) 0x80000001 0xBA89 |
131.108.5.32 131.108.6.2 82 (DNA) 0x80000001 0x8ED4 |
131.108.6.1 131.108.6.2 82 (DNA) 0x80000001 0x4B02 |
131.108.6.2 131.108.6.2 82 (DNA) 0x80000001 0x410B |
141.108.10.0 131.108.6.2 82 (DNA) 0x80000001 0x280C |
141.108.10.0 141.108.12.1 1958 0x80000006 0x846B |
Table 3-6 Explanation of the show ip ospf database Command
Field |
Explanation |
OSPF Router with ID (141.108.2.1) |
|
(Process ID 3) |
The router ID and process ID on the router configured by the network administrator. |
Router Link States (Area 0) |
Displays the link-state advertisements from connected neighbors discovered by the Hello protocol. |
Summary Net Link States (Area 0) |
Information displayed by ABRs. |
To show you some different output, look at two more examples from Scenario 3-2: one from R2 and one from R6. Example 3-26 displays the show ip ospf neighbor command from R2.
Example 3-26 show ip ospf neighbor from R2
R2>show ip ospf neighbor |
Neighbor ID Pri State Dead Time Address Interface |
131.108.5.1 1 FULL/DR 00:00:39 131.108.1.1 Ethernet0/0 |
141.108.12.1 1 FULL/ - 00:00:34 141.108.10.2 Serial1/0 |
Router R2 has two neighbors: one across the Ethernet segment and another through the serial connection to R6. The show ip ospf neighbor command displays the neighbor router ID and the priority of the neighbor (both 1 in this example) as well as the DR. Notice that the DR is R1 as seen by R2. The state of the adjacency (Full) and the dead time are displayed. The dead time is the amount of time before the adjacency is declared dead or inactive if a Hello packet is not received. The dead time must be the same of the adjacent router. The dead time is four times the hello interval. The address field displays the remote router's IP address. In this case, the IP address assigned to R1 is 131.108.1. The interface field describes the outbound interface from which the neighbor was discovered. Example 3-27 displays the neighbors on R6 in more detail by adding the detail parameter to the show ip ospf neighbor command.
Example 3-27 show ip ospf neighbor detail from R6
r6#show ip ospf neighbor detail |
Neighbor 141.108.2.1, interface address 141.108.10.5 |
In the area 0 via interface Serial0 |
Neighbor priority is 1, State is FULL, 6 state changes |
DR is 0.0.0.0 BDR is 0.0.0.0 |
Options 2 |
Dead timer due in 00:00:35 |
Neighbor 131.108.6.2, interface address 141.108.10.1 |
In the area 2 via interface Serial1 |
Neighbor priority is 1, State is FULL, 6 state changes |
DR is 0.0.0.0 BDR is 0.0.0.0 |
Options 2 |
Dead timer due in 00:00:33 |
Router R6 has no adjacency across any broadcast media, such as Ethernet. Therefore, the neighbors are all in a Full state but no DR or BDR is elected across the wide-area network (WAN) link, because the WAN link is considered a point-to-point link. To determine what type of OSPF network the given interface is, use the show ip ospf interface command. Example 3-28 displays this command in its most basic form taken from R6. You can provide more parameters, such as interface serial number.
Example 3-28 show ip ospf interface from R6
r6#show ip ospf interface |
Ethernet0 is up, line protocol is up |
Internet Address 131.108.26.1/24, Area 0 |
Process ID 6, Router ID 141.108.12.1, Network Type BROADCAST, Cost: 10 |
Transmit Delay is 1 sec, State WAITING, Priority 1 |
No designated router on this network |
No backup designated router on this network |
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 |
Hello due in 00:00:01 |
Wait time before Designated router selection 00:00:11 |
Neighbor Count is 0, Adjacent neighbor count is 0 |
Suppress hello for 0 neighbor(s) |
Loopback0 is up, line protocol is up |
Internet Address 141.108.9.1/25, Area 0 |
Process ID 6, Router ID 141.108.12.1, Network Type POINT_TO_POINT, Cost: 1 |
Transmit Delay is 1 sec, State POINT_TO_POINT, |
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 |
Hello due in 00:00:00 |
Neighbor Count is 0, Adjacent neighbor count is 0 |
Suppress hello for 0 neighbor(s) |
Loopback1 is up, line protocol is up |
Internet Address 141.108.9.129/25, Area 0 |
Process ID 6, Router ID 141.108.12.1, Network Type POINT_TO_POINT, Cost: 1 |
Transmit Delay is 1 sec, State POINT_TO_POINT, |
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 |
Hello due in 00:00:00 |
Neighbor Count is 0, Adjacent neighbor count is 0 |
Suppress hello for 0 neighbor(s) |
Loopback2 is up, line protocol is up |
Internet Address 141.108.12.1/24, Area 0 |
Process ID 6, Router ID 141.108.12.1, Network Type POINT_TO_POINT, Cost: 1 |
Transmit Delay is 1 sec, State POINT_TO_POINT, |
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 |
Hello due in 00:00:00 |
Neighbor Count is 0, Adjacent neighbor count is 0 |
Suppress hello for 0 neighbor(s) |
Serial0 is up, line protocol is up |
Internet Address 141.108.10.6/30, Area 0 |
Process ID 6, Router ID 141.108.12.1, Network Type POINT_TO_POINT, Cost: 64 |
Transmit Delay is 1 sec, State POINT_TO_POINT, |
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 |
Hello due in 00:00:06 |
Neighbor Count is 1, Adjacent neighbor count is 1 |
Adjacent with neighbor 141.108.2.1 |
Suppress hello for 0 neighbor(s) |
Serial1 is up, line protocol is up |
Internet Address 141.108.10.2/30, Area 2 |
Process ID 6, Router ID 141.108.12.1, Network Type POINT_TO_POINT, Cost: 64 |
Transmit Delay is 1 sec, State POINT_TO_POINT, |
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 |
Hello due in 00:00:06 |
Neighbor Count is 1, Adjacent neighbor count is 1 |
Adjacent with neighbor 131.108.6.2 |
Suppress hello for 0 neighbor(s) |
r6# |
Router R6 has six interfaces configured with OSPF, so you should expect details about those interfaces. Example 3-28 displays all interface network types as point-to-point (loopbacks by default are configured as loopback, but the IOS command ip ospf network point-to-point configures the loopback as point-to-point networks) except the Ethernet segment, because Ethernet is a broadcast medium. Also notice that because R6 has no neighbors over the Ethernet network, no DR/BDR is elected, because there is no need. The dead interval is four times the hello interval on all interfaces.
Now use some interface commands on the Figure 3-2 network to modify the behavior of the DR/BDR election process. Start by changing the designated router in area 1 and ensure that Router R2 becomes the DR. Example 3-29 displays the current DR and the configuration change on R2 to make the priority higher than R1 by setting the priority to 255.
Example 3-29 Changing the IP OSPF Priority on R2
R2#show ip ospf neighbor |
Neighbor ID Pri State Dead Time Address Interface |
131.108.5.1 1 FULL/DR 00:00:35 131.108.1.1 Ethernet0/0 |
141.108.12.1 1 FULL/ - 00:00:37 141.108.10.2 Serial1/0 |
R2#configure term |
Enter configuration commands, one per line. End with CNTL/Z. |
R2(config)#interface e 0/0 |
R2(config-if)#ip ospf priority 255 |
R2# show ip ospf neighbor |
Neighbor ID Pri State Dead Time Address Interface |
131.108.5.1 1 FULL/DR 00:00:33 131.108.1.1 Ethernet0/0 |
141.108.12.1 1 FULL/ - 00:00:34 141.108.10.2 Serial1/0 |
R2# show ip ospf neighbor |
Neighbor ID Pri State Dead Time Address Interface |
131.108.5.1 1 FULL/DR 00:00:31 131.108.1.1 Ethernet0/0 |
141.108.12.1 1 FULL/ - 00:00:32 141.108.10.2 Serial1/0 |
Example 3-29 stills displays the DR as R1 and not R2 even after the configuration setting changes the priority to 255, because the election process has already taken place and R1 is still the DR. Example 3-30 simulates a network outage by shutting down R1 E0/0. Now look at the OSPF neighbor on R1, as displayed by Example 3-30.
Example 3-30 Shutting Down R1 E0/0 and show ip ospf neighbor Commands
R1(config)#interface e 0/0 |
R1(config-if)#shutdown |
1w6d: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state |
to down |
1w6d: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up |
1w6d: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state |
to up |
R1(config-if)#no shutdown |
1w6d: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up |
1w6d: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state |
to up |
R1#show ip ospf neighbor |
Neighbor ID Pri State Dead Time Address Interface |
131.108.6.2 255 INIT/- 00:00:39 131.108.1.2 Ethernet0/0 |
R1#show ip ospf neighbor |
Neighbor ID Pri State Dead Time Address Interface |
131.108.6.2 255 EXCHANGE/- 0:39 131.108.1.2 Ethernet0/0 |
R1#show ip ospf neighbor |
Neighbor ID Pri State Dead Time Address Interface |
131.108.6.2 255 EXSTART/DR 00:00:39 131.108.1.2 Ethernet0/0 |
R1#show ip ospf neighbor |
Neighbor ID Pri State Dead Time Address Interface |
131.108.6.2 255 LOADING/DR 0:00:39 131.108.1.2 Ethernet0/0 |
R1#show ip ospf nei |
Neighbor ID Pri State Dead Time Address Interface |
131.108.6.2 255 FULL/DR 00:00:39 131.108.1.2 Ethernet0/0 |
Example 3-30 displays some interesting facts. The first is that when you shut down the interface and enable the Ethernet port E0/0 on R1, IOS displays messages to advise you of the changed state. Second, the first neighbor state is INIT, which means R1 sent Hello packets, which are awaiting R2's reply. The state of EXSTART/DR means the two routers have formed a master relationship. The LOADING state indicates that link-state requests have been sent. The FULL state indicates the two routers are fully adjacent or share the same OSPF database.
The DR indicates that the designated router is the neighbor with the IP address 131.108.1.2, which is Router R2. Example 3-31 displays the neighbor state as seen by R2, which is now the backup designated router (BDR).
Example 3-31 show ip ospf neighbor on R2
R2#show ip ospf neighbor |
Neighbor ID Pri State Dead Time Address Interface |
131.108.5.1 1 FULL/BDR 00:00:34 131.108.1.1 Ethernet0/0 |
141.108.12.1 1 FULL/ - 00:00:35 141.108.10.2 Serial1/0 |
The final command in this scenario is the ip ospf cost command. You use this command to change the cost Cisco routers assign by default by using the formula OSPF cost = 108 / bandwidth. This command is not the only method you can use to change the cost. You can also use the bandwidth command on a particular interface and let the Cisco IOS use the bandwidth portion of the cost formula to calculate the new cost.
NOTE
You can also use the command auto-cost reference-bandwidth reference-bandwidth during the OSPF process to change the bandwidth portion of the cost calculation. You should set this command equally across all your routers if you choose to use it. The reference-bandwidth is set to 108 by default.
Assume you have a request from the network administrator that all loopbacks on R1 being advertised to R2 have a total cost of 100. Example 3-32 displays the current cost on R2.
Example 3-32 R2's OSPF Routing Table
R2#show ip route ospf |
141.108.0.0/16 is variably subnetted, 7 subnets, 3 masks |
O 141.108.1.128/25 [110/846] via 141.108.10.2, 3d03h, Serial1/0 |
O 141.108.9.128/25 [110/782] via 141.108.10.2, 3d03h, Serial1/0 |
O 141.108.1.0/25 [110/846] via 141.108.10.2, 3d03h, Serial1/0 |
O 141.108.9.0/25 [110/782] via 141.108.10.2, 3d03h, Serial1/0 |
O 141.108.12.0/24 [110/782] via 141.108.10.2, 3d03h, Serial1/0 |
O 141.108.10.4/30 [110/845] via 141.108.10.2, 3d03h, Serial1/0 |
131.108.0.0/16 is variably subnetted, 9 subnets, 3 masks |
O 131.108.4.129/32 [110/11] via 131.108.1.1, 00:02:03, Ethernet0/0 |
O 131.108.33.0/24 [110/855] via 141.108.10.2, 3d03h, Serial1/0 |
O 131.108.4.1/32 [110/11] via 131.108.1.1, 00:02:03, Ethernet0/0 |
O 131.108.5.1/32 [110/11] via 131.108.1.1, 00:02:03, Ethernet0/0 |
O 131.108.26.0/24 [110/791] via 141.108.10.2, 3d03h, Serial1/0 |
The three loopbacks display a cost of 11. To increase this to 100, you can increase the cost per interface. Example 3-33 displays the cost change on R1 loopback interfaces from the default of 1 to 90. Remember that by default, the cost of a 10MB Ethernet interface is 10.
Example 3-33 Changing the Default Cost on R1 E0/0
R1(config)#interface loopback 0 |
R1(config-if)#ip ospf cost 90 |
R1(config-if)#interface loopback 1 |
R1(config-if)#ip ospf cost 90 |
R1(config-if)#interface loopback 2 |
R1(config-if)#ip ospf cost 90 |
Changing the default cost from 1 to 90 means that the total cost R2 sees is 10, which is the default cost on an Ethernet interface plus the 90 you configured. Example 3-34 now displays the new OSPF routing table with the loopbacks from R1 with a new cost of 100.
Example 3-34 R2's OSPF Routing Table After the Cost Change
R2#show ip route ospf |
141.108.0.0/16 is variably subnetted, 7 subnets, 3 masks |
O 141.108.1.128/25 [110/846] via 141.108.10.2, 3d03h, Serial1/0 |
O 141.108.9.128/25 [110/782] via 141.108.10.2, 3d03h, Serial1/0 |
O 141.108.1.0/25 [110/846] via 141.108.10.2, 3d03h, Serial1/0 |
O 141.108.9.0/25 [110/782] via 141.108.10.2, 3d03h, Serial1/0 |
O 141.108.12.0/24 [110/782] via 141.108.10.2, 3d03h, Serial1/0 |
O 141.108.10.4/30 [110/845] via 141.108.10.2, 3d03h, Serial1/0 |
131.108.0.0/16 is variably subnetted, 9 subnets, 3 masks |
O 131.108.4.129/32 [110/100] via 131.108.1.1, 00:00:35, Ethernet0/0 |
O 131.108.33.0/24 [110/855] via 141.108.10.2, 3d03h, Serial1/0 |
O 131.108.4.1/32 [110/100] via 131.108.1.1, 00:00:35, Ethernet0/0 |
O 131.108.5.1/32 [110/100] via 131.108.1.1, 00:00:35, Ethernet0/0 |
O 131.108.26.0/24 [110/791] via 141.108.10.2, 3d03h, Serial1/0 |
Example 3-34 displays the cost to the remote networks on R1 as 100.
The next scenario shows you how to configure an advanced OSPF network using a three-router network over Frame Relay.
Scenario 3-4: OSPF over Frame Relay in an NBMA Environment
This scenario covers configuring OSPF over Frame Relay in an NBMA environment. This scenario helps you discover some of the advanced features of OSPF, such as DR election in an NBMA environment.
Figure 3-4 displays the three-router network over Frame Relay used in this scenario. Included in Figure 3-4 are the IP addressing scheme, Frame Relay DLCI numbering, and OSPF area assignments.
Figure 3-4 OSPF over Frame Relay
This scenario involves three routers running OSPF over Frame Relay. Start by configuring the Frame Relay parameters. Figure 3-4 displays the Frame Relay DLCIs and Local Management Interface (LMI) types. Example 3-35 displays R3's Frame Relay configuration. You do not use subinterfaces in this scenario to demonstrate an NBMA environment.
Example 3-35 R3's Frame Relay Configuration
R3(config)#interface serial 0 |
R3(config-if)#ip address 141.108.1.1 255.255.255.248 |
R3(config-if)# encapsulation frame-relay |
R3(config-if)# frame-relay interface-dlci 103 |
R3(config-fr-dlci)# frame-relay interface-dlci 108 |
Example 3-35 shows you how to configure the IP address and how to enable Frame Relay encapsulation. R3 also requires the DLCI information, as displayed in Figure 3-4. The specific DLCIs are 103, which is the path to R4, and 108, which is the path to R5.
Example 3-36 and Example 3-37 show the configurations of R4 and R5, respectively.
Example 3-36 The Frame Relay Configuration on R4
interface Serial0 |
ip address 141.108.1.2 255.255.255.248 |
encapsulation frame-relay |
frame-relay interface-dlci 107 |
frame-relay map ip 141.108.1.1 107 broadcast |
Example 3-37 The Frame Relay Configuration on R5
interface Serial0 |
ip address 141.108.1.3 255.255.255.248 |
encapsulation frame-relay |
frame-relay interface-dlci 106 |
frame-relay map ip 141.108.1.1 106 broadcast |
NOTE
In Examples 3-36 and 3-37, R4 and R5 map IP over Frame Relay, but this is not the case on R3 in Example 3-35. Frame Relay, like any protocol, needs to map Layer 2 of the Open System Interconnection (OSI) model to Layer 3. R3 is not configured for static mapping, because Frame Relay dynamically discovers the maps because R3 is a hub router using Frame Relay inverse Address resolution Protocol (ARP) protocol. Frame Relay inverse ARP automatically discovers the DLCI and next hop IP address.
Now that you have enabled Frame Relay, you can start the OSPF configuration. Example 3-38 displays the OSPF configuration on R3 along with the IP address assignment to E0.
Example 3-38 OSPF and IP Address Configuration on R3
R3(config)#interface ethernet 0 |
R3(config-if)#ip address 141.108.3.1 255.255.255.0 |
R3(config-if)#router ospf 3 |
R3(config-router)#network 141.108.3.0 0.0.0.255 area 3 |
R3(config-router)#network 141.108.1.0 0.0.0.7 area 0 |
You must also enable OSPF on Routers R4 and R5. Example 3-39 displays the OSPF configuration on R4 along with the IP address assignment to E0.
Example 3-39 OSPF and IP Address Configuration on R4
R4(config)#interface ethernet 0 |
R4(config-if)#ip address 141.108.4.1 255.255.255.0 |
R4(config)#router ospf 4 |
R4(config-router)#network 141.108.4.0 0.0.0.255 area |
R4(config-router)#network 141.108.1.0 0.0.0.7 area 0 |
Example 3-40 displays the OSPF configuration on R5 along with the IP address assignment to E0.
Example 3-40 OSPF and IP Address Configuration on R5
R5(config-if)#ip address 141.108.5.1 255.255.255.0 |
R5(config-if)#interface ethernet 1 |
R5(config-if)#ip address 141.108.6.1 255.255.255.0 |
R5(config-if)#router ospf 5 |
R5(config-router)#network 141.108.5.0 0.0.3.255 area 5 |
R5(config-router)#network 141.108.1.0 0.0.0.7 area 0 |
NOTE
Example 3-40 places the two Ethernet networks with the one OSPF statement.
Ensure that OSPF adjacencies are up and in a FULL state on R3. Example 3-41 displays the OSPF neighbor state on router R3.
Example 3-41 show ip ospf neighbor Command on R3
R3>show ip ospf neighbor |
R3> |
As you can see from the lack of output in Example 3-41, Router R3 has no adjacencies. The IOS on R3 in Example 3-41 tells you there are no OSPF relationships to R4 and R5. That lack of relationships is because OSPF Hello packets (using multicast address, of course) are not sent over a nonbroadcast OSPF network type.
Figure 3-4 shows a classic example of OSPF over NBMA. In an NBMA environment, broadcasts or multicasts do not propagate over the Frame Relay. Example 3-42 displays the OSPF network type on R3 link to R4 and R5.
Example 3-42 show ip ospf interface serial 0 Command on R3
R3>show ip ospf int s 0 |
Serial0 is up, line protocol is up |
Internet Address 141.108.1.1/29, Area 0 |
Process ID 3, Router ID 141.108.10.5, Network Type NON_BROADCAST, Cost: 64 |
Transmit Delay is 1 sec, State DR, Priority 1 |
Designated Router (ID) 141.108.10.5, Interface address 141.108.1.1 |
No backup designated router on this network |
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5 |
Hello due in 00:00:00 |
Neighbor Count is 0, Adjacent neighbor count is 0 |
Suppress hello for 0 neighbor(s) |
Example 3-42 displays no neighbor and the main fact that the link is considered a nonbroadcast link. OSPF can be configured a variety of ways to accomplish this. To demonstrate OSPF over NBMA in this scenario, you do not modify the network type, but rather you statically configure a neighbor relationship from R3 to R4 and R5. To enable a static OSPF neighbor relationship, enter the following command:
neighbor ip address of neighbor
Example 3-43 displays the configuration on R3 to remote routers R4 and R5.
Example 3-43 Static Neighbor Configuration on R3
R3(config)#router ospf 3 |
R3(config-router)#neighbor 141.108.1.2 |
R3(config-router)#neighbor 141.108.1.3 |
The command neighbor 141.108.1.2 configures the neighbor to R4. The command neighbor 141.108.1.3 configures the neighbor to R5.
Example 3-43 overcomes the need to change the network environment from nonbroadcast and allows a static configuration of remote OSPF routers. One more important task is required. Router R4 and R5 are spoke, or edge, routers. The hub router, R3, must become the DR, because R3 has links to both R4 and R5 and information will be sent from R4 to R5, for example, through R3. The easiest way to make R3 the DR is to disable R4 and R5 from ever becoming the DR by applying a 0 priority on R4 and R5. Example 3-44 demonstrates how to set the priority to 0, in effect disabling any chance for R4 or R5 to become the DR.
Example 3-44 IP OSPF Priority Set to 0 on R4 and R5
R4(config)#interface serial 0 |
R4(config-if)#ip ospf priority 0 |
R5(config)#interface serial 0 |
R5(config-if)#ip ospf priority 0 |
Examples 3-45 displays the OSPF neighbors on R3.
Example 3-45 show ip ospf neighbor Command on R3
R3#show ip ospf nei |
Neighbor ID Pri State Dead Time Address Interface |
141.108.5.1 0 FULL/DROTHER 00:01:54 141.108.1.3 Serial0 |
141.108.1.2 0 FULL/DROTHER 00:01:44 141.108.1.2 Serial0 |
The state shown in Example 3-45 displays a FULL adjacency and a state known as DROTHER, which indicates that the neighbor was not chosen as the DR or BDR and cannot be because the priority has been set to zero. Example 3-46 displays the full working configuration of R3.
Example 3-46 R3's Full Configuration
version 12.0 |
! |
hostname R3 |
! |
enable password cisco |
! |
ip subnet-zero |
! |
interface Ethernet0 |
ip address 141.108.3.1 255.255.255.0 |
! |
interface Ethernet1 |
no ip address |
shutdown |
! |
interface Serial0 |
ip address 141.108.1.1 255.255.255.248 |
encapsulation frame-relay |
frame-relay interface-dlci 103 |
frame-relay interface-dlci 108 |
! |
interface Serial1 |
ip address 141.108.10.5 255.255.255.252 |
! |
router ospf 3 |
network 141.108.1.0 0.0.0.7 area 0 |
network 141.108.3.0 0.0.0.255 area 3 |
neighbor 141.108.1.3 |
neighbor 141.108.1.2 |
! |
line con 0 |
line aux 0 |
line vty 0 4 |
end |
Example 3-47 displays the full working configuration of R4.
Example 3-47 R4's Full Configuration
version 12.0 |
! |
hostname R4 |
! |
enable password cisco |
! |
ip subnet-zero |
! |
interface Ethernet0 |
ip address 141.108.4.1 255.255.255.0 |
interface Serial0 |
ip address 141.108.1.2 255.255.255.248 |
encapsulation frame-relay |
ip ospf priority 0 |
frame-relay map ip 141.108.1.1 107 broadcast |
frame-relay interface-dlci 107 |
frame-relay lmi-type cisco |
! |
interface Serial1 |
shutdown |
! |
router ospf 4 |
network 141.108.1.0 0.0.0.7 area 0 |
network 141.108.4.0 0.0.0.255 area 4 |
! |
line con 0 |
line aux 0 |
line vty 0 4 |
! |
end |
Example 3-48 displays the full working configuration of R5.
Example 3-48 R5's Full Configuration
version 12.0 |
! |
hostname R5 |
! |
enable password cisco |
! |
ip subnet-zero |
! |
interface Ethernet0 |
ip address 141.108.5.1 255.255.255.0 |
! |
interface Ethernet1 |
ip address 141.108.6.1 255.255.255.0 |
! |
interface Serial0 |
ip address 141.108.1.3 255.255.255.248 |
encapsulation frame-relay |
ip ospf priority 0 |
frame-relay map ip 141.108.1.1 106 broadcast |
frame-relay interface-dlci 106 |
! |
interface Serial1 |
shutdown |
! |
router ospf 5 |
network 141.108.1.0 0.0.0.7 area 0 |
network 141.108.4.0 0.0.3.255 area 5 |
! |
line con 0 |
line aux 0 |
line vty 0 4 |
! |
end |
The final scenario covers common show and debug commands used to verify correct OSPF implementation.
Scenario 3-5: Verifying OSPF Routing
This scenario covers common techniques used in OSPF networks to verify correct configuration in a single OSPF area. In this scenario, the configurations supplied are not the full working solutions to demonstrate the power of OSPF.
Figure 3-5 displays a simple two-router topology. The two routers are named SanFran and Chicago. Figure 3-5 displays the correct IP address assignment and OSPF area assignment. The network administrator of R1 has told you that a number of remote networks on R2 are not reachable by R1.
Figure 3-5 Sample Network for Verifying OSPF Routing
NOTE
Figure 3-5 displays two routers with the names SanFran and Chicago. To change the name of a router, you use the hostname name command. Also, notice that the backbone segment is displayed as 0.0.0.0. The backbone can be configured on Cisco routers as 0 or 0.0.0.0.
Example 3-49 displays SanFran's IP routing table.
Example 3-49 SanFran's IP Routing Table
SanFran#show ip route |
131.108.0.0/24 is subnetted, 3 subnets |
C 131.108.5.0 is directly connected, Loopback1 |
C 131.108.4.0 is directly connected, Loopback0 |
C 131.108.1.0 is directly connected, Ethernet0/0 |
R1# |
Example 3-49 displays no remote entries on R1. Start by ensuring that OSPF is correctly configured on R1 by using the show ip ospf interface command. Example 3-50 displays a sample output taken from the router SanFran.
Example 3-50 show ip ospf interface Command on SanFran
SanFran#show ip ospf interface |
Ethernet0/0 is up, line protocol is up |
Internet Address 131.108.1.1/24, Area 0.0.0.0 |
Process ID 1, Router ID 131.108.5.1, Network Type BROADCAST, Cost: 10 |
Transmit Delay is 1 sec, State DR, Priority 1 |
Designated Router (ID) 131.108.5.1, Interface address 131.108.1.1 |
No backup designated router on this network |
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5 |
Hello due in 00:00:00 |
Neighbor Count is 0, Adjacent neighbor count is 0 |
Suppress hello for 0 neighbor(s) |
Loopback0 is up, line protocol is up |
Internet Address 131.108.4.1/24, Area 0.0.0.0 |
Process ID 1, Router ID 131.108.5.1, Network Type LOOPBACK, Cost: 90 |
Loopback interface is treated as a stub Host |
Loopback1 is up, line protocol is up |
Internet Address 131.108.5.1/24, Area 0.0.0.0 |
Process ID 1, Router ID 131.108.5.1, Network Type LOOPBACK, Cost: 90 |
Loopback interface is treated as a stub Host |
Example 3-50 displays a number of important details, such as the Ethernet interface on R1 resides in area 0.0.0.0, or the backbone; the network type over the Ethernet interface is broadcast; and the router SanFran is the elected DR. The loopbacks on Chicago and SanFran are active (software interfaces, like loopbacks, are active as long as they are not administratively shutdown), so OSPF looks like it is correctly configured on R1. Take the same steps on Chicago. Example 3-51 displays a sample output from the show ip ospf interface command.
Example 3-51 show ip ospf interface Command on Chicago
Chicago#show ip ospf interface |
Loopback0 is up, line protocol is up |
Internet Address 131.108.6.1/24, Area 0.0.0.0 |
Process ID 2, Router ID 131.108.7.1, Network Type POINT_TO_POINT, Cost: 1 |
Transmit Delay is 1 sec, State POINT_TO_POINT, |
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 |
Hello due in 00:00:00 |
Neighbor Count is 0, Adjacent neighbor count is 0 |
Suppress hello for 0 neighbor(s) |
Loopback1 is up, line protocol is up |
Internet Address 131.108.7.1/24, Area 0.0.0.0 |
Process ID 2, Router ID 131.108.7.1, Network Type LOOPBACK, Cost: 1 |
Loopback interface is treated as a stub Host |
Example 3-51 displays the loopbacks in OSPF process 2, but the Ethernet interface is not enabled. Example 3-52 displays the OSPF configuration on Chicago.
Example 3-52 OSPF Configuration on Chicago
router ospf 2 |
network 131.108.1.0 0.0.0.0 area 0.0.0.0 |
network 131.108.6.0 0.0.0.255 area 0.0.0.0 |
network 131.108.7.0 0.0.0.255 area 0.0.0.0 |
Example 3-52 displays the fault with the router Chicago. The command network 131.108.1.0 0.0.0.0 causes the router to enable OSPF for the interface configured with the IP address 131.108.1.0. This address is a reserved address for the subnet 131.108.1.0/24; hence OSPF cannot run. Remove this command and install the correct network and mask command. Example 3-53 displays the removal of the incorrect command and insertion of the correct network statement.
Example 3-53 Modifying the OSPF Configuration on Chicago
Chicago(config)#router ospf 2 |
Chicago (config-router)#no network 131.108.1.0 0.0.0.0 area 0.0.0.0 |
Chicago (config-router)#network 131.108.1.2 0.0.0.0 area 0.0.0.0 |
Make sure that OSPF is enabled on Chicago's Ethernet interface. Example 3-54 displays a sample output with the show ip ospf interface command.
Example 3-54 show ip ospf interface Command on Chicago
Ethernet0/0 is up, line protocol is up |
Internet Address 131.108.1.2/24, Area 0.0.0.0 |
Process ID 2, Router ID 131.108.7.1, Network Type BROADCAST, Cost: 10 |
Transmit Delay is 1 sec, State WAITING, Priority 1 |
No designated router on this network |
No backup designated router on this network |
Timer intervals configured, Hello 10, Dead 40, Wait 120, Retransmit 5 |
Hello due in 00:00:16 |
Wait time before Designated router selection 00:01:46 |
Neighbor Count is 0, Adjacent neighbor count is 0 |
Suppress hello for 0 neighbor(s) |
Loopback0 is up, line protocol is up |
Internet Address 131.108.6.1/24, Area 0.0.0.0 |
Process ID 2, Router ID 131.108.7.1, Network Type POINT_TO_POINT, Cost: 1 |
Transmit Delay is 1 sec, State POINT_TO_POINT, |
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 |
Hello due in 00:00:00 |
Neighbor Count is 0, Adjacent neighbor count is 0 |
Suppress hello for 0 neighbor(s) |
Loopback1 is up, line protocol is up |
Internet Address 131.108.7.1/24, Area 0.0.0.0 |
Process ID 2, Router ID 131.108.7.1, Network Type LOOPBACK, Cost: 1 |
Loopback interface is treated as a stub Host |
Example 3-54 displays that the Ethernet interface is now, in fact, enabled in OSPF area 0.0.0.0. The fact that no adjacent neighbor is present still represents a problem.
Move back to the router named SanFran, and check for OSPF adjacency. Example 3-55 displays the OSPF characteristic of the Router SanFran.
Example 3-55 show ip ospf interface ethernet 0/0 Command on SanFran
SanFran#show ip ospf interface ethernet 0/0 |
Ethernet0/0 is up, line protocol is up |
Internet Address 131.108.1.1/24, Area 0.0.0.0 |
Process ID 1, Router ID 131.108.5.1, Network Type BROADCAST, Cost: 10 |
Transmit Delay is 1 sec, State DR, Priority 1 |
Designated Router (ID) 131.108.5.1, Interface address 131.108.1.1 |
No backup designated router on this network |
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5 |
Hello due in 00:00:11 |
Neighbor Count is 0, Adjacent neighbor count is 0 |
Suppress hello for 0 neighbor(s) |
No neighbor exists on this segment. Now introduce a new command using the debug command set:
debug ip ospf adj
This command enables IOS output of all events relating to adjacencies. Example 3-56 displays the command being enabled and a sample output taken from the router SanFran.
Example 3-56 debug ip ospf adj and Sample IOS Display
SanFran#debug ip ospf adj |
OSPF adjacency events debugging is on |
SanFran# |
2w5d: OSPF: Rcv hello from 131.108.7.1 area 0.0.0.0 from Ethernet0/0 131.108.1.2 |
2w5d: OSPF: Mismatched hello parameters from 131.108.1.2 |
2w5d: Dead R 40 C 120, Hello R 10 C 30 Mask R 255.255.255.0 C 255.255.255.0 |
The error message displayed by the IOS in Example 3-56 clearly states you have a mismatch in the hello interval. In other words, the hello interval the Router SanFran uses (local router where the display is taken from) is different from the router sending out a Hello packet with the router ID 131.108.7.1, through the IP address 131.108.1.2.
Remember that hello and dead intervals must match before neighboring routers can become fully adjacent.
Example 3-56 displays Dead R 40 C 120, Hello R 10 C 30. The first information tells you that the dead interval (displayed as Dead in the debug output) received from the router Chicago (Dead R 40) is set to 40 seconds, whereas the configured (displayed as C from the debug output) dead interval (Dead C 120) on SanFran is 120 seconds. Therefore, there is a mismatch error. Similarly, the hello interval Chicago receives is set to 10 seconds; whereas the configured hello interval on SanFran is 30, another mismatch. The sample debug output, as displayed in Example 3-56, advises you that the hello and dead interval should be correctly set on both routers: SanFran and Chicago.
OSPF routers never become adjacent (in other words, never exchange OSPF databases) unless all OSPF parameters, such as the hello interval or dead interval, are the same.
Example 3-56 advises you that the Chicago dead interval is 40 seconds, whereas the configured interval on SanFran is 120 seconds.
Example 3-56 advises you that Chicago's hello interval is 10 seconds, whereas the configured hello interval on SanFran is 30 seconds. These two clearly do not match.
Example 3-57 displays the configuration change on SanFran to ensure hello and dead intervals are configured the same way. The hello interval is set to 10 seconds.
NOTE
The dead interval, by default, is four times the hello interval. Hence, Router SanFran is configured with a hello interval of 10 seconds, which automatically configures the dead interval to 40 seconds thereby matching the hello and dead intervals set on the router named Chicago.
Example 3-57 Changing Hello Interval to 10 Seconds on SanFran
SanFran(config)#interface ethernet 0/0 |
SanFran(config-if)#ip ospf hello-interval 10 |
SanFran(config-if)#^Z |
SanFran# |
2w5d: %SYS-5-CONFIG_I: Configured from console by console |
SanFran# |
2w5d: OSPF: Rcv hello from 131.108.7.1 area 0.0.0.0 from Ethernet0/0 131.108.1.2 |
2w5d: OSPF: End of hello processing |
2w5d: OSPF: Rcv DBD from 131.108.7.1 on Ethernet0/0 seq 0x1235 opt 0x2 flag 0x7 |
len 32 mtu 1500 state INIT |
2w5d: OSPF: 2 Way Communication to 131.108.7.1 on Ethernet0/0, state 2WAY |
2w5d: OSPF: Neighbor change Event on interface Ethernet0/0 |
2w5d: OSPF: DR/BDR election on Ethernet0/0 |
2w5d: OSPF: Elect BDR 0.0.0.0 |
2w5d: OSPF: Elect DR 131.108.7.1 |
2w5d: OSPF: Elect BDR 131.108.5.1 |
2w5d: OSPF: Elect DR 131.108.7.1 |
2w5d: DR: 131.108.7.1 (Id) BDR: 131.108.5.1 (Id) |
2w5d: OSPF: Send DBD to 131.108.7.1 on Ethernet0/0 seq 0x11C4 opt 0x2 flag 0x7 l |
en 32 |
2w5d: OSPF: Set Ethernet0/0 flush timer |
2w5d: OSPF: Remember old DR 131.108.5.1 (id) |
2w5d: OSPF: NBR Negotiation Done. We are the SLAVE |
2w5d: OSPF: Send DBD to 131.108.7.1 on Ethernet0/0 seq 0x1235 opt 0x2 flag 0x2 l |
en 72 |
2w5d: OSPF: Rcv DBD from 131.108.7.1 on Ethernet0/0 seq 0x1236 opt 0x2 flag 0x3 |
len 92 mtu 1500 state EXCHANGE |
2w5d: OSPF: Send DBD to 131.108.7.1 on Ethernet0/0 seq 0x1236 opt 0x2 flag 0x0 l |
en 32 |
2w5d: OSPF: Database request to 131.108.7.1 |
2w5d: OSPF: sent LS REQ packet to 131.108.1.2, length 24 |
2w5d: OSPF: Rcv DBD from 131.108.7.1 on Ethernet0/0 seq 0x1237 opt 0x2 flag 0x1 |
len 32 mtu 1500 state EXCHANGE |
2w5d: OSPF: Exchange Done with 131.108.7.1 on Ethernet0/0 |
2w5d: OSPF: Send DBD to 131.108.7.1 on Ethernet0/0 seq 0x1237 opt 0x2 flag 0x0 l |
en 32 |
2w5d: OSPF: We are not DR to build Net Lsa for interface Ethernet0/0 |
2w5d: OSPF: Synchronized with 131.108.7.1 on Ethernet0/0, state FULL |
2w5d: OSPF: Include link to old DR on Ethernet0/0 |
2w5d: OSPF: Build router LSA for area 0.0.0.0, router ID 131.108.5.1, seq 0x8000 |
0004 |
2w5d: OSPF: Rcv hello from 131.108.7.1 area 0.0.0.0 from Ethernet0/0 131.108.1.2 |
2w5d: OSPF: End of hello processing |
As soon as you correct the problem, you see the hello process completed, and an OSPF database exchange occurs. In other words, Routers Chicago and SanFran are now OSPF neighbors. Example 3-57 highlights the OSPF neighbor state from the initial INIT state to the FULL state. Example 3-58 now displays SanFran's IP routing table.
Example 3-58 SanFran IP Routing Table
SanFran#show ip route |
131.108.0.0/16 is variably subnetted, 5 subnets, 2 masks |
O 131.108.7.1/32 [110/11] via 131.108.1.2, 00:01:25, Ethernet0/0 |
O 131.108.6.1/32 [110/11] via 131.108.1.2, 00:01:25, Ethernet0/0 |
C 131.108.5.0/24 is directly connected, Loopback1 |
C 131.108.4.0/24 is directly connected, Loopback0 |
C 131.108.1.0/24 is directly connected, Ethernet0/0 |
The Router SanFran now discovers the remote networks 131.108.7.1/32 and 131.108.6.0/32 through OSPF.
This scenario has introduced you to some powerful OSPF commands that you can use to discover why OSPF is not functioning correctly. Cisco IOS is updated almost daily, so you need to reference the IOS documentation for new and ever-expanding commands. Example 3-59 displays the debug and show commands possible on a Cisco router running IOS release 12.0.10.
Example 3-59 Possible show and debug OSPF Commands
SanFran#show ip ospf ? |
<1-4294967295> Process ID number |
border-routers Border and Boundary Router Information |
database Database summary |
interface Interface information |
neighbor Neighbor list |
request-list Link state request list |
retransmission-list Link state retransmission list |
summary-address Summary-address redistribution Information |
virtual-links Virtual link information |
<cr> |
SanFran#debug ip ospf ? |
adj OSPF adjacency events |
database-timer OSPF database timer |
events OSPF events |
flood OSPF flooding |
lsa-generation OSPF lsa generation |
packet OSPF packets |
retransmission OSPF retransmission events |
spf OSPF spf |
tree OSPF database tree |
NOTE
Using the ? character on the command-line interface displays a list of commands available to the user. Example 3-59 takes advantage of this tool to display commands available to the network administrator.
Example 3-60 displays the full working configuration on SanFran.
Example 3-60 The Full Working Configuration on SanFran
version 12.0 |
hostname SanFran |
! |
enable password cisco |
! |
ip subnet-zero |
no ip domain-lookup |
interface Loopback0 |
ip address 131.108.4.1 255.255.255.0 |
! |
interface Loopback1 |
ip address 131.108.5.1 255.255.255.0 |
! |
interface Ethernet0/0 |
ip address 131.108.1.1 255.255.255.0 |
! |
interface Serial0/0 |
shutdown |
! |
interface Serial0/1 |
shutdown |
! |
router ospf 1 |
network 0.0.0.0 255.255.255.255 area 0.0.0.0 |
! |
ip classless |
line con 0 |
line aux 0 |
line vty 0 4 |
! |
end |
Example 3-61 displays the full working configuration on Chicago.
Example 3-61 The Full Working Configuration on Chicago
version 12.0 |
! |
hostname Chicago |
! |
enable password cisco |
! |
ip subnet-zero |
no ip domain-lookup |
interface Loopback0 |
ip address 131.108.6.1 255.255.255.0 |
! |
interface Loopback1 |
ip address 131.108.7.1 255.255.255.0 |
interface Ethernet0/0 |
ip address 131.108.1.2 255.255.255.0 |
! |
interface Serial1/0 |
shutdown |
! |
interface Serial1/1 |
shutdown |
! |
router ospf 2 |
network 131.108.1.2 0.0.0.0 area 0.0.0.0 |
network 131.108.6.0 0.0.0.255 area 0.0.0.0 |
network 131.108.7.0 0.0.0.255 area 0.0.0.0 |
line con 0 |
line aux 0 |
line vty 0 4 |
! |
end |