ospf overview

41
Cisco 3 - OSPF Perrine & Brierley Page 1 05/07/22 Module 2 OSPF Overview Open Shortest Path First (OSPF) is a link-state routing protocol based on open standards, most recently describes in the RFC 2328. The Open in OSPF means that it is open to the public and is nonproprietary. OSPF’s considerable capability to scale is achieved through hierarchical design. This is done by sectioning off an OSPF network into multiple areas. By defining areas in a properly designed network, an administrator can reduce routing overhead & improve performance.

Upload: oriana

Post on 14-Jan-2016

62 views

Category:

Documents


1 download

DESCRIPTION

OSPF Overview. Open Shortest Path First (OSPF) is a link-state routing protocol based on open standards , most recently describes in the RFC 2328 . The Open in OSPF means that it is open to the public and is nonproprietary. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 104/21/23

Module 2

OSPF Overview

Open Shortest Path First (OSPF) is a link-state routing protocol based on open standards, most recently describes in the RFC 2328.

The Open in OSPF means that it is open to the public and is nonproprietary.

OSPF’s considerable capability to scale is achieved through hierarchical design. This is done by sectioning off an OSPF network into multiple areas.

By defining areas in a properly designed network, an administrator can reduce routing overhead & improve performance.

Page 2: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 204/21/23

Module 2

OSPF Overview

The information gathered from OSPF neighbors is not a complete routing table. Instead, OSPF routers tell each other about the status of their connections, or links, to the internetwork.

That is, OSPF routers advertise their link states. The routers build a link-state database, which is essentially a picture of which device is connected to what.

Then the routers run the Shortest Path First (SPF) algorithm, Dijkstra Dijkstra algorithmalgorithm, on the link-state database to determine the best routes to a destination.

The SPF algorithm adds up the cost (usually based on bandwidth) of each link between the particular router and its destination. The router then chooses the lowest-cost path to be added to its routing table, know as the forwarding database.

In general, cost decreases as the speed of the link increases. Less the cost, better the route.

Page 3: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 304/21/23

Module 2

OSPF Packet Types

OSPF routers rely on 5 different types of packets to identify their neighbors and to update link-state routing information:

OSPF Packet Type Description

Type 1 – Hello

Type 2 – Database description packet

Type 3 – Link-state request (LSR)

Type 4 – Link-state update (LSU)

Type 5 – Link-state acknowledgement

(LSAck)

Establishes & maintains adjacency information with neighbors

Describes the content of an OSPF router’s link-state database

Requests specific pieces of a router’s link-state database

Transports link-state advertisements (LSAs) to neighbor routers

Acknowledge receipt of a neighbor’s LSA

Page 4: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 404/21/23

Module 2

OSPF 7 States

The key to effectively designing & trouble shooting OSPF is to understand the 7 states that OSPF transitions to:

• Down

• Init

• Two-way

• ExStart

• Exchange

• Loading

• Full adjacency

Page 5: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 504/21/23

Module 2

Down State

Down State

OSPF process has not exchanged information with any neighbors, and is waiting to enter the Init state

Page 6: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 604/21/23

Module 2

Init State

Init State

OSPF routers send Type 1 (hello) packets at regular intervals (usually 10 seconds) to establish special relationships with neighbor routers. When an interface receives its 1st hello packet, the router enters the Init state.

Generally there are 2 kinds of relationships:

1. 2-way state

2. adjacency

The router MUST receive a hello from a neighbor before it establishes any relationship.

Page 7: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 704/21/23

Module 2

Two-Way State

Two-Way State

Using hello packets, every OSPF router tries to establish a two-way state with every neighbor router on the same IP network. A router enters the two-way state when it sees itself in a neighbor’s hello packet.

Two-state is most basic relationship, but routing information is not shared between routers in this relationship.

To learn about other routers’ link states & eventually build a routing table, every OSPF router must form at least one adjacency.

Page 8: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 804/21/23

Module 2

ExStart State

ExStart State

The 1st state to full adjacency is this state. Technically, when a router & its neighbor enter the ExStart state, their conversation is characterized as an adjacency, but the routers haven’t become fully adjacent yet.

ExStart is established using Type 1 Data Base Description packets (DBD). The 2 neighbor routers use these DBD packets to negotiate who is the master & who is the slave.

To see this process -- use <debug ip ospf events>

The router with highest OSPF router ID (IP address) is the master

Page 9: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 904/21/23

Module 2

Exchange State

Exchange State

In this state, neighbor routers use Type 2 DBD packets to send each other their link-state information.

If either of the routers 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.

Page 10: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 1004/21/23

Module 2

Loading State

Loading State

After the database has been described to each router, more complete information must be request by using Type 3 packets (LSR).

When a router receives an LSR, it responds with an update by using a Type 4 link-state update (LSU) packet. These Type 4 LSU packets contain the actual LSAs.

Page 11: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 1104/21/23

Module 2

Full Adjacency

Full Adjacency

With the loading state complete, the routers are fully adjacent.

Each router keeps a list of adjacent neighbors called the adjacency database.

Because adjacency is required for OSPF routers to share routing information, a router tries to become adjacent to at least one other router on each IP network to which it is connected.

Page 12: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 1204/21/23

Module 2

Adjacency database

List of all the neighbor routers to which a router has established bi-directional communication.

Link-state database

List of information about all other routers in the network. This database shows the network topology.

Forwarding database (the routing table)

A list of routes generated when an algorithm is run on the link-state database.

OSPF Router Databases

Page 13: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 1304/21/23

Module 2

OSPF selects routes based on cost, which is related to bandwidth. The higher the bandwidth, the lower the OSPF cost for the link.

OSPF selects the fastest loop free path and the shortest path first as the best path in the network.

OSPF guarantees loop-free routing, whereas distance vector protocols can cause routing loops.

Selecting Routes

Page 14: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 1404/21/23

Module 2

OSPF Network Types

OSPF interfaces automatically recognize 4 types of networks:

1. broadcast multiaccess

2. non-broadcast multiaccess (NBMA)

3. point-to-point

4. point-to-multipoint (which is configured by an administrator)

Page 15: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 1504/21/23

Module 2

OSPF Network Types

Network Type Determining Characteristic DR Election?

Broadcast multiaccess Ethernet, Token Ring or FDDI Yes

Nonbroadcast multiaccess Frame relay, X.25, SMDS Yes

Point-to-point PPP, HDLC No

Point-to-multipoint Configured by an administrator No

Page 16: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 1604/21/23

Module 2

Because a significant number of routers can exist on a multiaccess network, OSPF’s designers developed a system to avoid the overhead that would be created if every router established full adjacency with every other router.

Designated router (DR)

Backup designated router (BDR)

DR and BDR

Page 17: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 1704/21/23

Module 2

Designated router (DR)

For every multiaccess IP network, one router will be elected the DR. This DR has 2 main functions:

• to become adjacent to all other routers on the network

• to act as a spokesperson for the network

Because the DR becomes adjacent to all other routers on the IP network, it is the focal point for collecting routing information (LSAs).

DR and BDR

Page 18: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 1804/21/23

Module 2

Backup designated router (BDR)

Because the DR could become a single point of failure, a 2nd router is elected as the BDR to provide fault tolerance. Hence the BDR must become adjacent to all router on the network & serves as the the 2nd focal point for LSAs.

However, the BDR is not responsible for updating the other routers or sending network LSAs. The BDR keeps a timer on the DR’s update activity to ensure that it is operational.

DR and BDR

Page 19: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 1904/21/23

Module 2

NOTE: Since there are only 2 nodes in a point-to-point network, no DR or BDR is elected.

DR and BDR

Page 20: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 2004/21/23

Module 2

OSPF Hello Protocol

At layer 3, all OSPF routers send hello packets to the multicast address 224.0.0.5.

OSPF routers use hello packets to initiate new adjacencies and to ensure that adjacent neighbors haven’t disappeared.

Hellos are sent every 10 seconds by default for multiaccess and point-to-point networks.

For NBMA networks, such as Frame Relay, hellos are sent ever 30 seconds.

Hello interval is the number of seconds that an OSPF router waits to send the next hello packet (10 sec for multi-access and P-P, but 30 sec for NBMA).

Dead interval is the number of seconds that a router waits before it declares a neighbor down if the neighbor’s hello packets are no longer being received. The dead interval is 4 times the hello interval by default, 40 seconds or 120 seconds in this example.

Page 21: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 2104/21/23

Module 2

OSPF Router ID

Router ID is a 32-bit number used to identify the router to the OSPF protocol.

A router uses its IP address as its ID because both the router ID address must be unique within a network, as it the IP address.

Because routers support multiple IP address, the highest value IP address is used as the router ID.

When a router’s ID changes for any reason (interface goes down), the router must reintroduce itself to its neighbors on all links.

To avoid the unnecessary overhead caused by reestablishing adjacency & re-advertising link states, an administrator assigns an IP address to a loopback interface.

If a loopback interface is configured with an IP address, the Cisco IOS will use that IP address (loopback) as the router’s ID, even if the other interfaces have higher addresses.

Page 22: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 2204/21/23

Module 2

OSPF Area ID

In CCNP course on routing protocols, we will learn about creating different areas for OSPF.

Note that 32 bits are used to represent the area ID, and that number can be written in either decimal and dotted-decimal notation.

However, you will always have an Area 0 which is defined as the backbone area.

Page 23: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 2304/21/23

Module 2

Steps in the Operation of OSPF

OSPF routers progress through five distinct steps of operation:

1. Establish router adjacencies

2. Elect a DR and BDR (if necessary)

3. Discover routes

4. Select the appropriate routes to use

5. Maintain routing information

Page 24: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 2404/21/23

Module 2

Electing a DR and a BDR

The election process is done by the hello packets which contains router’s ID and priority value.

The router with the highest priority value among adjacent neighbors is the DR, and the router with the 2nd highest priority is elected the BDR.

After the DR & BDR are elected, they keep their roles until one of them fails, even if additional routers with higher priorities show up on the network.

By default, OSPF routers have the same priority value of 1. An administrator can assign a priority of between 0 and 255 on any given OSPF interface.

A priority of 0 prevents the router from winning any election on that interface. A priority of 255 ensures at least a tie.

If two routers have the same priority, then the tie breaker is who has the highest ID.

Page 25: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 2504/21/23

Module 2

10.4.0.0/16 10.5.0.0/16 10.6.0.0/16

Broadcast multiaccess Broadcast multiaccessPt-to-pt

E0 10.4.0.1 E1 10.5.0.1

E0 10.5.0.2

S1 10.6.0.1

S0 10.6.0.2

A B C

For network 10.5.0.0, who is the DR and who is the BDR?

DR

BDR

For network 10.4.0.0, who is the DR and who is the BDR?

No election of BDR, yet.

For network 10.6.0.0, who is the DR and who is the BDR?

No DR or BDR, because it is a point-to-point network!

Page 26: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 2604/21/23

Module 2

Discover Routes

On a multiaccess network, the exchange of routing information occurs between the DR or BDR and every other router on the network.

For point-to-point & point-to-multipoint network, the link partners also exchange information.

But who goes first? This is determined in the ExStart state which establish a master/salve relationship between the two routers.

The router with the highest ID acts as the master.

Page 27: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 2704/21/23

Module 2

Select Appropriate Routes

After a router has a complete link-state database, it is ready to create its routing table so that it can forward traffic.

OSPF uses the metric value cost to determine the best path to a destination. The default cost metric is based on media bandwidth. In general, cost decreases as the speed of the link increases.

To calculate the lowest cost to a destination, a router uses the SPF algorithm which adds up the total costs between the local router and each destination network. If there are multiple paths to a destination, the lowest-cost path is preferred.

But note that OSPF can keep up to 4 equal-cost route entries in the routing table for load balancing.

Page 28: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 2804/21/23

Module 2

Cisco IOS Default OSPF Path Costs

The Cisco IOS automatically determines cost based on the bandwidth of an interface using the formula: 108 / bps (bandwidth value).

Medium Cost

56kbps serial link 1785

T1 (1.544Mbps) 64

E1 (2.048Mbps) 48

4-Mbps Token Ring 25

Ethernet 10

16-Mbps Token Ring 6

100-Mbps Fast Ethernet, FDDI 1

Page 29: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 2904/21/23

Module 2

Maintain Routing Information

When there is a change in a link-state, OSPF routers use a flooding process to notify other routers on the network about the change. LSU packet containing the new link-state information is sent.

• point-to-point

New link-state information is sent to the 224.0.0.5 multicast address.

• Multiaccess networks

If the DR or BDR needs to send information, it will be sent to all OSPF routers via 224.0.0.5. However, the other routers on a multiaccess network are adjacent only to the DR & BDR and thus can send LSUs only to them. Therefore DR & BDR have their own multicast address, 224.0.0.6.

Non-DR/BDR routers send their LSUs via 224.0.0.6.

When the DR receives and acknowledges the LSU destined for 224.0.0.6, it floods the LSU to all OSPF router on the network via 224.0.0.5.

Page 30: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 3004/21/23

Module 2

Configuring OSPF on Routers within a Single Area

We will cover the commands necessary to configure the OSPF process ID, loopback IP address (router ID), OSPF priority, link cost, authentication, and hello timers.

The process ID is any number between 1 and 65,535 to identify multiple OSPF processes on the same router.

Router(config)# router ospf process-id

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

Page 31: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 3104/21/23

Module 2

10.4.0.0/16

10.5.0.0/16 10.6.0.0/16E0 10.4.0.1 E1 10.5.0.1

E0 10.5.0.2

S1 10.6.0.1

S0 10.6.0.2

A B C

Area 0

RTB(config)# router ospf 1

RTB(config-router)# network 10.5.0.0 255.255.0.0 area 0

RTB(config-router)# network 10.6.0.0 255.255.0.0 area 0

OR

RTB(config-router)# network 10.5.0.2 0.0.0.0 area 0

RTB(config-router)# network 10.6.0.1 0.0.0.0 area 0

Page 32: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 3204/21/23

Module 2

Verification commands for OSPF:

Router# show ip protocols ; verifies routing information

Router# show ip ospf ; verifies router ID & SPF holdtime

OSPF Verification Commands

Page 33: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 3304/21/23

Module 2

Configuring a Loopback Address for Stability

When the OSPF process starts, the Cisco IOS uses the highest local IP address as its OSPF router ID, unless a loopback interface is configured for IP, in which case that address is used, regardless of its value.

Though remember, the loopback interface must be configured first, and then the OSPF process configuration to override the highest interface IP address.

**You must be careful in configuring the loopback.

Router(config)# interface loopback0

Router(config-if)# ip address 1.1.1.1 255.255.255.255

Router(config)# int lo0

Router(config-if)# ip address 1.1.1.1 255.255.255.255

OR

Page 34: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 3404/21/23

Module 2

Modifying OSPF Router Priority

Administrators manipulate the DR/BDR elections by configuring the priority value to a number other than the default value of one (1).

A value of 0 guarantees that the router will not be elected as DR or BDR.

Remember that OSPF is defined to the interface, so to configure an interface, and hence the network, NOT to be a DR or BDR, do the following:

Router(config)# interface e0

Router(config-if)# ip ospf priority 0

The verification command, show ip ospf interface, gives the following info:

• which router has been elected DR and/or BDR

• network type (broadcast multiaccess, etc.)

• cost of link

• timer intervals specific to the interface

Page 35: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 3504/21/23

Module 2

Modifying Cost

For OSPF to calculate routers properly, all interfaces connected to the same link must agree on the cost of that link.

Again, remember, the cost is per interface.

Router(config)# int e0

Router(config-if)# ip ospf cost 10000

To calculate the cost for OSPF, 108 / bandwidth value

Page 36: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 3604/21/23

Module 2

Configuring Authentication

Authentication is interface specific configuration. Use the following command:

Router(config-if)# ip ospf authentication-key password

After a password is configured, you can enable authentication on an area-wide basis by:

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

By default, authentication passwords will be sent in clear text. It is recommended that one uses the option, message-digest, so the password is hashed when it is sent over the wire. If you use message-digest, you must use the command:

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

Page 37: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 3704/21/23

Module 2

Configuring Authentication

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

Command Parameter Description

key-id Key ID on each router must match to authenticate

Md5 Required value specifying MD5 algorithm

encryption-type Optional. From 0-7. Type 0 is default. 7 Cisco encryption

password alphanumeric

Page 38: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 3804/21/23

Module 2

Configuring OSPF Timers

For OSPF routers to exchange information, they must have the same hello intervals & same dead intervals on the interface.

By default, hello interval is 10 seconds, and dead interval is 4 times hello interval, 40 seconds.

However, if the intervals must be changed for efficient issues, then use the commands:

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

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

Page 39: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 3904/21/23

Module 2

OSPF over Nonbroadcast Networks

NBMA, such as Frame Relay, includes more than two nodes, and hence will try to elect DR & BDR.

But NBMA networks follow layer 2 rules which prevents the delivery of broadcast and multicasts messages needed to elect DR & BDR.

Cisco presents methods in CCNA4 to get around this ( illustrated in a lab assignment ):

Full-mesh Frame Relay, use the ‘network’ command to identify the nodes, or use subinterfaces

Partial-mesh Frame Relay (hub & spoke), manually configure a point-to-multipoint network

Page 40: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 4004/21/23

Module 2

Propagating Default Route in OSPF

To gain access to networks that are not in the routing table, a default gateway must be set at a border router.

To propagate the default route, 0.0.0.0 /0, to all the routers in a normal OSPF area, use the following configuration:

Router(config-router)# default-information originate

Page 41: OSPF Overview

Cisco 3 - OSPF

Perrine & Brierley Page 4104/21/23

Module 2

END