the four elements of ospf

22
Expert Reference Series of White Papers The Four Elements of OSPF 1-800-COURSES www.globalknowledge.com

Upload: jyoti-patel

Post on 10-Feb-2016

59 views

Category:

Documents


5 download

DESCRIPTION

OSPF Explained.

TRANSCRIPT

Page 1: The Four Elements of OSPF

Expert Reference Series of White Papers

The Four Elements of OSPF

1-800-COURSES www.globalknowledge.com

Page 2: The Four Elements of OSPF

The Four Elements of OSPF Raymond B. Dooley, CCSI, Global Knowledge Course Director

Introduction All advanced IP routing protocols (OSPF, EIGRP, IS-IS) have several elements that are always present. This is because the function of all routing protocols is the same, which is to find the best path to an IP destination address. There are four common elements:

1. Operations, processes, and rules for the exchange of packets to accomplish the routing protocol objective.

2. Construction and maintenance of the routing protocol database (link state database [LSDB] in this case).

3. Construction and use of the data structures created by elements one and two.

4. Configuration and verification of the entire process.

The purpose of this paper is to examine these elements for the implementation of Open Shortest Path First (OSPF).

Operation of OSPF with Shortest-Path-First (SPF) Algorithm OSPF was developed by the Internet Engineering Task Force (IETF) as an open standard routing protocol defined by Request for Comments (RFCs). Virtually all vendors of routing and switching equipment support OSPF. Everything for a routing protocol starts with the initial exchange of packets. The packets are transported in an IP datagram using protocol number 89.

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 2

Page 3: The Four Elements of OSPF

OSPF Packet Types

– OSPF uses five types of routing protocol packets.

The graphic shows the OSPF packet types, which include hello, acknowledgement, database descriptor (DBD), link state request (LSR), and link-state update (LSU). The use of the information carried in these packets will be described later. The exchange of packets facilitates the following:

• A neighbor adjacency • Creation of a database of reachable networks

OSPF Adjacencies– Routing updates and topology information are

passed only between adjacent routers.

– Forming OSPF adjacencies on point-to-point WAN links

Forming OSPF adjacencies on LAN links is different than forming them on point-to-point links.

The graphic shows an initial exchange of hello packets to form a neighbor relationship between two routers called an adjacency. For the neighbor relationship to be formed, several parameters in the hello packet must

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 3

Page 4: The Four Elements of OSPF

match at both ends. The default interval for the OSPF hello is 10 seconds with a dead interval of 40 seconds. If 40 seconds go by without a hello, the neighbor relationship is torn down. The following parameters in the hello packets must match:

• Hello and dead interval • OSPF area number • OSPF area type • Authentication key

A database of reachable networks is constructed on each router after adjacency is established.

Link-State Protocol Data Structures

– Link-state routers recognize more information about the network than their distance vector counterparts.

• Neighbor table: also known as the adjacency database • Topology table: referred as the LSDB• Routing table: also known as the forwarding database

– Each router has a full picture of the topology– Link-state routers tend to make more accurate

decisions

From the database, additional data structures are created—neighbor table, interface table, routing information base (RIB), forwarding information base (FIB), and adjacency database. OSPF is a reliable protocol because the DBD, LSR, and LSU packets are acknowledged and retransmitted if necessary when errors are detected.

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 4

Page 5: The Four Elements of OSPF

The show ip ospf neighbor Command– This command displays information about the

OSPF neighbors, including the DR and BDR information.

R2#show ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface10.64.0.1 1 FULL/DR 00:00:32 10.64.0.1 FastEthernet0/010.2.1.1 0 FULL/ - 00:00:37 10.2.1.1 Serial0/0/1

R2#show ip ospf neighbor detailNeighbor 10.64.0.1, interface address 10.64.0.1

In the area 0 via interface FastEthernet1/0Neighbor priority is 1, State is FULL, 6 state changesDR is 10.64.0.1 BDR is 10.64.0.2

<output omitted>Neighbor 10.2.1.1, interface address 10.2.1.1

In the area 1 via interface Serial2/0Neighbor priority is 0, State is FULL, 6 state changesDR is 0.0.0.0 BDR is 0.0.0.0

<output omitted>

From this beginning, the remaining operations will take place one by one. The OSPF SPF algorithm defines all the rules and processes that make this work.

• Timers for retransmission of lost or corrupted packets

• Pacing parameters for how many updates can be sent one after the other

• Sequencing numbers for updates and acknowledgements to keep everything in rhythm All of these parameters can be verified with the show ip ospf interface and show ip ospf neighbor commands. The graphic shows DR and BDR for designated router and backup designated router. These will be described later.

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 5

Page 6: The Four Elements of OSPF

OSPF Metric

– Also called “cost”– Defined per interface, but may be altered– Inversely proportional to the bandwidth of that

interface– COST = 100,000,000 / bandwidth [b/s]

Link Type Default Cost64-kb/s serial link 1562

T1 (1.544-Mb/s serial link) 64

E1 (2.048-Mb/s serial link) 48

Ethernet 10

Fast Ethernet 1

ATM 1

The primary purpose of any IP routing protocol is to provide the “best” path to an IP destination address. (“Best” is expressed as a number called a metric.) The metric is calculated in a different way by each routing protocol. With OSPF, the SPF algorithm defines the OSPF cost as shown in the graphic.

• 100,000,000 divided by the link configured bandwidth.

• 100,000,000 is reference bandwidth and can be changed to a higher number with an IOS command. This

is necessary for the higher bandwidth services available in modern networks.

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 6

Page 7: The Four Elements of OSPF

OSPF Areas– Link-state routing requires a hierarchical network

structure– This two-level hierarchy consists of the following:

• Transit area (backbone or area 0)• Normal areas (nonbackbone areas)

OSPF is classified as a link state routing protocol. Link state routing protocols define areas and area types. This is sometimes called a two-layer area hierarchy. The backbone area is always numbered as area 0. And all other areas must connect to area 0. The areas connected to area 0 are regular or normal areas. Special area types will be described later.

Area Terminology and Router Types

– ABR: Area Border Router– ASBR: Autonomous System Boundary Router– R5, R6: Internal routers– R1: Backbone router

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 7

Page 8: The Four Elements of OSPF

With OSPF areas, specific router functions are defined: • Area Border Router (ABR) is a router connected to area 0 and one or more other areas • Autonomous System Boundary Router (ASBR) is a router connected to any regular area and another

routing domain • Backbone Router is a router in area 0 • Internal Router is a router in a regular area

Electing the DR and BDR– Hello packets are exchanged via IP multicast– DR: The router with the highest OSPF priority– BDR: The router with the second-highest priority

value– The OSPF router ID is used as the tiebreaker– The DR election is nonpreemptive

When OSPF is implemented on either an Ethernet LAN link or specific types of “shared cloud” WAN services that are not point-to-point, a DR and BDR are elected by OSPF as shown in the graphic. The purpose for this is to lower the number of OSPF neighbor adjacencies by making it more of a hub and spoke logical topology rather than a full mesh. Even though there is a full mesh of neighbors, adjacencies are only established to the DR and BDR. The DR is elected based on the OSPF priority on the interface. The default is 1 and raising it causes a router to automatically be elected. If the interface priorities are equal, the OSPF router ID (the highest is elected) is used. OSPF routers send routing information Link State Advertisements (LSAs) using multicast address 224.0.0.5. Non-designated routers (DR-OTHER) communicate with the DR using 224.0.0.6, and the DR relays info to the rest of the area routers.

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 8

Page 9: The Four Elements of OSPF

Construction of the OSPF Link-State Database

Building the LSDB

– The Hello protocol is used to define neighbors– Adjacency is established– Adjacent routers exchange LSAs– Each router builds an LSDB using LSAs

An OSPF router is directly connected to one or more OSPF routers in the same administrative domain, called an Autonomous System (AS). The Layer 2 connection between the routers is either an Ethernet or Wide Area Network (WAN) connection. Once the physical connection is in place, OSPF hellos will go back and forth every 10 seconds by default. With the proper matching of parameters (timers, security, area number, and area type) in the hello protocol, a neighbor relationship is established and a neighbor table and interface table are constructed.

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 9

Page 10: The Four Elements of OSPF

Link-State Data Structures: LSA Operation

The graphic shows the methodology each router uses to process an incoming OSPF LSA, typically an LSU packet. Sequence numbering is used to determine the most current information and avoid duplication. Since OSPF is a LSP, all LSAs are flooded throughout the autonomous system. There are multiple types of LSAs that will be described later.

Establishing Bidirectional Communication

224.0.0.5

At this point, an OSPF router starts a several-step loading process. Once the bi-directional state is established, the router moves to the next step as shown in the graphic.

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 10

Page 11: The Four Elements of OSPF

Discovering the Network Routes

If a designated router is to be elected (typically on Ethernet links) it will happen during the exstart (exchange start) step. From exstart, the router moves to the exchange state. To avoid a huge number of packets to exchange information about many destinations, a short cut method is used:

• The DBD packet contains a summary of known routes in the sending router database with no added detail on each one.

• The receiving router compares the routes in the summary to existing routes in its own database. If the

route is new, the receiving router asks for additional details with an LSR packet.

• The sending router then sends the details of all routes requested with an LSU packet.

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 11

Page 12: The Four Elements of OSPF

Adding the Link-State Entries

All DBD, LSR, and LSU packets are acknowledged for reliability. When all the LSRs have been satisfied for a given router, the adjacent routers are synchronized.

OSPF Neighbor States

•OSPF routers progress through seven states:– Down: no active neighbor detected– INIT: hello packet received– Two-way: own router ID in received hello– Exstart: master and slave roles determined– Exchange: database description packets sent– Loading: exchange of LSRs and LSUs– Full: neighbors fully adjacent

The graphic shows a summary of the router states during the OSPF loading process.

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 12

Page 13: The Four Elements of OSPF

LSA Type Description

1 Router LSAs

2 Network LSAs

3 or 4 Summary LSAs

5 Autonomous systemexternal LSAs

6 Multicast OSPF LSAs

7 LSAs defined for not-so-stubby areas

8 External attribute LSAs forBorder Gateway Protocol (BGP)

9, 10, 11 Opaque LSAs

LSA Types

The processes described so far have relied on LSAs to carry the routing protocol information. LSAs are defined by their source or originating devices. LSA type 6, 8, 9, 10, and 11 are outside the scope of this paper and rarely used in normal routing operations. Type 7 LSAs are used by a specific type of OSPF area called a Not So Stubby Area (NSSA), which will be described later.

OSPF LSDBR2#show ip ospf database

OSPF Router with ID (2.2.2.2) (Process ID 2)

Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum Link count 2.2.2.2 2.2.2.2 93 0x80000020 0xCD0B 2 3.3.3.3 3.3.3.3 1225 0x8000000D 0x9057 2

Summary Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 4.0.0.0 2.2.2.2 73 0x80000001 0xFFE6 5.0.0.0 2.2.2.2 1651 0x80000006 0x8466

Summary ASB Link States (Area 0) Link ID ADV Router Age Seq# Checksum 1.1.1.1 2.2.2.2 74 0x80000001 0x935C <output omitted>

Type-5 AS External Link States Link ID ADV Router Age Seq# Checksum Tag 9.0.0.0 1.1.1.1 135 0x80000001 0x3AE8 0

LSA Type 5from ASBR

LSA Type 4of ASBR

from ABR

LSA Type 3for area 0

LSA Type 1from area 0

As the LSAs are exchanged during the initial loading process and OSPF operations from then on, the OSPF LSDB is constructed and updated.

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 13

Page 14: The Four Elements of OSPF

The OSPF cost metric is used to select the best route for insertion into the routing table or RIB. Alternate routes may be available in the database for use if the best route fails. If an equal cost (metric) exists for two paths to the same destination (route), load balancing equal cost multi-pathing (ECMP) will be used. Since OSPF LSA flooding occurs with each topology change, it is necessary to control it to support network stability. Two methods are used:

• Route summarization at ABRs and ASBRs

• Stub areas (covered later)

Completing the Remaining OSPF Data Structures

OSPF tracks information using these data structures:

– Interface table: Active interfaces– Neighbor table: Discovered neighbors– Link-state database: Network topology

information– Routing information base: Results of the SPF

calculation

OSPF Data Structures

The RIB is maintained as part of the routing process memory by incremental routing updates after the initial loading process. This exchange of information necessary to maintain this table is called the control plane. Specific LSAs cause routes to appear in the OSPF routing table as follows:

• O Type 1 (router) and Type 2 (network) LSAs – Intra-area routes

• IA – Type 3 or 4 (summary) LSAs – Inter-area routes

• O- E – Type 5 (external) LSAs – External routes

• N – Type 7 (NSSA) LSAs - External routes in an NSSA area

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 14

Page 15: The Four Elements of OSPF

The following Cisco IOS commands can be used to gather information from the OSPF data structures or to analyze the flow of routing information in real time.

OSPF Commands

The Cisco IOS commands to see the contents of the various data structures are shown in the graphic. Once the tables are converged and stable, it is necessary to deal with changes in network topology (link failures, device failures), very quickly. With all of the real-time protocols in modern networks (voice, video, multi-cast), repair times are measured in milliseconds. Over the years, Cisco has evolved multiple features in the Cisco IOS to address this issue.

OSPF: DATA STRUCTURES

Control PlaneRouting Protocol

IP Routing Table (RIB)

IP Forwarding Table (FIB)

Exchange of Routing Information

CEFData Plane

Stored in fast memory cache or hardware

The latest in this evolution is Cisco Express Forwarding (CEF), which copies all of the contents of the RIB (routing table) to a fast “cache” in the fastest memory location possible, such as a line module in a 6500 or Nexus multi-

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 15

Page 16: The Four Elements of OSPF

layer switch. This table is called the Forwarding Information Base (FIB) and is in the data plane. It is the table actually consulted by the router when user data packets arrive on an interface and a routing decision is required. The FIB is refreshed by the RIB regularly. The only time the RIB is consulted is if there is a failure of the FIB to provide a routing entry.

Configuring and Verifying OSPF Implementation The configuration of OSPF on Cisco devices does not require in-depth understanding of all the underlying mathematical process that makes OSPF work, so the commands are simple. Verification and troubleshooting can be a bit more challenging, however. The skill is in understanding the output of verification commands.

Steps to Configure Basic OSPF– Configure OSPF routing processes on every OSPF

router• Define one or more processes globally on the router• Define the interfaces that OSPF will run on

• Or– Enable OSPF explicitly on an interface

The graphic shows an OSPF configuration steps for a simple network.

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 16

Page 17: The Four Elements of OSPF

Configuring OSPF for Multiple Areas

R1# R2#<output omitted>interface Fast Ethernet0/0ip address 10.64.0.1 255.255.255.0

<output omitted>router ospf 1network 10.0.0.0 0.255.255.255 area 0

<output omitted>interface Fast Ethernet0/0ip address 10.64.0.2 255.255.255.0

interface Serial 0/0/1ip address 10.2.1.2 255.255.255.0ip ospf 50 area 1

<output omitted>router ospf 50network 10.64.0.2 0.0.0.0 area 0

Global command for OSPF is router ospf {process ID}.

The network statement specifies which interfaces will participate in OSPF and the area in which the interface is located. The wildcard (inverse) mask can be used to identify interfaces more specifically. It is used in the same way here that it is in an access control list (ACL) with match/don’t care logic.

OSPF Router ID– The router is known to OSPF by the router ID number.– This router ID is used in LSDBs to differentiate one router from

the next.– OSPF requires at least one active interface with an IP address.– By default, the router ID is:

• The highest IP address on an active interface at the moment of OSPF process startup.

• If a loopback interface exists, the router ID is the highest IP address on any active loopback interface. A loopback interface overrides the OSPF router ID.

– The OSPF router-id command can be used to override the default OSPF router ID selection process.

– Using a loopback interface or a router-id command is recommended for stability.

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 17

Page 18: The Four Elements of OSPF

A critical feature in the OSPF routing process is the router ID. It must be unique for each OSPF router and is selected either automatically or via a command. It is used to identify the router sending OSPF LSAs in all databases as the “advertising router.” If it is automatically selected, the criteria are:

• By default, it is the highest IP address of a working interface.

• If loopback interfaces are configured when the OSPF process starts, the router will pick the highest loopback IP address.

If the router-id command is used, it overrides all dynamic options.

Configuring OSPF Special Area Types

OSPF Area Types and Structure– OSPF is based on a two-level hierarchical area

structure– Each area has its own topology database– Area Types

• Backbone area: Connects all other areas• Normal area: Contains all of the internal and external routing

information• Stub area: Contains internal and area routing information,

but not external routing information• Totally stubby area: Contains area routing information only;

Cisco proprietary• Not-so-stubby area: Contains area and external routing

information

The graphic provides a description of the OSPF special area types. The stub, and NSSA based on the RFCs will not be described. When running OSPF on a Cisco device, the Cisco proprietary totally stubby and NSSA totally stubby will almost always be implemented. The idea of stubbiness is the same as summarization. By inserting a default route (0.0.0.0) instead of external (O E) and Inter-area (O IA) routes, the most efficient routing table possible can be created in the area.

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 18

Page 19: The Four Elements of OSPF

OSPF Totally Stubby Areas– External and Summary LSAs are stopped– The default route is sent instead– Cisco proprietary feature

X

As the graphic shows, once the area routers are configured as totally stubby, only Intra-area routes and the default appear in the area router’s table. Remember the rules (no virtual link and no ASBR).

Totally Stubby Area Configuration

– This command turns on stub area networking– Configure all routers in the stub area as stub routers

– First command defines the totally stubby area on the ABR router– Second command defines the cost of a default route sent into the

totally stubby area (default is 1); defining the cost is optional

area 2 stub

R2(config-router)#

area 2 stub no-summaryarea 2 default-cost 10

ABR(config-router)#

The totally stubby configuration is shown in the graphic.

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 19

Page 20: The Four Elements of OSPF

Routing Table in a Totally Stubby Area– Use the area 1 stub command on all internal routers.– Use the area 1 stub no-summary command on the ABRs.

As the graphic shows, the routing table in a totally stubby router only has a minimal routing table. This leads to smaller more efficient tables and less routing traffic.

OSPF Totally NSSA Areas– ABR is blocking Type 3, 4, 5 LSAs– ABR is sending the default route into the NSSA instead– This is a Cisco proprietary feature

One of the rules imposed by the OSPF standards on totally stubby areas is the inability to use an ASBR. Since route redistribution is fairly common in most networks, this is a major restriction. The RFCs were revised to add a new area type the NSSA totally stubby. This area type allows the use of an ASBR in the area and introduces a new LSA type, LSA type 7, which was referred to but not described earlier. Cisco provides a proprietary feature to make the NSSA totally stubby, so that all summary (type 3/4) and external (type 5) are blocked and a default route is inserted instead.

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 20

Page 21: The Four Elements of OSPF

NSSA Area Configuration

– This command turns on NSSA area networking– Set on all routers in the NSSA area

– The first command defines the totally NSSA area on ABRs– The second command defines the cost of a default route sent

into the NSSA area (default is 1)

area 2 nssa

R2(config-router)#

area 2 nssa no-summaryarea 2 default-cost 10

ABR(config-router)#

All other attributes of the area are the same as totally stubby areas. The configuration is shown in the graphic. The argument “no-summary” is the Cisco proprietary feature to make it totally stubby.

– Verify OSPF routing protocol– Verify OSPF interface information– Verify OSPF neighbors– Verify OSPF routes learned by the router in the IP routing table– Verify configured IP routing protocol processes– Verify OSPF link state database (LSDB)

Steps to Verify Basic OSPF

R1# R2#<output omitted>interface Fast Ethernet0/0ip address 10.64.0.2 255.255.255.0

interface Serial 0/0/1ip address 10.2.1.2 255.255.255.0ip ospf 50 area 1

<output omitted>router ospf 50network 10.64.0.2 0.0.0.0 area 0

<output omitted>interface Fast Ethernet0/0ip address 10.64.0.1 255.255.255.0

<output omitted>router ospf 1network 10.0.0.0 0.255.255.255 area 0

• The OSPF routing protocol can be verified with the show ip protocols command. • The interface information can be verified with the show ip ospf interface command. • The neighbor information can be verified with the show ip ospf neighbor command. • The routes learned can be verified with the show ip route ospf command. • The configured ip routing protocol processes can be verified with the show ip protocols and show ip

ospf commands.

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 21

Page 22: The Four Elements of OSPF

• The OSPF link state database can be seen with the show ip ospf database command. • Debug ip ospf adjacency and debug ip ospf events are helpful debug commands.

Additional OSPF Features Not Described in Detail in This Paper

• OSPF authentication • Passive interfaces • Design limitations • Issues with NBMA and multipoint WANs • OSPF over MPLS • Route Redistribution • Route filtering • Troubleshooting • Route Summarization • OSPF design • OSPF Virtual Links

Learn More Learn more about how you can improve productivity, enhance efficiency, and sharpen your competitive edge through training.

ROUTE - Implementing Cisco IP Routing v1.0

ARCH - Designing Cisco Network Service Architectures v2.1

SWITCH - Implementing Cisco IP Switched Networks v1.0

TSHOOT - Troubleshooting and Maintaining Cisco IP Networks v1.0 Visit www.globalknowledge.com or call 1-800-COURSES (1-800-268-7737) to speak with a Global Knowledge training advisor.

About the Author Ray Dooley, BS, MBA, CCSI, CCNA, CCNP, CCDA, CCDP, SE, FE, has been a network professional in several capacities for over 30 years. He is the Global Knowledge Course Director for CCDA, ARCH, SWITCH, ROUTE, TSHOOT, and ICMI. He has done course development for Global Knowledge, Cisco Systems, and GE.

Copyright ©2014 Global Knowledge Training LLC. All rights reserved. 22