An Introduction to OSPF

42
101 F O U R An Introduction to OSPF We have arrived at the last interior routing protocol that we will cover. Understanding EIGRP as an ad- vanced distance vector protocol allows us to begin studying Open Shortest Path First, or OSPF, a link state protocol. EIGRP and OSPF share common traits of link state protocols, including using HELLO packets to estab- lish neighbors and advertising topology changes as they occur instead of sending the entire routing table on a periodic basis. In this chapter, we will examine the features and how to configure OSPF in a small net- work. After the groundwork has been laid, we will move into more advanced areas in the next chapter. OSPF Overview EIGRP is a very nice protocol to run in a large network. However, it suffers from one serious drawback: it is propri- etary to Cisco. If we have an internetwork with mixed ven- dor equipment, then OSPF is the answer. Established in 1988, OSPF has undergone one major version change and is In This Chapter OSPF Overview Operations Configuring OSPF WAN Connectivity ch04.qxd 11/14/2000 9:36 AM Page 101

Transcript of An Introduction to OSPF

101

F O U R

AnIntroduction to OSPF

We have arrived at the last interior routing protocolthat we will cover. Understanding EIGRP as an ad-vanced distance vector protocol allows us to beginstudying Open Shortest Path First, or OSPF, a link stateprotocol. EIGRP and OSPF share common traits of linkstate protocols, including using HELLO packets to estab-lish neighbors and advertising topology changes asthey occur instead of sending the entire routing tableon a periodic basis. In this chapter, we will examinethe features and how to configure OSPF in a small net-work. After the groundwork has been laid, we willmove into more advanced areas in the next chapter.

OSPF Overview

EIGRP is a very nice protocol to run in a large network.However, it suffers from one serious drawback: it is propri-etary to Cisco. If we have an internetwork with mixed ven-dor equipment, then OSPF is the answer. Established in1988, OSPF has undergone one major version change and is

In This Chapter

� OSPF Overview

� Operations

� Configuring OSPF

� WAN Connectivity

ch04.qxd 11/14/2000 9:36 AM Page 101

currently a version 2 protocol as established through RFC 2328. It is an inte-rior routing protocol like EIGRP, IGRP, and RIP. Also like RIP, OSPF worksinside a single Autonomous System (AS). OSPF is a link state protocol, whichmeans it has a complete birds-eye view of the network and can make routingdecisions at each router almost immediately upon a topology change. OSPF isa Transport-layer protocol (see Table 4-1 for comparisons).

OSPF is a very large and complex protocol. Even spending two chapters on it in this book will not reveal all of its capabilitiesand complexities. For more information, refer to RFC 2328.

102 Chapter 4 • An Introduction to OSPF

TABLE 4–1 Routing Protocol Layers and Protocol/Ports

Protocol Layer Protocol Number Port Number

RIP Application UDP 520

IGRP Transport 9

EIGRP Transport 88

OSPF Transport 89

BGP Application TCP 179

OSPF comes with many features that make it more desirable than run-ning RIP in large networks. Since OSPF is a link state protocol, each routerperforms Link State Advertisements (LSAs) to synchronize all routers in theAS. This leads to a faster convergence than RIP by allowing each router tomake decisions for paths to remote networks. In addition, LSAs are multicastonly when a topology change occurs and the LSA only includes informationabout the topology change, whereas RIP broadcasts its entire routing table ona periodic basis. This leads to OSPF taking up less bandwidth on a network,thereby allowing data to flow mostly unobstructed. OSPF supports VLSM forefficient use of network addresses. While RIP has a maximum number ofhops of 15, OSPF has no hop limitation. Finally, OSPF takes into account linkspeed for better path selection instead of simple metrics like RIP’s hop count.The disadvantage to OSPF is that it is a large and complex protocol and assuch takes design and careful planning to implement correctly.

Comparing RIP to OSPF is like comparing a bicycle to a Lamborghini. They both move traffic to remote networks, but OSPF hasfar more features that make it highly desirable. It would be fairer to compare EIGRP and OSPF. So why then do we make thecomparison to RIP? Simply because it is in the exam objectives.

ch04.qxd 11/14/2000 9:36 AM Page 102

Operations

Overview

OSPF is maintained within a single AS. Because of this, extra configuration isrequired to scale OSPF to large networks. This can be accomplished using aninternal organization of routers termed an “area.” For this chapter, we will as-sume that OSPF is running within a single area. The next chapter focuses onusing multiple areas.

Routers configured with OSPF maintain three separate tables similar toEIGRP. The first table, the neighbor table, identifies all the neighbors on thesame physical medium. When the neighbors are discovered, they exchange therouting information in the second table, the topology table. This table lists allthe routers in the network and all the links each has. Based on this information,the routers can then run the Dijkstra algorithm to choose the best path to eachremote network. These paths are then stored in the routing table.

When all routers have reached a converged state, small packets are sentto ensure that all neighbor routers are still operational. When a topologychange occurs, the router detecting the change will flood the announcementto selected routers. These routers will in turn flood the announcement ontoother selected routers until all routers within the network have heard thechange. Finally, all routers will then re-run the Dijkstra algorithm to deter-mine the best available path to the remote network if it is available, or to re-move the unavailable network in the routing table.

This entire process is quick and simple to understand, but the detailsare much more complex. We will break each piece down and discuss it indepth.

Router ID

When OSPF is enabled on a router, the router will find the highest loopbackaddress and that value will become the Router ID. If there is no loopback,then the highest IP address of all active interfaces will become the Router ID.Once a Router ID is chosen, neighbors can be identified with a HELLO packet(next topic).

To examine the process of OSPF, we will use the network as shown inFigure 4-1. This is not a well-designed network (what are we using R1 and R4for anyway?), but it is useful for us to examine the interactions with multiplerouters and OSPF.

We will examine how to turn on OSPF in the next section, but as it isalready turned on with this network, we should be able to identify the RouterIDs for the routers.

Router R1 has two loopback addresses and a physical Ethernet address.All interfaces are up and running. Using the information just learned, the

Operations 103

ch04.qxd 11/14/2000 9:36 AM Page 103

Router ID should be the highest loopback address. We can use the commandshow ip ospf interface to view this information.

R1#sho ip ospf intEthernet0 is up, line protocol is upInternet Address 192.168.1.1/28, Area 0Process ID 100, Router ID 172.16.2.1, Network Type BROADCAST, Cost: 10

<lines deleted>

In the highlighted portion, we can see that the higher loopback addresswas chosen (172.16.2.1, because it is greater than 172.16.1.1). Also note thatthe loopback address is chosen over physical interfaces, even if a physicaladdress is higher in value than the loopback.

For the next router, R2, we only have the Ethernet link enabled whenOSPF is enabled. The output of the show ip ospf interface command is asfollows:

R2#sho ip ospf intEthernet0 is up, line protocol is upInternet Address 192.168.1.2/28, Area 0Process ID 100, Router ID 192.168.1.2, Network Type BROADCAST, Cost: 10

If we bring up the serial link, the Router ID will not change until eitherthe OSPF process is restarted or the router is rebooted. Notice the outputbelow:

R2#sho ip int briefInterface IP-Address OK? Method Status ProtocolEthernet0 192.168.1.2 YES manual up upSerial0 192.168.1.242 YES manual up upSerial1 unassigned YES manual administratively down downTokenRing0 unassigned YES unset administratively down downR2#sho ip ospf int

104 Chapter 4 • An Introduction to OSPF

R2 R3

192.168.1.240 /30

192.168.1.0 /28

R1.1 .2 .3

.242

192.168.1.244 /30

.246

R4.4

Loopback2172.16.2.1 /24

Loopback1172.16.1.1 /24

Loopback3172.16.3.1 /24

FIGURE 4–1 Example network for describing OSPF.

ch04.qxd 11/14/2000 9:36 AM Page 104

Ethernet0 is up, line protocol is upInternet Address 192.168.1.2/28, Area 0Process ID 100, Router ID 192.168.1.2, Network Type BROADCAST, Cost: 10

Serial0 is up, line protocol is upInternet Address 192.168.1.242/30, Area 0Process ID 100, Router ID 192.168.1.2, Network Type POINT_TO_POINT, Cost: 156

Here we can see that Serial0 was brought online, but the Router IDdid not change. Also notice that the Router ID is global to the router, not toany specific interface as shown in the highlighted portions (the Router ID isthe same on all interfaces).

As we bring up R3 with all interfaces enabled, we should see the RouterID is 192.168.1.246, and on R4, the Router ID should be 172.16.3.1:

R3#sho ip ospf intEthernet0 is up, line protocol is upInternet Address 192.168.1.3/28, Area 0Process ID 100, Router ID 192.168.1.246, Network Type BROADCAST, Cost: 10

R4#sho ip ospf intFastEthernet0/0 is up, line protocol is downInternet Address 192.168.1.4/28, Area 0Process ID 100, Router ID 172.16.3.1, Network Type BROADCAST, Cost: 10

Once a router has a Router ID, it can identify itself on the network. Itwill then begin searching for neighbors.

Establishing Neighbors

Routers that are running OSPF must first discover neighbor routers throughthe use of a HELLO packet. A HELLO packet is a small, multicast packet that issent with the address of 224.0.0.5, also called AllSPFRouters. HELLO packetsare generated every 10 seconds on a multi-access network and every 30 sec-onds on an NBMA network. The use of HELLO packets is performed using theHello protocol.

Each HELLO packet includes information that is needed for neighbors tocommunicate. The HELLO packet structure is shown in Figure 4-2. The HELLOpacket fields are described as follows:

• The Version Number field indicates the version of OSPF (the latest ver-sion is 2).

• The Type field of 1 indicates that this is a HELLO packet. All OSPF pack-ets share the same first 24 bytes (indicated by the darker border), so thisfield is necessary to determine how to process this packet.

• The Packet Length is the length of the entire packet.• The Router ID is used to help determine which router starts different

processes. It is also used as a tiebreaker. We will see more of this shortly.• The Area ID is used to indicate which area this packet belongs to and to

determine if the router should process it or not. We will look at multipleareas in the next chapter, but for this chapter, all routers belong to Area 0.

Operations 105

ch04.qxd 11/14/2000 9:36 AM Page 105

• The FCS is for generating checksum values for error detection.• The Authentication Type and Authentication fields are used to enable

authentication between routers. This can be accomplished with thearea authentication command in OSPF router configuration.

• The Network Mask field is used to identify the subnet mask of the send-ing router.

• The Hello Interval is used to specify how often this HELLO packet willbe sent out.

• The Dead Interval is used to specify how long a HELLO packet can bemissed before marking a neighbor router as dead. The default value ofthis field is four times the Hello Interval. For broadcast networks likeEthernet, the Dead Interval is 40 seconds.

• The Options field is used to define how LSAs are flooded. Only one ofthese five bits, the E bit, is discussed in this book. This bit identifies ifthis LSA packet should be flooded into a stub area. We will examinestub areas in the next chapter.

• The Priority field is used to notify neighbor routers how this routershould be treated in a Designated Router/Backup Designated Routerelection. We will examine this in more detail shortly.

• The Designated Router (DR) and Backup Designated Router (BDR)fields identify the DR and BDR, respectively, for each network segment.

• Finally, all routers that have sent out a HELLO packet heard by thisrouter will be listed in the Neighbor Router ID fields.

Note that all the fields identified with an asterisk must be the same onall neighbor routers for an adjacency to be established.

106 Chapter 4 • An Introduction to OSPF

0 7 8 15 16 31

Version Number Type Packet LengthRouter IDArea ID *

FCS Authentication Type *Authentication (Optional) *Authentication (Optional) *

Network MaskHello Interval * Options * Priority

Dead Interval *Designated Router

Back Designated RouterNeighbor Router ID

. . .Neighbor Router ID

FIGURE 4–2 HELLO packet structure.

ch04.qxd 11/14/2000 9:36 AM Page 106

When a router first comes online, it sends out a HELLO packet without anyNeighbor Router ID fields (Figure 4-3). This in essence says, “Is anyone outthere?” Since it knows of no neighbors, the router is said to be in the down state.

When R2 receives the HELLO packet, it identifies this router as a neigh-bor and adds it to its neighbor table. Included within this table is the interfacethat is connected to the neighbor. In our example, R2 will add R1 to theneighbor table as being reachable through its E0. R2 enters an INIT state, in-dicating that it now knows of a neighbor. The next HELLO packet that is sentout (Figure 4-4) includes a new entry in the packet: Neighbor Router ID. Thisfield identifies the neighbor by Router ID.

Operations 107

Router ID:172.16.2.1

R1 R2

Router ID:192.168.1.2

Router ID:172.16.2.1*Area: 0.0.0.0*Hello Interval: 10*Options: No StubPriority: 1*Dead Interval: 40DR: 0.0.0.0BDR: 0.0.0.0

HELLO PacketSent to 224.0.0.5

E0 E0

FIGURE 4–3 Start of the HELLO protocol - Down state.

Router ID:172.16.2.1

R1 R2

Router ID:192.168.1.2

Router ID:192.168.1.2*Area: 0.0.0.0*Hello Interval: 10*Options: No StubPriority: 1*Dead Interval: 40DR: 0.0.0.0BDR: 0.0.0.0Neighbor: 172.16.2.1

HELLO PacketSent to 224.0.0.5

E0 E0

FIGURE 4–4 HELLO protocol - INIT state.

ch04.qxd 11/14/2000 9:36 AM Page 107

When R1 receives the HELLO packet, it processes all the information in-side of it. It stores the information about the sending router (R2) in its neigh-bor table. As it parses through the Neighbor Router ID entries, if it sees itsown Router ID, it knows that the router it received this HELLO packet from isa neighbor. In this example, the only entry in the Neighbor Router ID is itsown Router ID. R1 will now enter into a new state, the 2WAY state.

The next HELLO packet that R1 sends will include the Router ID of R2 inthe Neighbor Router ID field (Figure 4-5). This allows R2 to also enter the 2WAYstate. At this point, R1 and R2 have entered into a bi-directional adjacency.

In a converged state, all routers should be in 2WAY state at a minimum.As we continue through the chapter, we will see that there are other states aswell. Both routers will continue to send HELLO packets based on the Hello In-terval to ensure the neighbors have not disappeared.

Electing the DR and BDR

Link state protocols work by sending updates to all routers when a topologychange occurs. More specifically, they send updates to all neighbors on all in-terfaces. As a network grows in size, the number of LSAs that are sent can betremendous. To keep each router synchronized with all other routers, eachrouter would have to propagate the information learned to all neighbors (ex-cept the ones it learned from using Split Horizon techniques). In Figure 4-6,we can see a single Ethernet segment with five routers attached to it and thetype of traffic that can be generated.

OSPF was designed with this problem in mind. To help reduce traffic, aDesignated Router (DR) for each multi-access segment is elected. Instead of

108 Chapter 4 • An Introduction to OSPF

Router ID:172.16.2.1

R1 R2

Router ID:192.168.1.2

Router ID: 172.16.2.1*Area: 0.0.0.0*Hello Interval: 10*Options: No StubPriority: 1*Dead Interval: 40DR: 0.0.0.0BDR: 0.0.0.0Neighbor:192.168.1.2

HELLO PacketSent to 224.0.0.5

E0 E0

FIGURE 4–5 Hello protocol–2WAY state.

ch04.qxd 11/14/2000 9:36 AM Page 108

each router telling each neighbor, a router detecting the change will tell theDR. The responsibility then lies with the DR to ensure that all neighbors onthe segment receive the update (Figure 4-7).

As we can see, the amount of traffic on this network is much less thanwithout a DR. To speed up convergence in the event of a failure of the DR, thereis a Backup Designated Router (BDR) elected as well. The BDR hears all thesame UPDATEs as the DR and therefore has an exact copy of the tables.

To be elected the DR, the highest Router ID is chosen when OSPF isfirst enabled on the network. As routers come online for the first time, thereis a WAIT interval that they will wait before performing the election. TheWAIT interval is the same as the router Dead Interval. Referring to Figure 4-8,the two routers have exchanged HELLO packets and are both in the 2WAYstate. After 40 seconds have passed (the default interval of a multi-access net-work), the sending router will look in its neighbor table and find the highest

Operations 109

Ethernet

X

FIGURE 4–6 A single topology change creates a lot of traffic.

Ethernet

X

DR

FIGURE 4-7 Using a Designated Router (DR) to update neighbors.

ch04.qxd 11/14/2000 9:36 AM Page 109

Router ID. That router will be selected as the DR. The router will then choosethe next highest Router ID as the BDR.

Now that there is a DR and BDR on the network, when a new routercomes online with OSPF, it will send out a HELLO packet with the DR andBDR fields set to 0.0.0.0 and start its WAIT timer. However, when a HELLOpacket is received from the first neighbor, the DR and BDR fields will alreadybe filled in. This tells the new router that no election is necessary.

As we can see in Figure 4-9, when a new router comes online, even if ithas a higher Router ID than the current DR or BDR, no election will take place.

110 Chapter 4 • An Introduction to OSPF

Router ID:172.16.2.1

R1 R2

Router ID:192.168.1.2

Router ID:192.168.1.2*Area: 0.0.0.0*Hello Interval: 10*Options: No StubPriority: 1*Dead Interval: 40DR: 192.168.1.2BDR: 172.16.2.1Neighbor: 172.16.2.1

HELLO PacketSent to 224.0.0.5

E0 E0

FIGURE 4–8 Electing the DR and BDR.

Router ID:172.16.2.1

R1 R2

Router ID:192.168.1.2

Router ID:192.168.1.2*Area: 0.0.0.0*Hello Interval: 10*Options: No StubPriority: 1*Dead Interval: 40DR: 192.168.1.2BDR: 172.16.2.1Neighbor: 172.16.2.1

HELLO PacketSent to 224.0.0.5

E0 E0R3

Router ID:192.168.1.246

FIGURE 4–9 No election necessary when new router comes online.

ch04.qxd 11/14/2000 9:36 AM Page 110

What happens if the DR fails? The BDR will notice the router’s Dead In-terval timer expire and will send an update that it is now the DR. Since it hasan exact copy of the database, there is no need for all the neighbor routers toresend their link state information. The BDR will examine its neighbor tableand choose the next highest Router ID to become the BDR.

There are times when we need to control which routers become the DRand BDR. These routers have higher performance requirements because ofthe extra processing and size of tables they must maintain. Although we canuse loopback addresses on each router, this leads to extra maintenance.OSPF has designed a mechanism called the priority that defines which routershould be the DR. The priority value is preferred over Router IDs, and therouter with the highest priority upon initialization of OSPF on a segment willbe elected the DR. The next highest priority router will be the BDR. Ties arealways broken with the highest Router ID. A priority of 0 indicates that arouter should never be a DR or BDR. The default is 1.

In Figure 4-10, if all routers are initialized at the same time, R4 would bethe DR because it has the highest priority. R2 would never be the DR or BDRbecause of its priority, 0. Finally, R1 and R3 have the same priority, so therouter with the higher Router ID will be chosen BDR. In this case, R3 will be-come the BDR.

Configuring OSPF

Although we haven’t finished examining the operations of OSPF, we haveenough information to start configuring our routers. We will start with a smallnetwork (Figure 4-11) and build it in stages, examining the features we havediscussed so far.

We are going to only bring up R1 and R2 first. We want to do both ofthem as close together as possible so that we can see some of the states usingthe command show ip ospf neighbor.

The first step is to enter OSPF router configuration mode. This is thesame as entering configuration mode for EIGRP, IGRP, and RIP. However,OSPF requires a Process ID. This Process ID is local to the router and allowsus to have multiple OSPF instances running. This is usually not a good prac-tice, however, as it requires a much larger router to handle all the OSPF

Configuring OSPF 111

Router ID:172.16.2.1Priority: 1

R1 R2

Router ID:192.168.1.2Priority: 0

R3

Router ID:192.168.1.246

Priority: 1

Router ID:172.16.3.1Priority: 3

R4

FIGURE 4–10 Electing the DR and BDR with priority values.

ch04.qxd 11/14/2000 9:36 AM Page 111

traffic and processing. Since it is locally significant, the Process ID can be dif-ferent on each router. It is common practice to use the same Process ID sothat it is easier to manage multiple routers without having to worry about ac-cidentally creating a new OSPF process.

R1(config)#int loopback1R1(config-if)#ip addr 172.16.1.1 255.255.255.0R1(config-if)#int lo2R1(config-if)#ip addr 172.16.2.1 255.255.255.0R1(config-if)#int e0R1(config-if) ip addr 192.168.1.1 255.255.255.240R1(config-if)#no shutR1(config-if)#exitR1(config)#router ospf ?<1-65535> Process ID

R1(config)#router ospf 100R1(config-router)#network ?A.B.C.D Network number

R1(config-router)#network 192.168.1.0 ?A.B.C.D OSPF wild card bits

R1(config-router)#network 192.168.1.0 0.0.0.255 ?area Set the OSPF area ID

R1(config-router)#network 192.168.1.0 0.0.0.255 area ?<0-4294967295> OSPF area ID as a decimal valueA.B.C.D OSPF area ID in IP address format

112 Chapter 4 • An Introduction to OSPF

R6

R2 R3

192.168.1.240 /30.241

192.168.1.0 /28

R1.1 .2 .3

.242

.245192.168.1.244 /30

.246

192.168.1.16 /28.17 .18

R4

R5

.4

Loopback2172.16.2.1 /24

Loopback1172.16.1.1 /24

Loopback3172.16.3.1 /24

R7.19

FIGURE 4–11 Sample network for examining OSPF.

ch04.qxd 11/14/2000 9:36 AM Page 112

R1(config-router)#network 192.168.1.0 0.0.0.255 area 0 ?<cr>

R1(config-router)#network 192.168.1.0 0.0.0.255 area 0

Once in OSPF router configuration mode, we issue the various networkcommands to enable those interfaces. With OSPF, we use wildcard maskingto identify all the networks. Here we chose the wildcard mask of 0.0.0.255to enable all interfaces in the 192.168.1.0/24 network. Also notice the key-word area. This keyword is required and is used to set the area in the HELLOpackets. Remember that for neighbor adjacencies to be created, neighborsmust be in the same area.

R2’s configuration is very similar:

R2(config)#int e0R2(config-if)#ip addr 192.168.1.2 255.255.255.240R2(config-if)#no shutR2(config-if)#int s0R2(config-if)#ip addr 192.168.1.242 255.255.255.252R2(config-if)#router ospf 100R2(config-router)#network 192.168.1.0 0.0.0.15 area 0R2(config-router)#network 192.168.1.240 0.0.0.3 area 0

In this example, we used two different network statements. We couldhave done the same as R1, but we did this just to show how to enable spe-cific subnets on a single router.

If we are quick enough, we can see all the OSPF states of the routerswith the command show ip ospf neighbor:

R2#sho ip ospf nei

Neighbor ID Pri State Dead Time Address Interface172.16.2.1 1 INIT/DROTHER 00:00:39 192.168.1.1 Ethernet0R2#sho ip ospf nei

Neighbor ID Pri State Dead Time Address Interface172.16.2.1 1 2WAY/DROTHER 00:00:39 192.168.1.1 Ethernet0

R2#sho ip ospf nei

Neighbor ID Pri State Dead Time Address Interface172.16.2.1 1 FULL/BDR 00:00:37 192.168.1.1 Ethernet

Examining these statements shows us when this router received the firstHELLO packet from R1. It went into an INIT state and sent out a HELLO packetlisting 172.16.2.1 as a neighbor. When R2 heard the next HELLO packet, itfound its own Router ID in the neighbor list, which allowed it to move to the2WAY state. Notice the word DROTHER. This indicates that 172.16.2.1 is some-thing other than a DR or BDR. After the election took place, we see that R1became the BDR.

Configuring OSPF 113

ch04.qxd 11/14/2000 9:36 AM Page 113

If we examine the neighbor table on R1, we should see R2 listed as theDR:

R1#sho ip ospf nei

Neighbor ID Pri State Dead Time Address Interface192.168.1.242 1 FULL/DR 00:00:36 192.168.1.2 Ethernet0

As a review, notice the Router ID (Neighbor ID) of each router. R1 hasthe highest loopback address of 172.16.2.1, and R2 has the highest physicaladdress of 192.168.1.242.

Next, we bring up R3. This time we will use the network command tospecify an exact interface:

R3(config)#int s0R3(config-if)#ip addr 192.168.1.246 255.255.255.252R3(config-if)#no shutR3(config-if)#int e0R3(config-if)#ip addr 192.168.1.3 255.255.255.240R3(config-if)#no shutR3(config-if)#router ospf 100R3(config-router)#network 192.168.1.3 0.0.0.0 area 0

Notice the use of the network command. We have specified the exactinterface to turn on this time. We can use any and all of these various optionsto customize OSPF on each router.

Now that R3 is enabled, we should see almost immediately (within fiveseconds) all of the neighbors:

R3#sho ip ospf nei

Neighbor ID Pri State Dead Time Address Interface192.168.1.242 1 FULL/DR 00:00:39 192.168.1.2 Ethernet0172.16.2.1 1 FULL/BDR 00:00:35 192.168.1.1 Ethernet0

We have established full adjacencies with both the DR and BDR. If weexamine the neighbor table a little quicker, we may see other states. Not toworry, though, we will examine those other states shortly. Notice that eventhough this router has a higher Router ID (192.168.1.246), there is no electionperformed because there is already a DR and BDR available.

Next, we will bring up R4. This time, however, we want it to have a pri-ority of 3 so that it will be the DR. At the same time, we will set the priorityof R2 to 0 so that it will never become the DR or BDR:

R4(config)#int lo3R4(config-if)#ip addr 172.16.3.1 255.255.255.0R4(config)#int fa0/0R4(config-if)#ip addr 192.168.1.4 255.255.255.240R4(config-if)#ip ospf priority 3R4(config-if)#no shut

114 Chapter 4 • An Introduction to OSPF

ch04.qxd 11/14/2000 9:36 AM Page 114

R4(config-if)#router ospf 100R4(config-router)#network 192.168.1.0 0.0.0.255 area 0

R2(config)#int e0R2(config-if)#ip ospf pri 0

Notice that we change the priority on the interface itself. This allows usto select a router to be a DR or BDR on one segment, and on a different net-work segment, we can set it to never be a DR or BDR.

Examining the neighbor table from R4 reveals the following:

R4#sho ip ospf nei

Neighbor ID Pri State Dead Time Address Interface172.16.2.1 1 FULL/BDR 00:00:36 192.168.1.1 FastEthernet0/0192.168.1.242 1 FULL/DR 00:00:39 192.168.1.2 FastEthernet0/0192.168.1.246 1 2WAY/DROTHER 00:00:33 192.168.1.3 FastEthernet0/0

Here we have established full adjacencies with the DR and BDR, butnot with the other neighbor (R3). This adjacency will stay in the 2WAY stateuntil R3 (or this router) becomes a DR or BDR. In a 2WAY state, routers willnever exchange topology updates between them. Instead, the updates will goto the DR and BDR. In turn, the DR will send updates to all neighbors. There-fore, all neighbors on a segment must establish a full adjacency with the DRand BDR, and only 2WAY states with all other neighbors.

One final note to make is that the DR and BDR did not change evenwhen another router came online with a higher priority. Again, the only timethat a new election will occur is in the event of a DR or BDR failure. To es-tablish this network the way we want, we will reboot all four routers to-gether. Our new DR should then be R4 and the BDR should be R3 (becauseof the higher Router ID).

R2#sho ip ospf nei

Neighbor ID Pri State Dead Time Address Interface172.16.2.1 1 2WAY/DROTHER 00:00:31 192.168.1.1 Ethernet0172.16.3.1 3 FULL/DR 00:00:39 192.168.1.4 Ethernet0192.168.1.246 1 FULL/BDR 00:00:37 192.168.1.3 Ethernet0

As we expected, 172.16.3.1 is the DR and 192.168.1.246 is the BDR. Wewill enable OSPF on the Ethernet segment of R5, R6, and R7, but first weneed to discuss some more theory. Specifically, how do routers exchangerouting information?

Exchange Protocol

Before moving into the exchange protocol that is used to allow OSPF routers toshare topology information, we should do a quick review of the states discussedso far (Figure 4-12). A router begins in the Down state, indicating it is coming

Configuring OSPF 115

ch04.qxd 11/14/2000 9:36 AM Page 115

online with OSPF enabled. A HELLO packet is sent out looking for a neighbor.When a packet is heard from a new neighbor, as indicated by the lack of the re-ceiving router’s Router ID in the Neighbor Router ID field, the receiving routermoves to the INIT state. It replies with a HELLO packet listing the neighbor’sRouter ID in the Neighbor Router ID field. When the initializing router receivesthe HELLO packet and it sees its own Router ID in the Neighbor Router ID field,it then moves to the 2WAY state. At this point, the routers are ready to exchangeinformation that is stored in their topology tables.

Once the 2WAY state has been reached, the routers will begin to ex-change topology information using the exchange protocol.

Two neighbors that are only in the 2WAY state have formed a minimaladjacency. In fact, according to the RFC documentation, the correct way todescribe this is that the two routers are in bi-directional communication andhave not actually started the establishment of the adjacency. In any event, arouter will begin the exchange process only with the DR and BDR. All otherneighbors will stay in the 2WAY state.

To begin the process, the new router waits for a HELLO packet that hasits own Router ID in the Neighbor Router ID field. When it finds one, therouter then sends out a Database Description (DBD) packet (also known asDDP or DD). The goal of this packet is to decide who should start the ex-change of table information (Figure 4-13). This state is known as the EX-START state. Both routers will send a DBD packet out (unicast directly to theneighbor) as shown in the diagram.

The router with the highest Router ID will become the Master and theother router will become the Slave. The sequence number of the Master willbe used to sequence all DBD packets between it and the Slave. Once theMaster is determined, it then sends a DBD packet that includes summary in-formation about its database (Figure 4-14). This summary information iscalled a Link State Advertisement (LSA), and there may be multiple LSAs

116 Chapter 4 • An Introduction to OSPF

Router ID:172.16.2.1

R1 R2

Router ID:192.168.1.2

Router ID: 172.16.2.1

HELLO Packets Sentto 224.0.0.5

E0 E0

Down State

Router ID:192.168.1.2Neighbor: 172.16.2.1

INIT State

Router ID: 172.16.2.1Neighbor: 192.168.1.2

2WAY State

FIGURE 4–12 Initial router states.

ch04.qxd 11/14/2000 9:36 AM Page 116

within the DBD. The summary information includes link (a network connec-tion) or network information and the advertising router that has that informa-tion. This process of the Master sending the DBD is called polling.

The Slave will then reply with a DBD of its own, describing the informa-tion it has in its table. This process is the response to the poll. The sequencenumber is the same as that sent by the Master as an acknowledgement receiptof the DBD. Since there may be more entries than can fit into a single DBD, thisprocess continues until both the Master and the Slave have exchanged all of thesummary information. When the final acknowledgement is received, the routerswill then examine the information retrieved and compare it with their own in-formation. Any summary information that is newer than information stored intheir own table causes that router to query the other router for more specific de-tails. This type of packet is known as a Link State Request (LSR).

As the routers exchange information with each other via LSRs, therouters move to the LOADING state (Figure 4-15). Each LSR can include mul-tiple LSAs that the router wishes to know about. This process continues backand forth between the routers, exchanging as many LSRs as necessary to

Configuring OSPF 117

Router ID:172.16.2.1

R1 R2

Router ID:192.168.1.2

Router ID: 172.16.2.1Sequence: 8065

E0 E0

EXSTART State

Router ID:192.168.1.2Sequence: 3671

EXSTART State

FIGURE 4–13 EXSTART state - who gets to start the exchange?

Router ID:172.16.2.1

Slave

R1 R2

Router ID:192.168.1.2

Master

E0 E0

Router ID:192.168.1.2Sequence: 3671Link State: Router LinkRouter ID:192.168.1.2

Exchange (Poll)

Router ID: 172.16.2.1Sequence: 3671Link State: Router LinkRouter ID: 172.16.2.1

Exchange (Response)

FIGURE 4–14 EXCHANGE state - here is a summary of what I know.

ch04.qxd 11/14/2000 9:36 AM Page 117

converge the topology table. Notice how each Link State Update (LSU) thatreturns information as requested is acknowledged by the requester. This en-sures that all routers are synchronized with the DR. Any missing UPDATEs willbe resent until an acknowledgement (ACK) is received or the router’s DeadInterval expires.

Finally, when all routers have completed exchanging information, theadjacency is considered to be in the FULL state. The routers are ready toroute with the current information.

We can examine this process by setting up R5, R6, and R7. At this time,we will not enable the serial links. We should find that R7 will be the DR andR6 will be the BDR because of the higher physical Router IDs. This, ofcourse, depends on the routers starting in the correct order.

First, we will configure R7, the DR:

R7(config)#int e0/0R7(config-if)#ip addr 192.168.1.19 255.255.255.240R7(config-if)#no shutR7(config-if)#router ospf 100R7(config-router)#network 192.168.1.19 0.0.0.0 area 0

Again we used the network command to explicitly enable OSPF on theEthernet interface.

Next, we will enable the BDR (R6) and ensure that an adjacency hasbeen established:

118 Chapter 4 • An Introduction to OSPF

Router ID:172.16.2.1

Slave

R1 R2

Router ID:192.168.1.2

Master

E0 E0

Router ID: 192.168.1.2Link State Request for172.16.2.1

Router ID: 172.16.2.1Link State Update for172.16.2.1

Router ID: 192.168.1.2Link StateAcknowledgment for172.16.2.1Router ID: 172.16.2.1

Link State Request for192.168.1.2 Router ID:

192.168.1.2Link State Update for192.168.1.2Router ID: 172.16.2.1

Link StateAcknowledgment for192.168.1.2

FIGURE 4–15 The Loading state.

ch04.qxd 11/14/2000 9:36 AM Page 118

R6(config)#int e0/0R6(config-if)#ip addr 192.168.1.18 255.255.255.240R6(config-if)#no shutR6(config-if)#router ospf 100R6(config-router)#network 192.168.1.18 0.0.0.0 area 0

R6#sho ip ospf neigh

Neighbor ID Pri State Dead Time Address Interface192.168.1.19 1 FULL/DR 00:00:32 192.168.1.19 Ethernet0/0

R6#sho ip ospf neigh detailNeighbor 192.168.1.19, interface address 192.168.1.19

In the area 0 via interface Ethernet0/0Neighbor priority is 1, State is FULL, 6 state changesDR is 192.168.1.19 BDR is 192.168.1.18Options 2Dead timer due in 00:00:30

We can see that the Neighbor ID of 192.168.1.19 (R7) is the DR andthat this router has reached the FULL state with it. We also looked at a moredetailed examination of the neighbor with the keyword detail. This com-mand lists the DR and BDR values as well as the number of state changes.

Before we enable R5, we are going to enable OSPF debugging so thatwe can see the results of all our hard work learning OSPF:

R5#debug ip ospf ?adj OSPF adjacency eventsdatabase-timer OSPF database timerevents OSPF eventsflood OSPF floodinglsa-generation OSPF lsa generationpacket OSPF packetsretransmission OSPF retransmission eventsspf OSPF spftree OSPF database tree

R5#debug ip ospf adjOSPF adjacency events debugging is on

This command allows us to view OSPF-specific information. We want toview the adjacency creating and exchange process, so we enable adj.

Next, configure the router. We will examine the neighbor table duringthe process, and after reaching the FULL state, we will go back and examinethe debugging output:

R5(config)#int e0R5(config-if)#ip addr 192.168.1.17 255.255.255.240R5(config-if)#no shutR5(config-if)#router ospf 100R5(config-router)#network 192.168.1.17 0.0.0.0 area 0

Configuring OSPF 119

ch04.qxd 11/14/2000 9:36 AM Page 119

R5#sho ip ospf neigh

Neighbor ID Pri State Dead Time Address Interface192.168.1.19 1 2WAY/DROTHER 00:00:39 192.168.1.19 Ethernet0

R5#sho ip ospf neigh

Neighbor ID Pri State Dead Time Address Interface192.168.1.18 1 EXSTART/BDR 00:00:39 192.168.1.18 Ethernet0192.168.1.19 1 EXSTART/DR 00:00:35 192.168.1.19 Ethernet0

R5#sho ip ospf nei

Neighbor ID Pri State Dead Time Address Interface192.168.1.19 1 FULL/DR 00:00:38 192.168.1.19 Ethernet0192.168.1.18 1 FULL/BDR 00:00:38 192.168.1.18 Ethernet0

As we examine the neighbor table, we can see the progression of theadjacencies. Within a few seconds, we establish a FULL adjacency with theBDR and DR. Now, let’s see exactly what happened according to the debug:

1w0d: OSPF: Build router LSA for area 0, router ID 192.168.1.17, seq 0x800000011w0d: OSPF: Rcv hello from 192.168.1.18 area 0 from Ethernet0 192.168.1.181w0d: OSPF: 2 Way Communication to 192.168.1.18 on Ethernet0, state 2WAY

We have just discovered our first neighbor. We have entered the 2WAYstate.

1w0d: OSPF: Backup seen Event before WAIT timer on Ethernet01w0d: OSPF: DR/BDR election on Ethernet01w0d: OSPF: Elect BDR 192.168.1.181w0d: OSPF: Elect DR 192.168.1.181w0d: DR: 192.168.1.18 (Id) BDR: 192.168.1.18 (Id)1w0d: OSPF: Send DBD to 192.168.1.18 on Ethernet0 seq 0x1070 opt 0x2 flag 0x7 len 321w0d: OSPF: End of hello processing

Here we show that the election process has occurred on the router. Atthis point, this router thinks that 192.168.1.18 is the only router on the seg-ment. It sends out a DBD indicating that it will use seq 0x1070 if it is theMaster. We know it should not become the Master because its Router ID islower than R6’s.

1w0d: OSPF: Rcv DBD from 192.168.1.18 on Ethernet0 seq 0x190A opt 0x2 flag 0x7 len 32 mtu 1500 state EXSTART1w0d: OSPF: NBR Negotiation Done. We are the SLAVE1w0d: OSPF: Send DBD to 192.168.1.18 on Ethernet0 seq 0x190A opt 0x2 flag 0x2 len 52

We receive a DBD packet back that tells us the starting sequence is0x190A and that we are now the SLAVE. At this point, we have finished theEXSTART state.

120 Chapter 4 • An Introduction to OSPF

ch04.qxd 11/14/2000 9:36 AM Page 120

1w0d: OSPF: Rcv DBD from 192.168.1.18 on Ethernet0 seq 0x190B opt 0x2 flag 0x3 len 112 mtu 1500 state EXCHANGE1w0d: OSPF: Send DBD to 192.168.1.18 on Ethernet0 seq 0x190B opt 0x2 flag 0x0 len 321w0d: OSPF: Database request to 192.168.1.181w0d: OSPF: sent LS REQ packet to 192.168.1.18, length 48

We have received all the summary information and now we send out arequest for more specific information. This is the LSR packet discussed earlier.

1w0d: OSPF: Rcv DBD from 192.168.1.18 on Ethernet0 seq 0x190C opt 0x2 flag 0x1 len 32 mtu 1500 state EXCHANGE

Here is the LSU being sent to us with more specific information:

1w0d: OSPF: Exchange Done with 192.168.1.18 on Ethernet01w0d: OSPF: Send DBD to 192.168.1.18 on Ethernet0 seq 0x190C opt 0x2 flag 0x0 len 321w0d: OSPF: Synchronized with 192.168.1.18 on Ethernet0, state FULL1w0d: OSPF: Build router LSA for area 0, router ID 192.168.1.17, seq 0x8000000B

Next, we sent back an acknowledgement of the receipt of the LSR. Wehave now reached the FULL state with the BDR.

The entire process for the DR is listed below. The same events occur inthe same order as the adjacency with the BDR.

1w0d: OSPF: Rcv hello from 192.168.1.19 area 0 from Ethernet0 192.168.1.191w0d: OSPF: 2 Way Communication to 192.168.1.19 on Ethernet0, state 2WAY1w0d: OSPF: Neighbor change Event on interface Ethernet01w0d: OSPF: DR/BDR election on Ethernet01w0d: OSPF: Elect BDR 192.168.1.181w0d: OSPF: Elect DR 192.168.1.191w0d: DR: 192.168.1.19 (Id) BDR: 192.168.1.18 (Id)1w0d: OSPF: Send DBD to 192.168.1.19 on Ethernet0 seq 0x130E opt 0x2 flag 0x7 len 321w0d: OSPF: Remember old DR 192.168.1.18 (id)1w0d: OSPF: End of hello processing1w0d: OSPF: Rcv DBD from 192.168.1.19 on Ethernet0 seq 0x113F opt 0x2 flag 0x7 len 32 mtu 0 state EXSTART1w0d: OSPF: NBR Negotiation Done. We are the SLAVE1w0d: OSPF: Send DBD to 192.168.1.19 on Ethernet0 seq 0x113F opt 0x2 flag 0x2 len 1121w0d: OSPF: Rcv DBD from 192.168.1.19 on Ethernet0 seq 0x1140 opt 0x2 flag 0x3 len 112 mtu 0 state EXCHANGE1w0d: OSPF: Send DBD to 192.168.1.19 on Ethernet0 seq 0x1140 opt 0x2 flag 0x0 len 321w0d: OSPF: Rcv DBD from 192.168.1.19 on Ethernet0 seq 0x1141 opt 0x2 flag 0x1 len 32 mtu 0 state EXCHANGE1w0d: OSPF: Exchange Done with 192.168.1.19 on Ethernet01w0d: OSPF: Synchronized with 192.168.1.19 on Ethernet0, state FULL1w0d: OSPF: Send DBD to 192.168.1.19 on Ethernet0 seq 0x1141 opt 0x2 flag 0x0 len 32

Configuring OSPF 121

ch04.qxd 11/14/2000 9:36 AM Page 121

1w0d: OSPF: Reset old DR on Ethernet01w0d: OSPF: Build router LSA for area 0, router ID 192.168.1.17, seq 0x8000000C1w0d: OSPF: Rcv hello from 192.168.1.18 area 0 from Ethernet0 192.168.1.181w0d: OSPF: End of hello processing

At this point, we have two isolated segments both running OSPF inArea 0. To finish this part of the discussion, we will enable the serial link be-tween R2 and R5. This will cause a topology change, so we will want to mon-itor the exchange that occurs. We will turn on debugging on R2 so that wecan see what occurs. The same thing will occur on R5 as well, so we don’tneed to examine that side of the network.

R2#debug ip ospf floodOSPF flooding debugging is onR2#conf tEnter configuration commands, one per line. End with CNTL/Z.R2(config)#router ospf 100R2(config-router)#network 192.168.1.242 0.0.0.0 area 0

First, we enabled debugging to watch for the flooding of LSUs thatoccur when a topology change occurs. Next, we enabled OSPF on the serialinterface. OSPF came online for a new link and so our debugging outputshowed us the following:

06:53:59: OSPF: Build router LSA for area 0, router ID 192.168.1.242, seq 0x8000001406:53:59: OSPF: Sending update on Ethernet0 to 224.0.0.606:53:59: OSPF: Send Type 1, LSID 192.168.1.242, Adv rtr 192.168.1.242, age 1, seq 0x80000014

A topology change occurred, and so we let the DR and BDR know thatsomething occurred. This was accomplished by sending a multicast packet toaddress 224.0.0.6, also known as the AllDRouters address.

06:53:59: OSPF: received update from 172.16.3.1, Ethernet006:54:00: OSPF: Rcv Update Type 1, LSID 192.168.1.242, Adv rtr 192.168.1.242, age 2, seq 0x8000001406:54:00: OSPF: Received same lsa06:54:00: Remove LSA from retransmission list

The DR in turn sent out a multicast to 224.0.0.5 (AllSPFRouters), tellingall of the neighbors that a topology change occurred. Because this was thesame LSU that this router generated, it disregarded this update.

06:54:02: OSPF: Received ACK from 192.168.1.24606:54:02: OSPF: Rcv Ack Type 1, LSID 192.168.1.242, Adv rtr 192.168.1.242, age 2, seq 0x8000001406:54:02: Remove LSA from retransmission list

Finally, the BDR acknowledged the LSU sent. The topology change hasbeen flooded as far as it can go.

122 Chapter 4 • An Introduction to OSPF

ch04.qxd 11/14/2000 9:36 AM Page 122

After enabling R5 to run OSPF on its serial interface as well, the entirenetwork is now running within a single area, Area 0. It is a bit more compli-cated than that because two different networks are suddenly merged, whichmeans that R5 and R2 must exchange link state databases. This exchange isfurther sent to each DR, which is then sent to all the neighbors on the seg-ment. If any of those routers are connected to another network, then the in-formation is flooded to those networks and so on. A large network of 50routers within a single area can cause a lot of traffic throughout that network.We can show that by advertising the loopback addresses on R1 and viewingthe debugging output on R5:

R1#conf tEnter configuration commands, one per line. End with CNTL/Z.R1(config)#router ospf 100R1(config-router)#network 172.16.0.0 0.0.255.255 area 01w0d: OSPF: received update from 192.168.1.242, Serial01w0d: OSPF: Rcv Update Type 1, LSID 172.16.2.1, Adv rtr 172.16.2.1, age 3, seq 0x800000111w0d: OSPF: Sending update on Ethernet0 to 224.0.0.61w0d: OSPF: Send Type 1, LSID 172.16.2.1, Adv rtr 172.16.2.1, age 4, seq 0x800000111w0d: OSPF: received update from 192.168.1.19, Ethernet01w0d: OSPF: Rcv Update Type 1, LSID 172.16.2.1, Adv rtr 172.16.2.1, age 5, seq 0x800000111w0d: OSPF: Received same lsa1w0d: Remove LSA from retransmission list1w0d: OSPF: Sending delayed ACK on Serial01w0d: OSPF: Ack Type 1, LSID 172.16.2.1, Adv rtr 172.16.2.1, age 3, seq 0x800000111w0d: OSPF: Received ACK from 192.168.1.181w0d: OSPF: Rcv Ack Type 1, LSID 172.16.2.1, Adv rtr 172.16.2.1, age 5, seq 0x800000111w0d: Remove LSA from retransmission list

After enabling OSPF to advertise the 172.16.1.0 and 172.16.2.0 net-works, we can see the result on R5. First, an update was received from R2.How did R2 hear this update to pass on? The initial update was sent from R1to the DR. The DR in turn sent out the update to R2. R2 flooded the update toanother neighbor on a different network (R5). R5 received the LSU andflooded it to the DR and BDR via 224.0.0.6. The DR in turn sent out a multi-cast to 224.0.0.5. R5 heard the LSU from the DR and, since it was the sameone it sent out, it ignored the LSU. Next, R5 sent an acknowledgement backto R2. (Without this mechanism, there would be no way for R2 to be sure thatR5 received the update.) Finally, the BDR sent the acknowledgement to theLSU that R5 originally sent. And just like that, all routers in the network knewabout the topology change.

Configuring OSPF 123

ch04.qxd 11/14/2000 9:36 AM Page 123

We have one last link to bring up between R6 and R3. This link is a64Kbps link (the other link is a T1), so we need to make sure we change thebandwidth command:

R6(config)#int s0/0R6(config-if)#ip addr 192.168.1.245 255.255.255.252R6(config-if)#bandwidth 64R6(config-if)#no shut

R3(config)#int s0R3(config-if)#ip addr 192.168.1.246 255.255.255.252R3(config-if)#bandwidth 64R3(config-if)#no shut

Now that all of the routers in our network have been enabled to runOSPF and the topology tables are synchronized, there is only one step left:creating the routing tables.

Dijkstra Algorithm

When an LSU has been received by the router, it will wait an additional fiveseconds before calculating the routing tables. These five seconds allowenough time for all routers to learn of the topology change. After five sec-onds has passed, each router independently will use the topology table andcalculate the cost of each path to each network.

OSPF uses the bandwidth as the basis for calculating the cost of eachpath. This metric is referred to as the cost and is calculated by taking 108 /Bandwidth. Some examples are shown in Table 4-2.

124 Chapter 4 • An Introduction to OSPF

TABLE 4–2 OSPF Costs of Various Link Speeds

Bandwidth Calculation Cost

56Kbps Link 108/56000 = 1785

64Kbps Link 108/64000 = 1563

128Kbps Link 108/128000 = 781

T1 Link 108/1544000 = 64

10MB Ethernet 108/107 = 10

16MB Token Ring 108/(1.6 x 107) = 6

100MB Ethernet 108/108 = 1

ch04.qxd 11/14/2000 9:36 AM Page 124

Each router must use the same formula to ensure optimum path selec-tion. However, other vendor’s equipment may use a different algorithm andthus we need a way to change the values to match. We can perform this byoverriding the algorithm with an absolute cost using the ip ospf cost com-mand on individual interfaces.

We will look at a quick (remember that OSPF is more complex than thischapter shows) example of what the algorithm does to arrive at the routingtable. If we refer to Figure 4-16, we can see our network that we have set up,but we have identified network speeds and assigned letters to each network.Combining this with Table 4-2 allows us to calculate costs.

Each router chooses itself as the primary node and begins to build atree of possible paths to each network. Each link has a cost associated with it.As the tree is built up, all possible paths will be added with their costs. Whenthe tree is finished, the algorithm then runs and calculates the best cost pathto each network.

As an example, we will start by looking at R6 as the root router. Inother words, R6 is building its routing table.

First, referring to Figure 4-17, R6 lists its directly connected neighbors,of which there are three. R5 and R7 are reachable through network A and R3is reachable through network C. Network A is a 10Mbps Ethernet networkthat has a cost of 10, and network C is a 64Kbps point-to-point link that has acost of 1563.

Configuring OSPF 125

A - 10Mbps

R6

R2 R3

B - 1.544Mbps

D - 10Mbps

R1

C - 64Kbps

R4

R5

F - 100Mbps

E - 100Mbps

G - 100Mbps

R7

Network 192.168.1.16/28 - ANetwork 192.168.1.240/30 - BNetwork 192.168.1.244/30 - CNetwork 192.168.1.0/28 - DNetwork 172.16.1.0/24 - ENetwork 172.16.2.0/24 - FNetwork 172.16.3.0/24 - G

FIGURE 4–16 The sample network according to Dijkstra.

ch04.qxd 11/14/2000 9:36 AM Page 125

Next, R6 will examine that networks that R7 can reach. This informationis learned through the LSUs upon the initialization of R6. R7 has no other net-works, so that branch is finished. Next, R5 has a connection to R2 throughthe T1 link. Looking at R3, the router sees that R3 has connections to R1, R2,and R4. The tree now looks like Figure 4-18.

Again, the router looks at what networks and neighbors R1 has. R1 hasconnections to networks E and F, but no neighbors. That terminates thatbranch. R2 (through R5) has connections to R1, R3, and R4. R2 (through R3)has connections to R5, which in turn has connections to R6 and R7. R6 is us,so that branch terminates. R7 has no connections and therefore that branch isterminated. As the tree is built up, it can become quite complex. In this smallnetwork, the diagram becomes very large.

Once the tree has been completed (Figure 4-19) with all the networksidentified and through which routers, the algorithm starts building the routingtable. Starting with network A and continuing through network G, the routerwill add up all the costs along the way to that network. If there are multiplepaths, the path with the lowest cost will be chosen. Equal cost paths will allbe listed in the routing table, and load balancing will be available.

For example, if R6 wanted to find the best path to G, it would look inthis table. There are two paths to network G. The first path is through R5(Cost 10), R2 (Cost 64), and R4 (Cost 10), with a final cost of 1. Adding thesevalues shows that the path to G through R5 has a cost of 85. The other pathis through R3 (Cost 1563) and R4 (Cost 10), with a final cost of 1. The path

126 Chapter 4 • An Introduction to OSPF

R7 R5

R6

R3

A - 10 C - 1563

A - 10

FIGURE 4–17 Starting to build the tree.

R7 R5

R6

R3

A - 10 C - 1563

A - 10

R1R2 R4R2

B - 64D - 10

D - 10D - 10

FIGURE 4–18 Continuing the tree.

ch04.qxd 11/14/2000 9:36 AM Page 126

through R3 then has a total cost of 1574. The best path is through R5, andthat path is listed in the routing table.

Once the Dijkstra algorithm is complete, the routing table is updated,and packets can now be routed through the network.

We can examine the routing table with the command show ip route.Router 6 has the following routing table:

R6#sho ip routeCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate defaultU - per-user static route, o - ODR

Gateway of last resort is not set

172.16.0.0/32 is subnetted, 3 subnetsO 172.16.1.1 [110/85] via 192.168.1.17, 00:00:13, Ethernet0/0O 172.16.3.1 [110/85] via 192.168.1.17, 00:00:13, Ethernet0/0O 172.16.2.1 [110/85] via 192.168.1.17, 00:00:13, Ethernet0/0

192.168.1.0/24 is variably subnetted, 4 subnets, 2 masksO 192.168.1.0/28 [110/84] via 192.168.1.17, 00:00:13, Ethernet0/0C 192.168.1.16/28 is directly connected, Ethernet0/0O 192.168.1.240/30 [110/74] via 192.168.1.17, 00:00:13, Ethernet0/0C 192.168.1.244/30 is directly connected, Serial0/0R6#

Configuring OSPF 127

R7 R5

R6

R3

A - 10 C - 1563

A - 10

R1R2 R4R2

B - 64D - 10

D - 10D - 10

R1 R3R4

D - 10

D - 10

D - 10

G - 1 E - 1 F - 1 C - 1563

E - 1 F - 1 R5

B - 64

G - 1

R7

A - 10

A - 10

FIGURE 4–19 The complete tree.

ch04.qxd 11/14/2000 9:36 AM Page 127

Looking at the routing table, we can see a couple of things. The letter“O” is used to indicate that a route was learned via OSPF. The administrativedistance of OSPF is 110. Comparing this to the other protocols, we can seethat both EIGRP (90) and IGRP (100) are considered more believable thanOSPF. Finally, the metric shows us the value of 85, and indeed this is exactlywhat we calculated using the tree previously.

Maintaining the Routing Table

When a new LSU is heard with one or more LSAs included, the router willprocess each LSA to determine what needs to be done.

• If the LSA is newer than the information in the topology table, or theLSA is brand new, the router will add the information to the table. It willflood the LSA to its neighbors using the mechanism described earlierand then acknowledge receipt of the LSU. Finally, after waiting five sec-onds, the Dijkstra algorithm is run again, updating the routing table.

• If the LSA is older than the information currently stored, the router willsend an updated LSU back to the sender with the new information.

• If the LSA is the same sequence number as that currently stored in thetable, the LSA is ignored.

Through this mechanism, OSPF maintains a very fast convergence stateand can make decisions about paths based on the topology database insteadof “routing by rumor.”

WAN Connectivity

There are different types of WAN connectivity, and depending on which oneis being used, OSPF may require extra configuration to ensure adjacency withall the neighbors. Remember that the DR and BDR must be able to establish afull adjacency with ALL of the neighbors. In NBMA modes, this can become a problem. In this section, we will examine the following types of WANconnectivity:

• Point-to-point.• Point-to-multipoint.• Point-to-multipoint non-broadcast.• NBMA.• NBMA with broadcast.

Point-to-Point

In a point-to-point link such as the one we have been using, OSPF does notneed, nor elect, a DR or BDR. Since there are only two nodes on the link,there is no need to worry about synchronization. The neighbors are

128 Chapter 4 • An Introduction to OSPF

ch04.qxd 11/14/2000 9:36 AM Page 128

dynamically discovered using the HELLO packet and all packets are sent asmulticast packets to AllSPFRouters (224.0.0.5). On a point-to-point link, theHello Interval is 10 seconds and the Dead Router Interval is 40 seconds.

If we examine the neighbor table from R2, we see the following:

R2#sho ip ospf neigh

Neighbor ID Pri State Dead Time Address Interface172.16.2.1 1 2WAY/DROTHER 00:00:30 192.168.1.1 Ethernet0192.168.1.246 1 FULL/BDR 00:00:31 192.168.1.3 Ethernet0172.16.3.1 3 FULL/DR 00:00:33 192.168.1.4 Ethernet0192.168.1.17 1 FULL/ - 00:00:35 192.168.1.241 Serial0

Here we can see that the neighbor with Router ID 192.168.1.17 (R5)has been moved to the FULL state. However, the DR/BDR field is indicatedwith a single hyphen, indicating that this is a point-to-point link and that aDR and BDR are not needed.

If we issue the command show ip ospf interface, we can see moredetailed information about this link.

R2#sho ip ospf intEthernet0 is up, line protocol is upInternet Address 192.168.1.2/28, Area 0Process ID 100, Router ID 192.168.1.242, Network Type BROADCAST, Cost: 10Transmit Delay is 1 sec, State DROTHER, Priority 0Designated Router (ID) 172.16.3.1, Interface address 192.168.1.4Backup Designated router (ID) 192.168.1.246, Interface address 192.168.1.3Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5Hello due in 00:00:04

Neighbor Count is 3, Adjacent neighbor count is 2Adjacent with neighbor 192.168.1.246 (Backup Designated Router)Adjacent with neighbor 172.16.3.1 (Designated Router)

Suppress hello for 0 neighbor(s)Serial0 is up, line protocol is upInternet Address 192.168.1.242/30, Area 0Process ID 100, Router ID 192.168.1.242, Network Type POINT_TO_POINT, Cost: 64Transmit Delay is 1 sec, State POINT_TO_POINT,Timer intervals configured, HELLO 10, Dead 40, Wait 40, Retransmit 5Hello due in 00:00:02

Neighbor Count is 1, Adjacent neighbor count is 1Adjacent with neighbor 192.168.1.17

Suppress hello for 0 neighbor(s)

The first highlighted line shows us that the network type on an Ethernetsegment is a BROADCAST type. The second line shows us that this networktype across the serial link is a POINT-TO-POINT. Finally, the third line showsus the timers across that link.

Point-to-point mode is a Cisco extension to the RFC standard.

WAN Connectivity 129

ch04.qxd 11/14/2000 9:36 AM Page 129

Point-to-Multipoint

In a point-to-multipoint configuration, the spoke routers use subinterfaces toconnect to a hub router. The hub router uses a multipoint interface. The hublooks as if it has multiple point-to-point links that operate the same as we justdiscussed in the last section. The benefit to using this method is that only onesubnet is needed for the frame cloud. In Figure 4-20, we have a simple huband spoke network across a Frame Relay cloud. The Core router has the mul-tipoint interface and is configured as follows:

Core(config-if)#int s1/3Core(config-if)#encap framCore(config-if)#ip addr 172.16.1.1 255.255.255.0Core(config-if)#no shut

Physical interfaces (not subinterfaces) are multipoint connections, so wedo not need to use subinterfaces here. By using this method, we do not needto assign the different DLCIs that are being received from the frame switch.

D1 is configured using a subinterface. Because it is a subinterface, weneed to statically assign the DLCI:

D1(config)#int s0D1(config-if)#no shutD1(config-if)#encap frameD1(config-if)#int s0.1 pointD1(config-subif)#ip addr 172.16.1.2 255.255.255.0D1(config-subif)#frame interface-dlci 101

130 Chapter 4 • An Introduction to OSPF

CIR 56

CIR 56

CIR 56

Core

D1

D2

D3

172.16.0.0/24

172.16.96.0/24

172.16.97.0/24

172.16.98.0/24

172.16.1.1/24

172.16.1.2/24

172.16.1.3/24

172.16.1.4/24

DLCI 201

DLCI 202

DLCI 203

DLCI 101

DLCI 102

DLCI 103

FIGURE 4–20 Point-to-multipoint across Frame Relay.

ch04.qxd 11/14/2000 9:36 AM Page 130

D2 and D3 are configured in the same fashion. Next, we enable OSPFon D1. D2 and D3 are configured the same way.

D1(config)#router ospf 100D1(config-router)#network 172.16.0.0 0.0.255.255 area 0D1#sho ip ospf int s0.1Serial0.1 is up, line protocol is upInternet Address 172.16.1.2/24, Area 0Process ID 100, Router ID 172.16.96.1, Network Type POINT_TO_POINT, Cost: 64Transmit Delay is 1 sec, State POINT_TO_POINT,Timer intervals configured, hello 10, Dead 40, Wait 40, Retransmit 5Hello due in 00:00:06

Neighbor Count is 0, Adjacent neighbor count is 0Suppress hello for 0 neighbor(s)

D1#

Note here that the network type is POINT-TO-POINT. What happenswhen we enable OSPF on the Core, though?

Core#sho ip ospf int s1/3Serial1/3 is up, line protocol is upInternet Address 172.16.1.1/24, Area 0Process ID 100, Router ID 172.16.3.1, Network Type NON_BROADCAST, Cost: 781Transmit Delay is 1 sec, State WAITING, Priority 1No designated router on this networkNo backup designated router on this networkTimer intervals configured, hello 30, Dead 120, Wait 120, Retransmit 5Hello due in 00:00:14Wait time before Designated router selection 00:01:44

Index 2/2, flood queue length 0Next 0x0(0)/0x0(0)Last flood scan length is 0, maximum is 0Last flood scan time is 0 msec, maximum is 0 msecNeighbor Count is 0, Adjacent neighbor count is 0Suppress hello for 0 neighbor(s)

Core#

The default for this is the RFC-compliant mode of point-to-multipointNON-BROADCAST mode. However, we are using all Cisco devices, so we cansupport broadcasts. To change this, we need to tell the interface to use thepoint-to-multipoint mode.

Core(config-if)#ip ospf network point-to-multipointCore#sho ip ospf int s1/3Serial1/3 is up, line protocol is upInternet Address 172.16.1.1/24, Area 0Process ID 100, Router ID 172.16.3.1, Network Type POINT_TO_MULTIPOINT, Cost:

781Transmit Delay is 1 sec, State POINT_TO_MULTIPOINT,Timer intervals configured, hello 30, Dead 120, Wait 120, Retransmit 5Hello due in 00:00:13

WAN Connectivity 131

ch04.qxd 11/14/2000 9:36 AM Page 131

Index 2/2, flood queue length 0Next 0x0(0)/0x0(0)Last flood scan length is 0, maximum is 0Last flood scan time is 0 msec, maximum is 0 msecNeighbor Count is 0, Adjacent neighbor count is 0Suppress hello for 0 neighbor(s)

Core#

Now that this interface is configured correctly, the neighbors should allhave been found through the HELLO multicast packet.

Core#sho ip ospf nei

There must be something wrong. There are no neighbors listed yet. Tofind out what is happening, we will turn on debugging.

Core#debug ip ospf adjOSPF adjacency events debugging is onCore#16:31:06: OSPF: Rcv hello from 172.16.97.1 area 0 from Serial1/3 172.16.1.316:31:06: OSPF: Mismatched hello parameters from 172.16.1.316:31:06: Dead R 40 C 120, Hello R 10 C 30Core#16:31:08: OSPF: Rcv hello from 172.16.96.1 area 0 from Serial1/3 172.16.1.216:31:08: OSPF: Mismatched hello parameters from 172.16.1.216:31:08: Dead R 40 C 120, Hello R 10 C 30Core#16:31:10: OSPF: Rcv hello from 172.16.98.1 area 0 from Serial1/3 172.16.1.416:31:10: OSPF: Mismatched hello parameters from 172.16.1.416:31:10: Dead R 40 C 120, Hello R 10 C 30

There is the answer. The Hello Interval and Router Dead Interval aremismatched. The point-to-point interfaces use 10 and 40 seconds, respec-tively, but the multipoint links use 40 and 120 seconds, respectively. In otherwords, we need to run the command ip ospf network point-to-multi-point on each router.

D1(config-if)#int s0.1D1(config-subif)#ip ospf network point-to-multipoint

D2(config)#int s1.1D2(config-subif)#ip ospf network point-to-multipoint

D3(config)#int s0/3.1D3(config-subif)#ip ospf network point-to-multipoint

Now, let’s check the neighbor table on the Core again.

Core#sho ip ospf neigh

Neighbor ID Pri State Dead Time Address Interface172.16.98.1 1 FULL/ - 00:01:45 172.16.1.4 Serial1/3

132 Chapter 4 • An Introduction to OSPF

ch04.qxd 11/14/2000 9:36 AM Page 132

172.16.97.1 1 FULL/ - 00:01:48 172.16.1.3 Serial1/3172.16.96.1 1 FULL/ - 00:01:39 172.16.1.2 Serial1/3Core#

And there it is. Each link is online and we have established FULL adja-cencies with the neighbors. Viewing the routing table shows the following:

Core#sho ip routeCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area* - candidate default, U - per-user static route, o - ODRP - periodic downloaded static route

Gateway of last resort is not set

172.16.0.0/16 is variably subnetted, 8 subnets, 2 masksO 172.16.1.4/32 [110/781] via 172.16.1.4, 00:01:58, Serial1/3C 172.16.0.0/24 is directly connected, FastEthernet0/0C 172.16.1.0/24 is directly connected, Serial1/3O 172.16.1.3/32 [110/781] via 172.16.1.3, 00:01:58, Serial1/3O 172.16.1.2/32 [110/781] via 172.16.1.2, 00:01:58, Serial1/3O 172.16.96.0/24 [110/791] via 172.16.1.2, 00:01:58, Serial1/3O 172.16.97.0/24 [110/791] via 172.16.1.3, 00:01:58, Serial1/3O 172.16.98.0/24 [110/791] via 172.16.1.4, 00:01:59, Serial1/3Core#

We have reached convergence and we now have a path to all the net-works.

Advantages to this type of network include using a single subnet for thecloud and neighbors are automatically found. One disadvantage to this net-work is that any LSAs that arrive at the Core must be replicated to D2 and D3.The standard multicast mechanism does not work because these are differentlinks. This requires the Core router to be a larger router to handle the extraprocessing.

Point-to-Multipoint Non-Broadcast

Point-to-multipoint networks with broadcast capabilities are RFC 2328-compliant, but there are networks such as ATM that are not broadcast-based.This requires extra work on our part to statically define each of the neigh-bors. To use this mode, each interface would be issued the command ipospf network point-to-multipoint non-broadcast. After this, each routermust be statically defined with its neighbors using the neighbor command.This mode is a Cisco extension to RFC 2328.

WAN Connectivity 133

ch04.qxd 11/14/2000 9:36 AM Page 133

NBMA

In this mode, we are typically within a full mesh network. This is the pre-ferred method. However, in NBMA, which is RFC 2328-compliant, there areno broadcasts (or multicasts). Since this is needed to discover neighbors,which in turn is needed to elect a DR and BDR, we must statically assign theneighbors.

To configure this network, we have added three PVCs to our networkas shown in Figure 4-21. This creates a fully meshed NBMA network.

Each serial interface in this network is using the physical interface. TheDLCIs are being learned from the switch through inverse-arp. If we examinethe interface on D1, we see the following:

D1#sho ip ospf int s0Serial0 is up, line protocol is upInternet Address 172.16.1.2/24, Area 0Process ID 100, Router ID 172.16.96.1, Network Type NON_BROADCAST, Cost: 1785Transmit Delay is 1 sec, State DR, Priority 1Designated Router (ID) 172.16.96.1, Interface address 172.16.1.2No backup designated router on this networkTimer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5Hello due in 00:00:07

Neighbor Count is 0, Adjacent neighbor count is 0Suppress hello for 0 neighbor(s)

This interface is using the RFC-compliant NON-BROADCAST method. Next,we can look at the neighbor table of D1:

134 Chapter 4 • An Introduction to OSPF

Core

D1

D2

D3

172.16.0.0/24

172.16.96.0/24

172.16.97.0/24

172.16.98.0/24

172.16.1.1/24

172.16.1.2/24

172.16.1.3/24

172.16.1.4/24

DLCI 201

DLCI 202

DLCI 203

DLCI 101

DLCI 102

DLCI 103

All PVCs areCIR 56Kbps

DLCI 401DLCI 402

DLCI 501DLCI 502 DLCI 601

DLCI 602

FIGURE 4–21 Fully meshed NBMA network.

ch04.qxd 11/14/2000 9:36 AM Page 134

D1#sho ip ospf neiD1#

To get OSPF to work, we need to statically assign the neighbors. Wewill start at the Core and work our way out:

Core(config)#router ospf 100Core(config-router)#neighbor ?A.B.C.D Neighbor address

Core(config-router)#neighbor 172.16.1.2 ?cost OSPF cost for point-to-multipoint neighbordatabase-filter Filter OSPF LSA during synchronization and flooding for

point-to-multipoint neighborpoll-interval OSPF dead-router polling intervalpriority OSPF priority of non-broadcast neighbor<cr>

Core(config-router)#neighbor 172.16.1.2Core(config-router)#neighbor 172.16.1.3Core(config-router)#neighbor 172.16.1.3Core(config-router)#neighbor 172.16.1.4

Notice that we can set up priorities and costs associated with neighbors.This allows us to tune OSPF to our network. After running all the neighborstatements on the routers, we can view the neighbor table.

Note that it is not necessary to set the neighbor statement on both ends, but for reliability and readability, it is recom-mended. As long as one neighbor statement is placed, that router can start the exchange process.

Core#sho ip ospf neigh

Neighbor ID Pri State Dead Time Address Interface172.16.98.1 1 FULL/DR 00:01:54 172.16.1.4 Serial1/3172.16.97.1 1 FULL/DROTHER 00:01:56 172.16.1.3 Serial1/3172.16.96.1 1 FULL/DROTHER 00:01:40 172.16.1.2 Serial1/3Core#

We now have FULL states with all other routers. Notice that this is differ-ent than with our Ethernet network. We were paused in the 2WAY state withour neighbors that were neither the DR or BDR. In NBMA networks, eachLSA is replicated to all neighbors. Multicasting doesn’t work, so the routersneed to ensure that everyone receives all updates.

NMBA with Broadcast

Once again, Cisco has made it easier for us to work with Cisco devices. In-stead of entering all the neighbor statements, we can set the interface tobroadcast mode and the multicasts will traverse the frame cloud. We issuethis on each of the routers in the full mesh topology:

WAN Connectivity 135

ch04.qxd 11/14/2000 9:36 AM Page 135

Core(config)#int s1/3Core(config-if)#ip ospf network ?broadcast Specify OSPF broadcast multi-access networknon-broadcast Specify OSPF NBMA networkpoint-to-multipoint Specify OSPF point-to-multipoint networkpoint-to-point Specify OSPF point-to-point network

Core(config-if)#ip ospf network broadcastCore(config-if)#router ospf 100Core(config-router)#network 172.16.0.0 0.0.255.255 area 0

D1(config)#int s0D1(config-if)#ip ospf net broadD1(config-if)#router ospf 100D1(config-router)#netw 172.16.0.0 0.0.255.255 area 0

D2(config)#int s1D2(config-if)#ip ospf net broadD2(config-if)#router ospf 100D2(config-router)#network 172.16.0.0 0.0.255.255 area 0

D3(config)#int s0/3D3(config-if)#ip ospf net broadD3(config-if)#router ospf 100D3(config-router)#network 172.16.0.0 0.0.255.255 area 0

Now that each router has been configured to use the broadcast method,we can issue the show ip ospf neighbor command to see the results:

Core#sho ip ospf neigh

Neighbor ID Pri State Dead Time Address Interface172.16.98.1 1 INIT/DROTHER 00:00:33 172.16.1.4 Serial1/3172.16.97.1 1 EXSTART/DR 00:00:33 172.16.1.3 Serial1/3172.16.96.1 1 2WAY/DROTHER 00:00:36 172.16.1.2 Serial1/3

Here we caught it quick enough to see three different states with theneighbors, which happened to be automatically discovered through the useof HELLO packets. If we run it again, we see the final state of the neighbors:

Core#sho ip ospf neigh

Neighbor ID Pri State Dead Time Address Interface172.16.98.1 1 FULL/DR 00:00:31 172.16.1.4 Serial1/3172.16.97.1 1 FULL/BDR 00:00:31 172.16.1.3 Serial1/3172.16.96.1 1 2WAY/DROTHER 00:00:34 172.16.1.2 Serial1/3

We are back to the way we were when we discussed Ethernet net-works. The ease of configuration makes this very attractive. However, keepin mind that every 10 seconds, a HELLO packet is going across each PVC. Thisadds traffic to the otherwise limited bandwidth of the PVC.

136 Chapter 4 • An Introduction to OSPF

ch04.qxd 11/14/2000 9:36 AM Page 136

WAN Recap

To run OSPF across the WAN link, we must keep in mind the different con-figurations possible. With point-to-point links, there is no extra configuration.With point-to-multipoint links, we can either statically define our neighborsor use the broadcast mode. The same is true when running OSPF across anNBMA network.

Another thing to keep in mind is what if we do not have a fully meshednetwork and we want to run OSPF across the WAN. Through careful design,we can break the WAN into some point-to-point (or multipoint) and someNBMA. We may even need to define which routers become the DR and BDRto ensure full connectivity to each neighbor.

Table 4-3 lists the different modes and some advantages and disadvan-tages of each.

WAN Connectivity 137

TABLE 4–3 Comparing WAN Modes

Mode Advantage(s) Disadvantage(s) DR/ RFC-BDR Compliant?

Point-to-Point Easy to set Different subnets No No

up (Cisco)

Point-to-Multipoint Same subnet LSA replication No Yes

Easy to set up

Point-to-Multipoint Use with ATM Statically assigned neighbors No No

Non-Broadcast Same subnet (Cisco)

NBMA Same subnet Statically assigned neighbors Yes Yes

NBMA Broadcast Same subnet Network instability Yes No

Easy to set up Extra PVC traffic (Cisco)

ch04.qxd 11/14/2000 9:36 AM Page 137

Summary

Open Shortest Path First, or OSPF, is a link state protocolthat has most recently been defined in RFC 2328. As a linkstate protocol, OSPF establishes neighbors through the useof a Hello protocol. HELLO packets are sent out on a periodicbasis to discover new neighbors. When a neighbor is discov-ered, the two routers will exchange link state information(topologies) using the exchange protocol. When both routershave completed this exchange, the Dijkstra algorithm is runto compute the best path to any given network. When atopology change is detected, the router detecting the changenotifies the DR and BDR, who in turn notify all neighbors onthat same segment. All routers learning of this change willthen flood the LSA to other segments in the network.Through this mechanism, each topology change is reportedto all routers, which can then compute a path based on thisnew information. Using OSPF in a WAN environment can re-quire extra configurations depending on the mode. In aNBMA network, neighbors must be statically defined beforethe election of the DR and BDR can take place. Cisco pro-vides other extensions to the RFC standard for use in differ-ent types of networks and for easier configuration.

ch04.qxd 11/14/2000 9:36 AM Page 138

Exam ObjectiveChecklist

The Routing (640-503) exam contains a combination of thefollowing topics:

4) Configuring OSPF in a Single Area

• Explain why OSPF is better than RIP is a large internet-work.

• Explain how OSPF discovers, chooses, and maintainsroutes.

• Explain how OSPF operates in a single-area NBMAenvironment.

• Configure OSPF for proper operation in a single area.• Verify OSPF operation in a single area.• Given an addressing scheme and other laboratory

parameters, configure a single-area OSPF in an NBMAenvironment and verify proper operation (within thedescribed guidelines) of your routers.

ch04.qxd 11/14/2000 9:36 AM Page 139

Chapter 4 PracticeQuestions

1. OSPF is better than RIP because:

a. It uses bandwidth as a measure of metricsb. It supports VLSMc. It sends its entire routing table every 15 seconds,

instead of 30 seconds, which speeds up conver-gence

d. It has no real reachability limits

2. OSPF uses what protocol number?

a. 6b. 17c. 88d. 89

3. The Router ID is selected from which of the following:

a. The highest loopback interface addressb. The lowest loopback interface addressc. The highest physical interface if no loopback ad-

dress is availabled. The highest physical interface even if the loop-

back address is available

4. What fields are required to be the same in all HELLOpackets between neighbors?

a. Area IDb. Hello Interval

ch04.qxd 11/14/2000 9:36 AM Page 140

c. Router Dead Intervald. DRe. BDR

5. What is the order of states when discovering a neighbor?

a. 2WAY

b. Downc. INIT

d. FULL

6. What method does OSPF use to ensure that routers maintain a synchro-nized database with all neighbors?

a. Dijkstra algorithmb. Hello Intervalc. Election of DR and BDRd. Exchange protocol

7. The BDR will become the DR when what occurs?

a. When the DR fails and it wins a new electionb. It will never become the DR; it will always stay the BDRc. When the BDR reboots and has a higher Router ID than the cur-

rent DRd. When the DR fails, it automatically becomes the DR

8. What can be configured to control which router becomes the DR for asegment?

a. Loopback addressb. Priorityc. Hello Intervald. Area ID

9. What term is used to describe the router that starts the exchange ofDBD packets?

a. Ownerb. DRc. Masterd. Slave

10. Which state determines which router starts the exchange process?

a. EXSTART

b. INIT

c. 2WAY

d. EXCHANGE

Chapter 4 Practice Questions 141

ch04.qxd 11/14/2000 9:36 AM Page 141

11. When a router wants more information about a summary link found ina DBD, what type of packet is sent?

a. Hello packetb. LSAc. LSUd. LSR

12. In what order do the following states occur?

a. EXCHANGE

b. LOADING

c. EXSTART

d. FULL

13. True or False: When an LSU is received indicating a topology change,the router can run the Dijkstra algorithm immediately.

14. Which of the following WAN modes results in a DR/BDR election?

a. Point-to-pointb. Point-to-multipointc. NBMAd. Broadcast

15. Which WAN modes are RFC-compliant?

a. Point-to-pointb. Point-to-multipointc. NBMAd. Broadcast (NBMA)

Refer to Appendix A to answer the following questions:

16. What command displays the neighbor table?

17. What command enables only the interface 192.168.1.1?

18. What command can be used to control the election of the DR?

19. What command can be used to view the exchange protocol as it occurs?

20. What command can be used to view the flooding of LSAs?

21. What command shows the states of neighbor routers?

22. What command can be used to override the metrics used in the Dijkstraalgorithm?

23. What command can be used to show the network type of an interface?

24. What command is used to statically list neighbors?

25. What command is used to enable broadcast capabilities over FrameRelay?

142 Chapter 4 • An Introduction to OSPF

ch04.qxd 11/14/2000 9:36 AM Page 142