1 cabrillo college ch. 4 - ospf, single area ch. 4 - ospf, single area building scalable cisco...

84
1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Building Scalable Cisco Networks Networks Rick Graziani, Instructor with Mark McGregor Sep 1, 2001 Sep 1, 2001

Upload: todd-holland

Post on 14-Jan-2016

253 views

Category:

Documents


28 download

TRANSCRIPT

Page 1: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

1

Cabrillo College

Ch. 4 - OSPF, Single AreaCh. 4 - OSPF, Single Area

Building Scalable Cisco NetworksBuilding Scalable Cisco NetworksRick Graziani, Instructor with Mark McGregor

Sep 1, 2001Sep 1, 2001

Page 2: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

2

Format of the presentation

Combined different sections of McGregor’s Ch. 4 on OSPF, to create a single flow of information. (Tried to.)

Added some information from Jeff Doyle’s “Routing TCP/IP Vol. I,” John Moy’s book on OSPF and RFC 2328, OSPF version 2 (current version)

For more information see above references.

Page 3: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

3

OSPF Exam Objectives Explain why OSPF is better than RIP in large

internetwork Explain how OSPF discovers, chooses, and

maintains routes. Explain how OSPF operates in a single area

NBMA environment Configure OSPF for proper operation in a

single area Configure a single-area OSPF environment Configure OSPF for an NBMA envrionment

Page 4: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

4

OSPF Overview OSPF does not gather routing table information, but

routers and the status of their connections, links. OSPF routers use this information to build a

topological data base (link state database), runs the Shortest Path First (SPF), Dijkstra’s algorithm, and creates a SPF tree. From that SPF tree, a routing table is created.

Page 5: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

5

OSPF is a link state protocol LinkLink: interface on a router Link stateLink state: the status of a link between

to routers.

Page 6: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

6

OSPF vs RIP (no contest) OSPF is link-state, where RIP is distance-vector. OSPF has faster convergence - Because of RIP’s hold-

down timer, RIP can be quite slow to converge. OSPF has no hop restriction - RIP to limited to 15

hops, OSPF does not use hops. OSPF supports VLSM; RIPv1 doesn’t Cisco’s OSPF metric is based on bandwidth, RIP’s is

based on hop count Update efficiency - RIP sends entire routing table every

30 seconds, where OSPF only sends out changes when they occur.

OSPF also uses the concept of area to implement hierarchical routing

Page 7: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

7

Cisco’s OSPF’s metric is based on cost

CostCost: The outgoing cost for packets transmitted from this interface.

Cost is an OSPF metric expressed as an unsigned 16-bit integer, from 1 to 65,535.

Page 8: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

8

Cisco’s OSPF’s metric is based on cost Cisco uses a default cost of 108/BW, where

BW is the configured bandwidth (bandwidth command) of the interface and 108 (100,000,000) as the reference bandwidth.

Example: A serial link with a configured bandwidth of 128K would have a cost of: 100,000,000/128,000 = 781

More on the cost metric later… Note: Bay and some other vendors use a

default cost of 1 on all interfaces, essentially making the OSPF cost reflect hop counts.

Page 9: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

9

RFC 2328 on OSPF cost

RFC 2328, OSPF version 2, J. Moy “A cost is associated with the output side of

each router interface. This cost is configurable by the system administrator. The lower the cost, the more likely the interface is to be used to forward data traffic.”

RFC 2328 does not specify any values for cost.

Page 10: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

10

Areas make OPSF scalable AreaArea: collection of OSPF routers.

Page 11: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

11

OSPF Areas Every OSPF router must belong to at least

one area Every OSPF network must have an Area 0

(backbone area) All other Areas should “touch” Area 0

– There are exceptions to this rule Routers in the same area have the same link-

state information Much more on areas in the next chapter,

OSPF Multiple Areas

Page 12: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

12

OSPF neighbor relationships OSPF is capable of sophisticated

communication between neighbors. OSPF uses 5 different types of packets to

communicate.

Page 13: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

13

OSPF Packet Header

Page 14: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

14

The OSPF Hello Protocol

OSPF routers send Hellos, usually every 10 seconds by default.

HelloInterval - Cisco default = 10 seconds and can be changed with the command ip ospf hello-interval.

RouterDeadInterval - The period in seconds that the router will wait to hear a Hello from a neighbor before declaring the neighbor down. Cisco uses a default of four-times the HelloInterval (4 x 10 sec. = 40 seconds) and can be changed with the command ip ospf dead-interval.

For routers to become adjacent, the Hello, DeadInterval and network types must be identical!

Page 15: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

15

The Hello Packet

Page 16: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

16

A Type-1 Hello packet

Page 17: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

17

OSPF packet types

OSPF Type-2 (DBD)

OSPF Type-3 (LSR)

OSPF Type-4 (LSU)

OSPF Type-5 (LSAck)

Page 18: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

18

OSPF packet types

OSPF Type-4 packets have 7 LSA packets (later)

Page 19: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

19

Steps to OSPF Operation1. Establishing router adjacencies

2. Electing DR and BDR

3. Discovering Routes

4. Choosing Routes

5. Maintaining Routing Information

Page 20: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

20

OSPF States

OSPF router interfaces can be in one of seven states:

Down State Init State Two-way State ExStart State Exchange State Loading State Full Adjacency State

Page 21: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

21

Steps to OSPF Operation with OSPF States1. Establishing router adjacencies

– Down State– Init State– Two-way State– (ExStart State unless DR/BDR election needed)

2. Electing DR and BDR– ExStart State with DR and BDR– Two-way State with all other routers

3. Discovering Routes– ExStart State– Exchange State– Loading State– Full State

4. Choosing Routes

5. Maintaining Routing Information

Page 22: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

22

1.Establishing Adjacencies Initially, an OSPF router interface is in the down

state. In the down state, the OSPF process has no

exchanged information with any neighbor. OSPF is waiting to enter the init state. An OSPF router tries to form an adjacency with at

least one neighbor for each IP network it’s connected to.

Page 23: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

23

1. Establishing Adjacencies

RTB perspective and assuming routers are configured correctly.

Trying to start a relationship and wanting to enter the init state RTB begins multicasts OSPF Hello packets (224.0.0.5,

AllSPFRouters), advertising its own Router ID. – 224.0.0.5: All OSPF routers should be able to transmit and

listen to this address.

Page 24: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

24

1. Establishing Adjacencies

Router ID = Highest loopback address; highest active IP address. Loopback address has the advantage of never going down, thus

diminishing the possibility of having to re-establish adjacencies. (more in a moment)

Use private ip addresses for loopbacks, so you do not inadvertently advertise a route to a real network that does not exist on your router.

Page 25: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

25

1. Establishing Adjacencies

RTA and RTC receive Hello packets from RTB RTA and RTC add RTB’s Router ID to the Neighbor ID field of the

Hello packet its sends back to RTB, at the same time entering the init state.

Init State Init State - OSPF routers sent Type 1 Hello packets at regular

intervals (10 sec.) to establish neighbors. When a router receives its first Hello packet, it enters the init state,

meaning the router is ready to take the relationship to the next level.

Page 26: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

26

1. Establishing Adjacencies

From init state to the two-way state RTB receives Hello packets from RTA and RTC (its neighbors),

and sees its own Router ID (10.6.0.1) in the Neighbor ID field. RTB declares takes the relationship to a new level, and declares

a two-way state between itself and RTA, and itself and RTC.

Page 27: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

27

1. Establishing AdjacenciesTwo-way state (and adjacency) Using Type-1 Hello packets every OSPF router tries to establish

a two-way state or bi-directional communication with every neighbor router on the same IP network.

Among other information, these Hello packets include a list of the sender’s known OSPF neighbors.

A router enters the two-way state when it sees itself in a neighbor’s Hello packet.

To learn about other routers’ link states and eventually build a routing table, every OSPF router must form at least one adjacency and involve a series of progressions that will not just rely just on hellos, but the other four kinds of OSPF packets.

Page 28: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

28

1. Establishing Adjacencies

Two-way state to ExStart state? RTB now decides who to establish a full adjacency with depending

upon the type of network that the particular interfaces resides on. If the interface is on a point-to-point link, the routers becomes

adjacent with its sole link partner (aka “soul mates”), and take the relationship to the next level by entering the ExStart state.

If the interface is on a multi-access link (Ethernet, Frame Relay, …) RTB must enter an election process to see who it will establish a full adjacency with, and remains in the two-way state. (Next!)

Page 29: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

29

Steps to OSPF Operation with OSPF States1. Establishing router adjacencies

– Down State– Init State– Two-way State– (ExStart State unless DR/BDR election needed)

2. Electing DR and BDR– ExStart State with DR and BDR– Two-way State with all other routers

3. Discovering Routes– ExStart State– Exchange State– Loading State– Full State

4. Choosing Routes

5. Maintaining Routing Information

Page 30: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

30

2.Electing a DR and BDR On point-to-point links adjacencies (don’t get this

confused with being “fully adjacent” or the full state) are established with all neighbors, because there is only one neighbor.

On multi-access networks,OSPF elects a DR and BDR to limit the number of adjacencies.– Reduce routing update traffic

Page 31: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

31

DRDR - Designated Router BDRBDR – Backup Designated Router DR’s serve as collection points for Link State Advertisements

(LSAs) A BDR back ups the DR. If the IP network is multi-access, the OSPF routers will elect 1

DR and 1 BDR (unless there is only 1 router on the network).

2.Electing a DR and BDR

Page 32: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

32

2.Electing a DR and BDR The formation of an adjacency between every attached router

would create many unncessary LSA (Link State Advertisements), n(n-1)/2 adjacencies.

Flooding on the network itself would be chaotic. A router would flood an LSA to all its adjacent neighbors, which

in turn would flood it to all their adjacent neighbors, and so on, creating many copies of the same LSA on the same network.

To prevent this problem, a Designate Router is elected on multi-access networks.

Page 33: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

33

2. Electing a DR/BDR

Designated Router A DR (Designated Router) and perhaps a BDR (Backup Designated

Router) is elected for every multi-access network, using Hello packets as “ballots.”

Router with the highest Router ID is elected the DR. But like other elections, this one can be rigged. The router’s priority field can be set to either ensure that it becomes

the DR or prevent it from being the DR. The router can be assigned a priority between 0 and 255, with 0

preventing this router from becoming the DR (or BDR) and 255 ensuring at least a tie. (The highest Router ID would break the tie.)

Page 34: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

34

2. Electing a DR/BDR

Backup Designated Router BDR (Backup Designated Router) is elected in addition to the

DR in case the DR fails. The BDR is the router that wins second place in the previous

process. If a multi-access network only has one router, it will be the DR

and there will be no BDR.

Page 35: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

35

2. Electing a DR/BDR

Page 36: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

36

All other routers, “DRother”, establish adjacencies with only the DR and BDR.

DRother routers multicast LSAs to only the DR and BDR– (224.0.0.6 - all DR routers)

DR sends LSA to all adjacent neighbors – (224.0.0.5 - all OSPF routers)

2. Electing a DR/BDR

DRother Routers

Page 37: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

37

Backup Designated Router - BDR Listens, but doesn’t act. If LSA is sent, BDR sets a timer. If timer expires before it sees the reply from the DR, it becomes

the DR and takes over the update process. The process for a new BDR begins.

2. Electing a DR/BDR

Page 38: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

38

Once a DR is established, a new router that enters the network with a higher priority or router id will NOT become the DR or BDR. (Bug in early IOS 12.0)

If DR fails, BDR takes over as DR and selection process for new BDR begins.

State of the relationship– DRothers enter ExStart state with DR and BDR and two-way state

with all other routers

2. Electing a DR/BDR

Page 39: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

39

DR - SummaryDR Election Router with the highest interface priority (0 = cannot become

DR or BDR) Router with the highest router ID.

– Loopback address used first– IP Address on active interface used second

BDR is the second highest

Adjacencies and multicasting All other routers, DRother, establish adjacencies with only the

DR and BDR. All routers continue to multicast Hello packets to AllSPFRouters

(224.0.0.5) so they can track neighbors. But updates (LSAs) are multicast to DR and BDR only

(224.0.0.6 - AllDRrouters) and in turn DR floods updates (LSAs) to all adjacent neighbors (224.0.0.5 -

AllSPFRrouters)

Page 40: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

40

BDR Listens, but doesn’t act. If LSA is sent, BDR sets a timer. If timer expires before it sees the reply from the DR, it

becomes the DR and takes over the update process. Timer? The process for a new BDR begins.

Page 41: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

41

Steps to OSPF Operation with OSPF States1. Establishing router adjacencies

– Down State– Init State– Two-way State– (ExStart State unless DR/BDR election needed)

2. Electing DR and BDR– ExStart State with DR and BDR– Two-way State with all other routers

3. Discovering Routes– ExStart State– Exchange State– Loading State– Full State

4. Choosing Routes

5. Maintaining Routing Information

Page 42: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

42

3. Discovering Routes and reaching Full State

“adjacent”

OSPF Type-2 (DBD)

OSPF Type-2 (DBD)

OSPF Type-2 (DBD)

OSPF Type-5 (LSAck)

OSPF Type-3 (LSR)

OSPF Type-4 (LSU)

OSPF Type-5 (LSAck)

OSPF Type-2 (DBD)

Page 43: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

43

3.Discovering RoutesExStart State ExStart state - prepare for initial database exchange Routers now ready to exchange routing information.

– Between routers on a point-to-point network– On a multi-access network between the DRothers and the

DR and BDR. Routers in ExStart state are characterized as adjacent, but have

not yet become full adjacent as they have not exchanged data base information.

But who goes first in the exchange? ExStart is established by exchanging LSA Type-2 DBD

(Database Description) packets. Purpose of ExStart is to establish a master/slave relationship

between the two routers decided by the higher router id. Once the roles are established they enter the exchange state.

Page 44: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

44

3. Discovering Routes and reaching Full State

“adjacent”

OSPF Type-2 (DBD)

OSPF Type-2 (DBD)

OSPF Type-2 (DBD)

OSPF Type-5 (LSAck)

OSPF Type-3 (LSR)

OSPF Type-4 (LSU)

OSPF Type-5 (LSAck)

OSPF Type-2 (DBD)

Page 45: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

45

Exchange State Exchange state - routers exchange one or more Type-2 DBDs

(Database Description) packets, which is a summary of the link-state database– send LSAcks to verify

Routers compare these DBDs with information in its own database.

If the router receives information about a link that is not already in its database, the router requests a complete update from its neighbor.

Complete routing information is exchanged in the loading state.

3.Discovering Routes

Page 46: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

46

3. Discovering Routes and reaching Full State

“adjacent”

OSPF Type-2 (DBD)

OSPF Type-2 (DBD)

OSPF Type-2 (DBD)

OSPF Type-5 (LSAck)

OSPF Type-3 (LSR)

OSPF Type-4 (LSU)

OSPF Type-5 (LSAck)

OSPF Type-2 (DBD)

Page 47: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

47

Loading State Loading state

– If the other router has more updated information, this router sends a LSR (Link-State Request) packet requesting more information

– Remote router sends the requested information in a LSA Type-4 packet (more on this packet type(s) in next chapter)

– Router sends LSAck to acknowledge receipt

Full State Full state - after all LSRs have been updated. At this point the routers should have identical link-state

databases

3. Discovering Routes and reaching Full State

Page 48: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

48

3. Discovering Routes and reaching Full State

“adjacent”

OSPF Type-2 (DBD)

OSPF Type-2 (DBD)

OSPF Type-2 (DBD)

OSPF Type-5 (LSAck)

OSPF Type-3 (LSR)

OSPF Type-4 (LSU)

OSPF Type-5 (LSAck)

OSPF Type-2 (DBD)

Page 49: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

49

4.Choosing Routes The router now has a complete link-state database Now the router is ready to create a routing table, but first needs

to run the Shortest Path First Algorithm on the link state database, which will create the SPF tree.

Page 50: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

50

4.Choosing Routes Dijkstra’s algorithm is used to calculate the Shortest Path Tree

from the LSAs in the link state database. SPF, Shortest Path First calculations places itself as the root

and creating a “tree diagram” of the network

Page 51: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

51

The LSAs that build the database contain three important pieces of generic information: RouterID of the sender of the LSA, the NeighborID, and cost of the link between the Router and the neighbor (I.e the state of the link or link-state).

Doyle Chapter 4 and Radia Perlman’s book, Interconnections, has some excellent examples on this process.

4.Choosing Routes

Page 52: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

52

Cost = 108/BW OSPF basis routing metrics on cost. Cisco routers, cost = 108/BW BW is the configured bandwidth for an interface (See CCNA IGRP

information) Cisco uses a default cost of 108/BW, where BW is the configured

bandwidth (bandwidth command) of the interface and 108 (100,000,000) as the reference bandwidth.

Example: A serial link with a configured bandwidth of 128K would have a cost of: 100,000,000/128,000 = 781

The cost of a route is the sum of the costs of all the outgoing interfaces to a destination.

In general, cost decreases as the speed of the link increases. RTB’s 10 Mbps Ethernet interface has a lower cost than its T-1,

1.544 Mbps interface.

4.Choosing Routes

Page 53: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

53

Cisco default interface costs:

56-kbps serial link—Default cost is 1785

64-kbps serial link—Default cost is 1562

T1 (1.544-Mbps serial link)—Default cost is 65

E1 (2.048-Mbps serial link)—Default cost is 48

4-Mbps Token Ring—Default cost is 25

Ethernet—Default cost is 10

16-Mbps Token Ring—Default cost is 6

FDDI—Default cost is 1

Notes:

Cisco routers default to T1 (1.544 Mbps) on all serial interfaces and require manual modification with the bandwidth command.

ospf auto-cost reference-bandwidth ref-bw can be used to modify the reference-bandwidth for higher speed interfaces

4.Choosing Routes

Page 54: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

54

Modifying the cost bandwidth command can be used to change the bandwidth

metric on an interface and used in the 108/BW calculation:

RTB(config)# inter s 0

RTB(config-if)# bandwidth 56 (in Kbps)

Note: The metric for this interface is now 1785.

ip ospf cost is used when converting the metric between routers from different vendors. It overrides the default cost and becomes the metric for that interface.

RTB(config)# inter s 0

RTB(config-if)# ip ospf cost 1000

Note: The metric for this interface is now 1000.

Note: For the Cisco IOS cost formula to be accurate it is important to have appropriate costs on both sides of a link.

4.Choosing Routes

Page 55: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

55

SPF Holdtime SPF algorithm is CPU intensive and takes some time depending

upon the size of the area (coming next week), the number of routers, the size of the link state database.

A flapping link can cause an OSPF router to keep on recomputing a new routing table, and never converge.

To minimize this problem:– SPF calculations are delayed by 5 seconds after receiving

an LSU (Link State Update)– Delay between consecutive SPF calculations is 10 seconds

You can configure the delay time between when OSPF receives a topology change and when it starts a shortest path first (SPF) calculation (spf-delay). You can also configure the hold time between two consecutive SPF calculations (spf-holdtime).

Router(config-router)#timers spf spf-delay spf-holdtime

4.Choosing Routes

Page 56: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

56

SPF Holdtime

RTB#show ip ospf 1Routing Process "ospf 1" with ID 10.6.0.1<OUTPUT OMITTED> Area BACKBONE(0) Number of interfaces in this area is 2 Area has no authentication SPF algorithm executed 5 times Area ranges are Number of LSA 4. Checksum Sum 0x1D81A Number of opaque link LSA 0. Checksum Sum 0x0 Number of DCbitless LSA 0 Number of indication LSA 0 Number of DoNotAge LSA 0 Flood list length 0

Page 57: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

57

5.Maintaining Routing Info Routes are in the routing table (show ip route)Flooding process When there is a change in a link-state, (down link,

new link information,…) OSPF routers us a flooding process to notify other routers about the change.

This could be a directly connected link or a link partner.

The Hello protocol uses its dead interval timer for declaring a link partner down.

If a router doesn’t hear from a link state neighbor for a time period exceeding the dead interval (usually 4 x Hello interval = 40 seconds), it declares that neighbor down.

Page 58: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

58

5.Maintaining Routing InfoFlooding Process: Sending out LSUs When the router needs to send out an LSU (OSPF

Type-4) containing the new link-state information, it sends it to:

– Point-to-point links (No DR/BDR): LSU sent to 224.0.0.5 AllSPFRouters

– Multi-access networks: LSU sent to 224.0.0.6 AllDRrouters (DR/BDR)

• When DR receives and acknowledges LSU, it floods the LSU to 224.0.0.5 AllSPFRouters.

• Each router acknowledges the receipt of the of the LSU with a LSAck back to the DR.

Receiving router(s) continue with the flooding of the LSU.

Page 59: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

59

Recalculating SPF Upon receiving an LSU with new information, OSPF router:

– Updates its link-state database– After SPF hold timer expires (5 seconds), router runs SPF

algorithm and creates a new routing table– Router uses new routing table

Periodic updates Each LSA entry in the link-state database has its own age timer,

with a default of 60 minutes. Before this happens the LSA has a Link State Refresh Time, (30

minutes) and when this time expires the router floods a new LSA to all its neighbors, who will reset the age. (11.3, 4 minute change)

Much, much more! (but not here) LSA Sequence numbers - Linear + Lollipop methods Flooding details State machines

5.Maintaining Routing Info

Page 60: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

60

Configuring OSPF within a Single Area

Page 61: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

61

Configuring the Process ID

Rtr(config)# router ospf process-id

process-id: 1 - 65,535 Cisco feature, which allows you to run multiple,

different OSPF routing processes on the same router. Process-id is locally significant, and does not have to

be the same number on other routers (they don’t care).

This is different than the process-id used for IGRP and EIGRP which must be the same on all routers sharing routing information.

Page 62: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

62

Network commandRtr(config)# router ospf process-id

Rtr(config-router)#network address wildcard-mask area area-id

Tells OSPF what interfaces to send and receive updates on. Wildcard is necessary because OSPF supports CIDR and

VLSM See McGregor p.167 Tech Note 0.0.0.0 255.255.255.255 means all IP interfaces

Rtr(config)# router ospf 10

Rtr(config-router)#network 10.5.1.0 0.0.0.255 area 0

Page 63: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

63

Bandwidth command

Rtr(config-if)# bandwidth 128 (in Kbps)

Set the bandwidth metric on a specific interface.

ip ospf cost command

RTB(config-if)# ip ospf cost 1000

Configures the cost metric for a specific interface

Page 64: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

64

Loopback interface

Rtr(config)# interface loopback 0

Rtr(config-if)# ip add 10.1.1.1 255.255.255.0 Very useful in setting Router IDs.

Configuring OSPF Router Priority (DR/BDR)

Rtr(config)# interface fastethernet 0

Rtr(config-if)# ip ospf priority <0-255> Higher priority becomes DR/BDR Default = 1 0 = Ineligible to become DR/BDR

Page 65: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

65

Configuring Authentication

Rtr(config-if)# ip ospf authentication-key passwd

or

Rtr(config-if)# ip ospf message-digest-key key-id md5 [encryption-type] password

password = Clear text unless message-digest is used. Key-id = 1 to 255, must match on each router to authenticate. Encryption-type = 0 to 7, 0 is default, 7 is Cisco proprietary

encryption After a password is configured, you enable authentication for the

area on all participating area routers with:

Rtr(config-router)# area area authentication [message-digest]

message-digest option must be used if using message-digest-key

If optional message-digest is used, a message digest, or hash, of the password is sent.

Page 66: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

66

Configuring timers

Rtr(config-if)# ip ospf hello-interval seconds

Rtr(config-if)# ip ospf dead-interval seconds

For OSPF routers to be able to exchange information, the must have the same hello intervals and dead intervals.

By default, the hello interval is 4 times the dead interval, so the a router has four chances to send a hello packet being declared dead. (not required)

Defaults On broadcast networks hello interval = 10 seconds, dead

interval 40 seconds. On non-broadcast networks hello interval = 30 seconds, dead

interval 120 seconds.

Page 67: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

67

Show commands

We will be looking at these commands in much more detail in the next chapter on Multi-area OSPF

Page 68: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

68

OSPF Routing Protocol Information

Rtr# show ip protocols

OSPF Specific Information

Rtr# show ip ospf

Number of SPF calculations, timers, area information,...

OSPF Routing Table

Rtr# show ip route

Page 69: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

69

OSPF Interface Information

Rtr# show ip ospf interfaceEthernet0 is up, line protocol is up

Internet Address 206.202.2.1/24, Area 1

Process ID 1, Router ID 1.2.202.206, Network Type BROADCAST, Cost: 10

Transmit Delay is 1 sec, State BDR, Priority 1

Designated Router (ID) 2.2.202.206, Interface address 206.202.2.2

Backup Designated router (ID) 1.2.202.206, Interface address 206.202.2.1

Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

Hello due in 00:00:00

Neighbor Count is 1, Adjacent neighbor count is 1

Adjacent with neighbor 2.2.202.206 (Designated Router)

Suppress hello for 0 neighbor(s)

Serial0 is up, line protocol is up

Internet Address 206.202.1.2/24, Area 1

Process ID 1, Router ID 1.2.202.206, Network Type POINT_TO_POINT, Cost: 64

Transmit Delay is 1 sec, State POINT_TO_POINT,

Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

Hello due in 00:00:04

Neighbor Count is 1, Adjacent neighbor count is 1

Adjacent with neighbor 2.0.202.206

Suppress hello for 0 neighbor(s)

Page 70: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

70

Displaying adjacencies

RouterB#show ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface

1.5.202.206 1 FULL/DROTHER 00:00:33 206.202.0.3 Ethernet0

1.10.202.206 1 FULL/BDR 00:00:32 206.202.0.4 Ethernet0

1.0.202.206 1 FULL/DROTHER 00:00:30 206.202.0.1 Ethernet0

1.2.202.206 1 FULL/ - 00:00:32 206.202.1.2 Serial0

OSPF routers keep a list of all neighbors that they have established bi-directional communication with.

Page 71: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

71

Displaying the Link State Database

Rtr# show ip ospf database

Displays the link state database OSPF routers keep track of all other routers in the internetwork. Much more next chapter on multi-area ospf.

Page 72: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

72

NBMA

Non-Broadcast Multi-access Access Networks.– Frame Relay– X.25

Without broadcasts and multicasts, DR/BDR election is problematic

Page 73: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

73

NBMA Networks and OSPF

Page 74: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

74

NBMA Networks and OSPF

Two issues of concern regarding Frame Relay and OSPF:

network type mismatches hello and dead timer mismatches

Both ends of the PVC must be configured the same.

Page 75: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

75

Network Types- WORK ON THISRouter# show ip ospf interface interface

number

Router(config-if)# ip ospf network ?– Broadcast – nonbroadcast– point-to-point – point-to-mulitpoint– loopback

Ethernet, Token Ring, FDDI Broadcast

Serial point-to-point - dedicated links and point-to-point

subinterfaces (including Frame Relay) non-broadcast - (default on Frame Relay)

Page 76: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

76

NBMA Networks and OSPF

Page 77: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

77

Full meshFull mesh

Page 78: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

78

Point-to-pointPoint-to-point uses subinterfaces

Page 79: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

79

Point-to-multipointPoint-to-multipoint

Page 80: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

80

NBMA (Frame Relay, X.25) non-broadcast - (default on Frame Relay) Uses

DR/BDR. Treats network more like an Ethernet network. Must have either a full-mesh network or frame relay map statements , so that every router on the subnet can communicate with each other.

point-to-multipoint - Works like a collection of point-to-point networks. Routers advertise individual links to other routers, no matter how complicated the frame relay network. Increased bandwidth requirements due to router LSAs and no DR/BDR

point-to-point - Does not scale well for large networks

Page 81: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

81

Configuring OSPF over Frame Relay can be tricky. You have several options in your configuring OSPF over Frame Relay. You must separate and understand the OSPF issues and the Frame Relay issues.

When configuring Frame Relay over OSPF remember the following:

Interface Hello/Dead Interval Elects DR/BDR?

Broadcast 10/40 DR/BDR

Point-to-Point 10/40 no DR/BDR

Non-Broadcast (Def.) 30/120 DR/BDR

Point-to-Multipoint 30/120 no DR/BDR

*If timers don’t match, routers can’t form adjacencies!

Page 82: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

82

Issues with large OSPF nets

Frequent SPF calculations Large routing table Large link-state table

Page 83: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

83

Last note...Why Are OSPF Neighbors Stuck in Exstart/Exchange State?

http://www.cisco.com/warp/public/104/12.html

The problem occurs most frequently when attempting to run OSPF between a Cisco router and another vendor's router. The problem occurs when the maximum transmission unit (MTU) settings for neighboring router interfaces don't match. If the router with the higher MTU sends a packet larger that the MTU set on the neighboring router, the neighboring router ignores the packet.

Since the problem is caused by mismatched MTUs, the solution is to change either router's MTU to match the neighbor's MTU. Note that Cisco IOS doesn't support changing the physical MTU on a LAN interface (such as Ethernet or Token Ring).

Page 84: 1 Cabrillo College Ch. 4 - OSPF, Single Area Ch. 4 - OSPF, Single Area Building Scalable Cisco Networks Building Scalable Cisco Networks Rick Graziani,

84

Why Does the show ip ospf neighbor Command Reveal Neighbors Stuck in 2-Way State? (This is normal in this situation.)

In the following topology, all routers are running OSPF neighbors over the Ethernet network:

Following is sample output of the show ip ospf neighbor command on R7:

router-7#show ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface170.170.3.2 1 FULL/BDR 00:00:37 170.170.3.2 Ethernet0170.170.3.3 1 2WAY/DROTHER 00:00:30 170.170.3.3 Ethernet0170.170.10.8 1 FULL/DR 00:00:39 170.170.3.8 Ethernet0170.170.7.4 1 2WAY/DROTHER 00:00:39 170.170.3.4 Ethernet0router-7#

Notice that R7 establishes full adjacency only with the Designated Router (DR) and the Backup Designated