Configuring OSPF in a Single Area
This chapter covers the
following topics, which
you need to understand to
pass the CCNP/CCDP/CCIP
■ Conﬁguring OSPF in a single area
■ Conﬁguring OSPF over an NBMA topology
■ Checking the conﬁguration of OSPF on a single router
■ Troubleshooting OSPF in a single area
This chapter explains how to conﬁgure, verify, and troubleshoot OSPF. This chapter assumes knowledge of the previous chapter, which dealt conceptually with the theory and operation of OSPF in a single area. This chapter covers how to conﬁgure OSPF in a single area, which is the simplest design. Although this conﬁguration does not exploit the strengths of the link-state protocol, it introduces the fundamentals of OSPF conﬁguration. You can build on this knowledge in the subsequent chapters that deal with the design and conﬁguration of OSPF in a multiple-area environment.
This chapter assumes your comprehension of the subjects covered within Chapter 6, “Using OSPF in a Single Area.”
“Do I Know This Already?” Quiz
The purpose of the “Do I Know This Already?” quiz is to help you decide what parts of this chapter to use. If you already intend to read the entire chapter, you do not necessarily need to answer these questions now.
The 14-question quiz, derived from the major sections in the “Foundation Topics” portion of the chapter, helps you to determine how to spend your limited study time.
Table 7-1 outlines the major topics discussed in this chapter and the “Do I Know This Already?” quiz questions that correspond to those topics.
Table 7-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping
220 Chapter 7: Configuring OSPF in a Single Area
NOTE The goal of self-assessment is to gauge your mastery of the topics in this chapter. If you do not know the answer to a question or are only partially sure of the answer, you should mark this question wrong for purposes of the self-assessment. Giving yourself credit for an answer you correctly guess skews your self-assessment results and might provide you with a false sense of security.
1. At what level is the area for OSPF deﬁned?
2. Which of the following best deﬁne the purpose of the network command?
a. To state the networks that are to be summarized
b. To state the networks to be advertised
c. To deﬁne the OSPF areas and associate the interface with the area
d. To identify the interfaces through which OSPF packets are to be sent and received
3. Which of the following are valid network commands?
a. network 10.10.0.0 255.255.0.0 area 0
b. network 10.10.0.0 0.0.255.255 area 0.0.0.5
c. network 10.10.0.0 255.255.0.0 area 5
d. network 10.10.0.0 0.0.255.255 area 0.0.1.10
4. The default selection of the router ID would select a router ID by which of the following?
a. Highest IP address
b. Highest loopback address
c. No defaults; must be manually conﬁgured
d. Highest area ID, changing it to a dotted decimal notation
5. Which interface setting affects the default OSPF metric that is being run on a Cisco system?
a. There is no default metric setting; it is an industry standard and must be manually conﬁgured.
b. The error rate on the interface changes the cost of the link.
c. The bandwidth setting changes the OSPF metric by default on Cisco routers.
d. Changing the priority command changes the OSPF process, which affects the cost of the link.
6. Which best describes a loopback interface in OSPF?
a. The loopback interface is used for testing the router.
b. The loopback interface is a virtual interface that exists only in software.
c. The loopback interface is an interface that has been terminated for troubleshooting.
d. A loopback interface is an interface on FDDI.
7. When is the neighbor command used in conﬁguring OSPF over a nonbroadcast NBMA link?
a. Neighbors are deﬁned to allow the manual conﬁguration of the neighbor table.
b. Nonbroadcast multiaccess ATM clouds need neighbors to be deﬁned so that the address can be appended to each cell.
c. In a nonbroadcast point-to-multipoint network, the neighbor command is used to deﬁne the next hop in OSPF.
d. In a nonbroadcast environment, the DR and BDR must be conﬁgured with a static list of the other routers attached to the cloud so that they can become neighbors and create adjacencies.
8. Where would you conﬁgure a point-to-point interface for OSPF over an NBMA topology?
a. At the interface level
b. At the subinterface
c. Under the routing process
d. Under the subinterface
9. You use the broadcast mode to avoid using the neighbor command and all the attendant conﬁgurations. Which of the following commands is correct?
a. ip ospf ptmp
b. ip ospf point to point
c. ip ospf network broadcast
d. ip ospf broadcast
10. Which OSPF database is shown with the show ip ospf database command?
a. Forwarding database
b. Topology database
c. Neighbor database
d. SPF tree
11. Which of the following are shown in the command show ip ospf interface ?
a. Link State Update Interval is 00:30:00
b. Network Type broadcast
c. Transmit delay is 1 sec
d. Dead timer due in 00:00:34
12. Which of the following commands shows the DR?
a. show ip ospf neighbor detail
b. show ip ospf
c. show ip ospf database
d. show ip ospf interface
13. Which packets are shown in the command debug ip packet ?
14. Which debug command shows the changes in adjacencies, ﬂooding information, designated
router selection, and shortest path ﬁrst (SPF) calculations?
a. debug ip packets
b. debug ip ospf events
c. debug ospf events
d. debug ospf packets
The answers to this quiz are found in Appendix A, “Answers to Chapter ‘Do I Know This Already?’ Quizzes and Q&A Sections.” The suggested choices for your next step are as follows:
■ 8 or less overall score— Read the entire chapter. This includes the “Foundation Topics” and “Foundation Summary” sections, the “Q&A” section, and the “Scenarios” at the end of the chapter.
■ 9–11 overall score— Begin with the “Foundation Summary” section, and then go to the “Q&A” section and the “Scenarios” at the end of the chapter. If you have trouble with these exercises, read the appropriate sections in “Foundation Topics.”
■ 12 or more overall score— If you want more review on these topics, skip to the “Foundation Summary” section, and then go to the “Q&A” section and the “Scenarios” at the end of the chapter. Otherwise, move to the next chapter.
224 Chapter 7: Configuring OSPF in a Single Area
Configuring OSPF in a Single Area
When conﬁguring any device, it is important to establish why you are conﬁguring the system and what you are trying to achieve.
This section examines the conﬁguration of a Cisco router for OSPF within a single area. The commands are few and simple; the implications are somewhat more difﬁcult.
This section covers the following:
■ Conﬁguration of OSPF
— Required conﬁguration
— Optional conﬁguration
— What each conﬁguration command achieves
— How the conﬁguration command achieves its goal
Required Commands for Configuring OSPF on an Internal Router
In this chapter, you learn to conﬁgure an internal router within a single area. An internal router is one that is within an area and whose sole function for OSPF is to route trafﬁc within the area.
The router needs to understand how to participate in the OSPF network. Therefore, it requires the following:
■ The OSPF process —The routing protocol needs to be started on the router.
■ Participating router interfaces —The router might not want to have all its interfaces send or receive OSPF routing updates. A classic example is a dialup line to a remote ofﬁce. If there is only one subnet at the remote ofﬁce, it would be more efﬁcient to use default and static route commands, because any updates would dial the line.
■ Identification of the area —The router deﬁnes which area it is in on a per-interface basis.
■ A router ID (RID)—This allows the router to be identiﬁed by the other routers in the network. The algorithm used to create the routing table builds a graph from a single point. IP addresses are usually assigned to interfaces, so the router needs to assign an IP address to represent the router itself; this is the RID. The ID of the router advertising a link is used to determine the next logical hop, for example, if that link is used in the path selection to a remote network.
The following two commands are required for conﬁguring OSPF on a single internal router:
■ router ospf process-number command
■ OSPF network command
Enabling the OSPF Routing Protocol
When conﬁguring the router for the ﬁrst time, there is no IP routing protocol running on the Cisco router (unless the SETUP script is used). This is not true of other protocols, however; for example, if an IPX network address is conﬁgured on an interface, the IPX RIP process will be automatically started.
To conﬁgure OSPF as the routing protocol, use the following command:
Router(config)#rroouutteerr oossppff process-number
Here, process-number is a number local to the router. It is possible to have more than one process running on a router, although this is an unusual and expensive conﬁguration in terms of router resources. Repeating the command with another ID number will create another process. One possible scenario for this conﬁguration is a service provider that wants to separate its OSPF domain from its customer.
The process number does not have to be the same on every router in the area or the autonomous system. In the interest of sanity, however, many administrators make it the same number.
NOTE A common error in conﬁguration is to confuse the process ID with the RID or the area ID. These are not related in any way. The process ID is simply a mechanism to allow more than one process to be conﬁgured on a router. The RID is the mechanism by which a router is identiﬁed within the OSPF domain, and the area ID is a mechanism of grouping routers that share full knowledge of OSPF-derived routes within the OSPF domain.
Enabling the OSPF network Command
Although you have turned on OSPF, it has no information about how to operate. The networks that are to participate in the OSPF updates, and the area that they reside in, must be deﬁned. If the following information is not speciﬁed, the process will have nothing to do:
Router(config-router)#nneettwwoorrkk network-number wildcard-mask aarreeaa area-number
This command deserves a moment’s explanation because it is the cause of many errors in conﬁguration.
The network command in OSPF plays a similar role to that of the network command in RIP or IGRP. The difference is the level of granularity afforded to the administrator. In RIP and IGRP, the network command is deﬁned at the class level. In OSPF, it is possible to identify the speciﬁc address of an interface.
The additional parameter area states the area that the interface inhabits. This allows a router to have different interfaces in different areas, making it an area border router (ABR). The area-number is a 32-bit ﬁeld and the format can take one of two forms: The ﬁrst is a simple decimal, and the second is a dotted decimal format similar to that of an IP address. Some implementations of OSPF might only understand one of the formats, but Cisco will accept either form.
However, it is important to remember that decimal and dotted decimal use different numbering systems. For example, while 0.0.0.5 and 5 are the same, the area 0.0.4.6 is equivalent to 1030 in decimal. The dotted decimal notation is a stream, which you should think of as a continuation of the binary numbers; it does not start again as in an IP address. So the decimal number 1030 is
What the network Command Will Do
After the network command has been entered, OSPF identiﬁes which interfaces are participating in OSPF by comparing the interface IP address with the address given in the network command, ﬁltered through the wildcard mask. The wildcard mask states how much of the address to pay attention to. The wildcard mask could look at just the class of address, such as everything in network 10.0.0.0, for example. At the other extreme, the mask can be more speciﬁc and identify an interface address. All interfaces that match the given network number will reside in the area speciﬁed in the network command.
CAUTION Take great care in choosing the wildcard mask. Remember that it follows the same format as the wildcard mask in an access list. It is extremely easy to make errors in the conﬁguration, and those errors might be difﬁcult to ﬁnd.
After identifying the interfaces on the router that are participating in the OSPF domain, the following happens.
1. Updates will be received on the interface.
2. Updates will be sent out of the interfaces.
3. The interface will be placed in the deﬁned area.
4. If appropriate, the Hello protocol will be propagated. Depending on the interface type, a default hello and dead interval are deﬁned based on the OSPF network type.
This network command has many of the same characteristics as an access list. The wildcard mask has the same format and enables you to group interfaces into an area. It follows the same top-down logic of a link list, as seen in an access list.
NOTE If there are stub networks connected to a router, it is useful to issue the command redistribute connected subnets . This command is issued as part of the router process conﬁguration, and it includes the connected subnets in OSPF advertisements without actually running OSPF on them. This is very useful for real OSPF conﬁgurations, particularly those that involve WAN pay-per-packet, low-bandwidth links.
The following examples show how one command can cover all router interfaces, and also how each individual interface can be speciﬁed.
Given a router with six interfaces, three with addresses in the 10.0.0.0 class and three with addresses
in the 172.16.0.0 class, the following would conﬁgure all interfaces to participate in OSPF area 0:
Router(router-config)#nneettwwoorrkk 00..00..00..00 225555..225555..225555..225555 aarreeaa 00
The following would have only the interfaces addressed from 10.0.0.0 participating in OSPF area 0:
Router(config-router)#nneettwwoorrkk 1100..00..00..00 00..225555..225555..225555 aarreeaa 00
The next example shows only two speciﬁc interfaces participating in OSPF area 0:
Router(config-router)#nneettwwoorrkk 1100..1122..00..11 00..00..00..00 aarreeaa 00
Router(config-router)#nneettwwoorrkk 117722..1166..1155..11 00..00..00..00 aarreeaa 00
Why Is the network Command so Complex?
It is reasonable to ask why OSPF is so much more complex than either IGRP or RIP in this instance. The answer is that the level of precision available in the OSPF network command provides the capability to place different interfaces into different areas on the same router. The need for this complexity is not obvious in this example because an internal router is being conﬁgured within a single area.
The ﬂexibility in deﬁning which interfaces reside in which area is considered in Chapter 9, “Conﬁguring OSPF Across Multiple Areas,” in the section “Required Conﬁguration Commands for a Multiarea OSPF Network.”
Options for Configuring OSPF on an Internal Router
The following options are not necessary to make OSPF function properly within an area. However, they might be useful in your network design:
■ The loopback interface
■ The cost command
■ The priority command
■ The RID
The following sections describe each option in more detail.
The Loopback Interface and the Router ID
The router needs an ID to participate in the OSPF domain. The RID is used to identify the source of LSA updates as shown in the OSPF database. This ID takes the form of an IP address. The address can be either deﬁned by the administrator or left to the whim of the router. Most people deﬁne the ID so that it is easier to track events in the network, for internal documentation, and for other systemadministration purposes.
The use of loopback interface addresses is often used to deﬁne the RID, as described in the following section. A loopback interface is a virtual interface, which has the advantage of never going down because it has no physical characteristics.
The Default Router ID Selection
The most common method of deﬁning the RID is to use the defaults offered by Cisco. The default RID is taken from the highest IP address assigned to a loopback interface. If no loopback is deﬁned, then OSPF takes the highest IP interface address as the RID.
If no ID is stated, the router will take the highest IP address conﬁgured on a loopback interface. Although it is unlikely that this address will change, it is possible. From an administrative viewpoint, such a change would introduce an unnecessary level of chaos into the network.
Manual Configuration of Router ID
The command to deﬁne the OSPF RID is within the router conﬁguration. If there is no RID deﬁned, there are other methods. The Cisco rule states that the RID will be taken from the address of the loopback interface. If no loopback interface is deﬁned, it uses the highest IP address of the active interfaces conﬁgured on the router.
Once the RID of the router has been chosen, the RID is not dependent on whether the interface is active or even functional until the router is rebooted. At that point, a different RID would be chosen from the active IP addresses. This could break some OSPF conﬁgurations, such as virtual links. You are therefore advised to conﬁgure the loopback interface. Because a virtual interface does not exist physically, it can never go down. Therefore, the OSPF RID is not vulnerable to hardware interface problems if the router reboots.
It is possible to have multiple loopback interfaces, in which case the loopback interface with the highest IP address will be selected if no RID has been conﬁgured. Many organizations choose a different addressing scheme for the loopbacks to distinguish them easily when troubleshooting. Remember that each interface requires a separate subnet. The use of a private address from RFC 1918 might be wise. Private addresses will not deplete the IANA address that is being used by the organization and have the advantage of being easily distinguished for administrative documentation.
The following shows how to conﬁgure the RID:
Router(config-router)# rroouutteerr–iidd ip-address
The following shows how to conﬁgure a loopback interface:
Router(config)# iinntteerrffaaccee llooooppbbaacckk interface-number
Router(config-if)# iipp aaddddrreessss ip-address subnet-mask
NOTE When designing a network, consider whether to include the loopback interface address in the network commands. There are both advantages and disadvantages to this, and they should be researched in any network design. If the organization is running out of valid addresses, it might be advisable to use the loopback address only as an RID and not to insert it into the routing table. The disadvantage of this conﬁguration is that it cannot be pinged for testing. This is known as a bogus RID. The preferred conﬁguration would be to have an address in the routing table. These addresses are assigned a /32 subnet mask.
Changing the Default Metric Using the cost Command
Another command that might be useful is the cost command. This command manually overrides the default cost that the router assigns to the interface. The default cost is calculated based on the bandwidth parameter assigned to the outgoing interface with the bandwidth command.
The cost command syntax is as follows:
Router(config-if)# iipp oossppff ccoosstt cost
A lower cost increases the likelihood that the interface will be selected as the best or shortest path. The range of values conﬁgurable for the cost of a link is 1 to 65535.
In general, the path cost in Cisco routers is calculated using the formula 108/bandwidth. Table 7-2 shows examples of default costs.
NOTE Serial lines have many different speeds. The default bandwidth is 1.544 Mbps. If the line is a slower speed, use the bandwidth command to specify the real link speed. The cost of the link will then change to correspond to the bandwidth that you conﬁgured.
As shown in Table 7-2, the calculation of bandwidth gives FDDI a metric of 1. If you have multiple links with high bandwidth, you might want to have a higher number than the default cost in order to differentiate the cost on those links.
It is also possible to control how OSPF calculates default metrics for the interface. Use the ospf auto-cost reference-bandwidth router global conﬁguration command to change the numerator of the previous OSPF cost formula:
Any change using the ospf auto-cost reference-bandwidth command should be done on all routers in the autonomous systems so that they all use the same formula to calculate cost. The value set by the ip ospf cost command overrides the cost resulting from the auto-cost reference-bandwidth command.
In some of the Cisco IOS software documentation, the auto-cost command is documented as ospf auto-cost. However, auto-cost is the actual command in the Cisco IOS. Check the command reference set for the command for your IOS version.
Considerations in using the cost command include the following:
■ Never change defaults unless you can explain why the change is necessary. Reasons for using the cost option in OSPF include the following:
— You want to maintain interoperability among different vendors running OSPF.
— There is a design reason to choose a different path than the one selected by the Cisco default metric.
— You want to allow greater granularity in the application of the cost metric.
■ If you override the default by manual conﬁguration, it is important that you consider the physical and logical topology map of the network. Any change to the metric
might change the trafﬁc patterns in the network.
Determining the Designated Router Using the priority Command
The last optional command to consider is the priority command. You use this command to determine the designated router (DR) and backup designated router (BDR) on a multiaccess link. Remember that the Hello protocol carries the priority ﬁeld and is the mechanism by which the DR and BDR are elected. To be “up for election,” the priority must be a positive integer between 1 and 255. If the priority is 0, the router cannot participate in the election. The higher the priority, the greater the likelihood of being elected. If no priority is set, all Cisco routers have a default priority of 1, and the highest RID is always used as a tiebreaker.
Reasons for increasing the router priority include the following:
■ The router has greater CPU and memory than the others do on the LAN.
■ The router is the most reliable router on the segment.
■ All the other routers on the LAN connect to stub networks. They all form the access layer of the network.
■ There are point-to-multipoint connections in an NBMA cloud, and the hub router needs to be conﬁgured as the centralized resource, requiring it to be the DR.
■ The router is an ABR, and you do not want it to consume more resources as a DR, so another router on the subnet either has its priority increased or the ABR has its priority decreased. The following section shows these commands in context to make their use and functionality much more apparent.
A Working Configuration of OSPF on a Single Router
Example 7-1 is a working conﬁguration of OSPF on a single router. Use this example in conjunction with Figure 7-1.
The San Jose router is selected as the DR, after its priority is set to 100, and the cost of the fast Ethernet interface is set to 10, overriding the default cost.
Example 7-1 Configuring OSPF