Вы находитесь на странице: 1из 73

Single Area OSPF

Objectives
Upon completing this lesson, you will be
able to:
Describe the features and operation of OSPF
Use Cisco IOS commands to configure
dynamic routing for a single area OSPF
network, given a functioning router
Use show and debug commands to identify
anomalies in dynamic routing operation using
OSPF, given an operational router
Overview

Link-state routing algorithms, also known as shortest path first (SPF)


algorithms, maintain a complex database of topology information.
Overview of Link-state Routing
Maintaining Routing Information
Link-state routing uses the
following features:

Link-state advertisements
(LSAs)

A topological database

The shortest path first


(SPF) algorithm

The resulting SPF tree

A routing table of paths


and ports to each network
to determine the best
paths for packets
Link-state Routing Algorithms
Open Shortest Path First
(OSPF)

Open Shortest Path First (OSPF) is a link-state routing protocol based on


open standards. It is described in (recently) RFC 2328
OSPF Terminology
Comparing OSPF with Distance
Vector Routing Protocols
Selects routes based on cost , a metric
based on bandwidth
Guarantees loop-free routing
Faster convergence
Support for Variable Length Subnet Mask
(VLSM)
Network size (no size limits)
Grouping of members
OSPF Issues

Speed of convergence
Only routing (link-state) changes
flooded
Not based on periodic updates
Processes updates efficiently
OSPF Issues (cont.)

Supports VLSM
RIPv1 is a classfull protocol and does
not support VLSM.
RIPv2 also supports VLSM
OSPF Issues (cont.)
Selects paths based on bandwidth
RIP broadcasts full routing table. This
is especially problems over slow
WAN links. OSPF multicasts
minimally sized link-state updates
send these updates only when there
is a network change
Supports equal-cost multipath
OSPF Issues (cont.)
Hierarchical Design (Area concept)
OSPF can effectively segment a
network into smaller clusters of
routers
Limits traffic regionally and prevent
changes in one area from affecting
performance in other areas.
OSPF in IP Packets
89 - OSPF
6 - TCP
17 - UDP

Frame Payload
C
Frame
IP Protocol R
Header Packet Payload
Header Number C

OSPF is a link-state routing protocol


Relies on IP packets for delivery of routing
information
Uses protocol number 89
OSPF Terminology
Link-state

Interfaces/ Links

Token
Ring
Link-State
Link : An interface on a router
The status of a link between two routers. Also
a routers interface and its relationship to its
neighboring routers
OSPF routers tell each other about the status
of their connections, or links to the
internetwork. In other words, OSPF routers
advertise their link states.
OSPF Terminology

Neighbors
Interfaces/ Links

Token
Ring
Neighbors
Two or more routers that have interface on
a common network. A neighbor
relationship is usually discovered and
maintained by the Hello protocol
Hello Protocol : Protocol used by OSPF to
establish and maintain neighbor
relationship.
OSPF Terminology

Neighbors
Interfaces/ Links
Cost = 10

Token
Ring
Cost = 1785 Cost = 6
Cost
The value assigned to a link. Rather than hops,
link-state protocols assign a cost to a link; for
OSPF on Cisco Routers, the cost is based on the
speed of the media. A cost is associated with the
output side of each router interface, referred to
as interface output cost.
Cisco default OSPF cost = 10^8/BW
(BW : Configured value on the interface with
bandwidth command)
With ip ospf cost command cost of an interface
may be changed.
OSPF Terminology

Neighbors
Interfaces/ Links
Area 1 Cost = 10
Area 0
Token
Ring
Cost = 1785 Cost = 6
Area
A collection of networks and routers that
have the same area identification. Each
router within an area has the same link-
state information. A router within an area
is an internal router
OSPF Terminology
Autonomous System

Neighbors
Interfaces/ Links
Area 1 Cost = 10
Area 0
Token
Ring
Cost = 1785 Cost = 6
Autonomous System
A group of routers exchanging routing
information using a common routing
protocol.
OSPF Terminology
Autonomous System

Neighbors
Interfaces/ Links
Area 1 Cost = 10
Area 0
Token
Ring
Cost = 1785 Cost = 6

Neighborship
Database
Lists Neighbors
Adjacencies (Neighborship)
Database
A listing of all the neighbors to which a
router has established bidirectional
communication using Hello protocol
OSPF Terminology
Autonomous System

Neighbors
Interfaces/ Links
Area 1 Cost = 10
Area 0
Token
Ring
Cost = 1785 Cost = 6

Neighborship Topology
Database Database
Lists Neighbors Lists All Routes
Link-state database
(Topological Database)
A list of link-state entries of all other
routers in the network. It shows the
network topology. All routers within an
area have identical link-state databases.
The link-state database is pieced together
from LSAs (Link-state advertisement)
generated by routers.
OSPF Terminology
Autonomous System

Neighbors
Interfaces/ Links
Area 1 Cost = 10
Area 0
Token
Ring
Cost = 1785 Cost = 6

Neighborship Topology Routing


Database Database Table
Lists Neighbors Lists All Routes Lists Best Routes
Routing table (also known as
the forwarding database)
Generated when the shortest path first
(SPF) algorithm (also known as the
Dijkstra algorithm) is run on the link-state
database. The content of each OSPF
routing table is unique.
OSPF Terminology
Autonomous System

DR
Neighbors
Interfaces/ Links
Area 1 Cost = 10
Area 0
Token
Ring
BDR
Cost = 1785 Cost = 6

Neighborship Topology Routing


Database Database Table
Lists Neighbors Lists All Routes Lists Best Routes
DR & BDR
Designated Router (DR)
A router that is elected by all other routers on
the same LAN to represent all the routers.
Serve as focal point for routing updates. Each
network has a DR and BDR.
Backup designated router (BDR)
Backup of the DR.
OSPF Operation
OSPF Topologies

(1)
Broadcast
Multiaccess

(2)
Point-to-Point

(3) X.25
Frame Relay
NBMA
OSPF Topologies
Others:
(4) point-to-multipoint
(5) virtual-links
OSPF Topologies (cont.)
Networks supporting more than two routers
attached together, with the capability of
addressing a single physical message (a
broadcast) to all attached routers. An ethernet
segment is an example of a broadcast
multiaccess network.

Broadcast
Multiaccess
OSPF Topologies (cont.)
A network that joins a single pair of routers. A T1
dedicated serial line is an example of a point-to-
point network.

Point-to-Point
OSPF Topologies (cont.)
Networks supporting many (more than two)
routers, but having no broadcast capability.
Frame Relay and X.25 are examples of
nonbroadcast multiaccess networks.

NBMA X.25
Frame Relay
OSPF Packet Header

Version, Type, and Packet Length - The first three fields of the OSPF packet let the
recipients know the version of OSPF that is being used by the sender (version 1 and 2),
the OSPF packet type, and length. OSPF version 2 was first introduced in 1991 (RFC
1247) and is not compatible with version 1, which is obsolete. The Cisco IOS uses OSPF
version 2 and cannot be configured to use OSPF version 1.
OSPF Packet Types
Type 1 Hello
Establishes and maintains adjaceny information iwth
neighbors
Type 2 Database Descripton Packet (DBD)
Describes the contents of an OSPF routers link state
database
Type 3 Link-state request (LSR)
Requests specific pieces of a routers link-state
database
OSPF Packet Types (cont.)
Type 4 Link-state (LSU)
Transports link-state advertisements (LSAs)
to neighbor routers
Type 5 Link-state acknowledgment
(LSAck)
Acknowledges receipt of a neighbors LSA.
OSPF Packet Header (cont.)

Router ID - The function of the hello packet is to establish and maintain adjacencies, so the sending router signs the
fourth field with its router ID, which 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 and the IP address must be unique within a network. Because routers
support multiple IP addresses, a loopback IP address is used as the router ID. In the absence of a loopback IP address,
the highest-value address interface IP is used as the router ID, regardless of whether that interface is involved in the
OSPF process.

If the interface associated with that IP address goes down, the router can no longer use that IP address as its router ID.
When a router's ID changes for any reason, the router must reintroduce itself to its neighbors on all links. To avoid the
unnecessary overhead caused by re-establishing adjacency and readvertising link states, an administrator typically
assigns an IP address to a loopback interface. Unless an administrator shuts down a loopback interface, it always stays
up, so loopback interfaces make ideal router IDs.

Note: If a loopback interface is configured with an IP address, the Cisco IOS will use that IP address as the router ID,
even if the other interfaces have higher addresses.
OSPF Packet Header (cont.)

Area ID - You can define multiple areas within an OSPF network to reduce and
summarize route information, which allows large and complex networks to continue to
grow. When configuring a single-area OSPF network, you should always use Area 0
because it is defined as the "backbone" area. You must have a backbone area to scale (add
other OSPF areas).
OSPF Packet Header (cont.)

Authentication Type and Authentication Data - OSPF supports different methods of


authentication so that OSPF routers will not believe just anyone sending hellos to
224.0.0.5. Routers with unequal authentication fields will not accept OSPF
information from each other.
OSPF Authentication Types
1. AuType = 0, Null (no authentication)
2. AuType = 1, Simple (clear text) Password authentication
3. AuType = 2, Cryptographic (MD5) Checksum
OSPF Operation in a Broadcast
Multiaccess Topology
Neighborship
D E

Hello

Router ID
*
B A C

Hello/dead intervals
Neighbors
afadjfjorqpoeru

*
39547439070713

Area-ID
Router priority
Hello DR IP address
BDR IP address
Authentication password *
*
Stub area flag

* Entry must match on neighboring routers


Neighborship (cont.)
D E

Hello

Router ID
*
B A C

Hello/dead intervals
Neighbors
afadjfjorqpoeru
39547439070713

Area-ID*
Router priority
Hello DR IP address
BDR IP address
Authentication password *
*
Stub area flag

* Entry must match on neighboring routers


Hello Packet

Network Mask - This 32-bit field carries subnet mask information for the
network.
Hello Interval and Dead Interval - The hello interval is the number of
seconds that an OSPF router waits to send the next hello packet. The
default for multiaccess broadcast and point-to-point networks is 10 seconds.
The 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 four times the hello interval by default,
or 40 seconds. Both of these intervals are configurable, which is the reason
they are advertised. If two routers have different hello intervals or if they
have different dead intervals, they will not accept OSPF information from
each other. Hellos are sent every 10 seconds by default on multiaccess and
point-to-point networks. On interfaces that connect to NBMA networks, such
as Frame Relay, hellos are sent every 30 seconds.
Hello Packet
(cont.)
Options - The router can use this field to indicate optional configurations,
including the stub area flag,
Router Priority - This field contains a value that indicates the priority of this
router when selecting a designated router (DR) and backup designated
router (BDR). The default priority is 1 and can be configured to a higher
number to ensure that a specified router becomes the DR.
Designated Router and Backup Designated Router - The router IDs of the
DR and BDR are listed here, if known by the source of the hello packet.
Neighbor Address - If the source of the hello packet has received a valid hello
from any neighbor within the dead interval, its router ID is included here.
DR and BDR

DR BDR

HelloselectDRandBDRtorepresentsegment
EachrouterthenformsadjacencywithDRandBDR
Electing the DR and BDR
P=3 P=2

DR BDR

Hello

P=1 P=1 P=0

Hello packets exchanged via IP multicast


Router with highest OSPF priority elected
Router ID breaks the tie if priorities are the same.
Router with highest Router ID become DR and the second is
BDR.
OSPF States
Down
Init
Two-way
Exstart
Exchange
Loading
Full adjaceny
Link-State Routing Algorithm
Link-state protocols are based on the Dijkstra algorithm,
sometimes referred to as the Shortest Path First (SPF)
algorithm.
Choosing Routes
10.1.1.0/24 10.2.2.0/24 10.3.3.0/24
Token
A Ring B FDDI C
Cost=6
Cost=1

Cost=10
10.4.4.0/24

Topology Table
Net Cost Out Interface
10.2.2.0 6 To0
10.3.3.0 7 To0 This is the best route to 10.3.3.0.
10.3.3.0 10 E0
Maintaining Routing Information
Link-State Change
DR

1 LSU

x A
B

Router A tells all OSPF DRs on 224.0.0.6


Maintaining Routing Information
2
Link-State Change
DR
LSU

1 LSU

x A
B

Router A tells all OSPF DRs on 224.0.0.6


DR tells others on 224.0.0.5
Maintaining Routing Information
2
Link-State Change
DR
LSU

1 LSU

x
3
B
A
LSU

Router A tells all OSPF DRs on 224.0.0.6


DR tells others on 224.0.0.5
Maintaining Routing Information
2
Link-State Change
DR
LSU

4 I need to update
my routing table.
1 LSU

x
3
B
A
LSU

Router A tells all OSPF DRs on 224.0.0.6


DR tells others on 224.0.0.5
Maintaining Routing Information
(cont.)
LSU
Is entry in Is seq. #
LSA link-state Ignore LSA
database? the same?
Yes Yes

No
No
A Add to database Go
Is seq. #
to
higher? Yes
Send LSAck A
to DR No

Flood LSA Send LSU


with newer
Run SPF to calculate information to
new routing table source

End End
Configuring OSPF in a Single
Area
Configuring OSPF on Internal
Routers
Broadcast Network Point-to-Point Network
E0 10.64.0.2 S0
10. 2.1.1
A 10.64.0.1 E0 B 10.2.1.2 C
S1

<OutputOmitted>
<OutputOmitted>
interfaceEthernet0
interfaceEthernet0
ipaddress10.64.0.1255.255.255.0 ipaddress10.64.0.2255.255.255.0
!
!
interfaceSerial0
<OutputOmitted>
ipaddress10.2.1.2255.255.255.0
routerospf1
<OutputOmitted>
network10.0.0.00.255.255.255area0
routerospf50
network10.2.1.20.0.0.0area0
network10.64.0.20.0.0.0area0

Can Assign Network or


Interface Address.
Configuring Optional
Commands
Unadvertised Loopback Address Advertised Loopback Address
Ex: 192.168.255.254 Ex: 172.16.17.5
Not in OSPF table In OSPF table
Saves address space Uses address space
Cannot use ping Can use ping

Network
172.16.0.0

Router ID:
Number by which the router is known to OSPF
Default: The highest IP address on an active interface at the
moment of OSPF process startup
Can be overridden by a loopback interface: Highest IP address of
any active loopback interface
Configuring Optional
Commands (cont.)
Traffic
Token
Ring
Cisco Non-Cisco
Router(config-if)#
ip ospf cost cost

Assigns a cost to an outgoing interface


May be required for interoperability
Use default cost between Cisco devices
Verifying OSPF Operation
Verifying OSPF Operation
Router#
show ip protocols

Verifies that OSPF is configured


Router#

show ip route

Displays all the routes learned by the router


Router#
show ip ospf interface

Displays area ID and adjacency information


Verifying OSPF Operation (cont.)
Router#

show ip ospf
Displays OSPF timers and statistics
Router#

show ip ospf neighbor detail

Displays information about DR, BDR


and neighbors
Router#

show ip ospf database

Displays the link-state database


Verifying OSPF Operation (cont.)
Router#

clear ip route *

Allows you to clear the IP routing table

Router#

debug ip ospf option

Displays router interaction during the


hello, exchange, and flooding processes
show ip ospf interface

R2#shipospfinte0
Ethernet0isup,lineprotocolisup
InternetAddress192.168.0.12/24,Area0
ProcessID1,RouterID192.168.0.12,NetworkTypeBROADCAST,
Cost:10
TransmitDelayis1sec,StateDROTHER,Priority1
DesignatedRouter(ID)192.168.0.11,Interfaceaddress
192.168.0.11
BackupDesignatedrouter(ID)192.168.0.13,Interfaceaddress
192.168.0.13
Timerintervalsconfigured,Hello10,Dead40,Wait40,
Retransmit5
Helloduein00:00:04
NeighborCountis3,Adjacentneighborcountis2
Adjacentwithneighbor192.168.0.13(BackupDesignatedRouter)
Adjacentwithneighbor192.168.0.11(DesignatedRouter)
Suppresshellofor0neighbor(s)
show ip ospf neighbor
Multiaccess and Point-to-Point

NeighborIDPri State DeadTimeAddress


192.168.0.131 2WAY/DROTHER00:00:31192.168.0.13Ethernet0
192.168.0.141 FULL/BDR 00:00:38192.168.0.14Ethernet0
192.168.0.111 2WAY/DROTHER 00:00:36 192.168.0.11Ethernet0
192.168.0.121 FULL/DR00:00:38192.168.0.12Ethernet0

OSPF over Ethernet - Multiaccess Network

NeighborIDPriStateDeadTimeAddressInterface
192.168.0.111FULL/00:00:3910.1.1.2Serial1

OSPF over HDLC - Point-to-Point Network


show ip ospf neighbor
NBMA Topology NBMA Mode

NeighborIDPri StateDeadTimeAddressInterface
192.168.0.121 FULL/DROTHER0:01:5610.1.1.2Serial0
192.168.0.130 FULL/DROTHER0:01:3410.1.1.3Serial0
192.168.0.111 FULL/BDR0:01:5610.1.1.1Serial0

OSPF over Frame RelayNBMA Mode


Using the neighbor Command
show ip ospf neighbor
NBMA Topology NBMA Mode

NeighborIDPriState DeadTimeAddressInterface
192.168.0.141FULL/DR 00:00:3010.1.1.4Serial0
192.168.0.131FULL/DROTHER 00:00:3610.1.1.3Serial0
192.168.0.121FULL/DROTHER 00:00:3910.1.1.2Serial0

OSPF over Frame RelayBroadcast Mode


show ip ospf database

R2#showipospfdatabase

OSPFRouterwithID(192.168.0.12)(ProcessID1)

RouterLinkStates(Area0)

LinkIDADVRouterAge Seq# Checksum Linkcount


192.168.0.10192.168.0.108170x80000003 0xFF56 1
192.168.0.11192.168.0.118170x80000003 0xFD55 1
192.168.0.12192.168.0.128160x80000003 0xFB54 1
192.168.0.13192.168.0.138160x80000003 0xF953 1
192.168.0.14192.168.0.148170x80000003 0xD990 1

NetLinkStates(Area0)

LinkIDADVRouterAgeSeq# Checksum
192.168.0.14192.168.0.148120x80000002 0x4AC8
debug ip ospf adj
192.168.0.14onEthernet0,state2WAY
OSPF:endofWaitoninterfaceEthernet0
OSPF:DR/BDRelectiononEthernet0
OSPF:ElectBDR192.168.0.14
OSPF:ElectDR192.168.0.14
DR:192.168.0.14(Id)BDR:192.168.0.14(Id)
OSPF:SendDBDto192.168.0.14onEthernet0seq0x11DBopt0x2flag0x7len32
OSPF:BuildrouterLSAforarea0,routerID192.168.0.11
OSPF:NeighborchangeEventoninterfaceEthernet0
OSPF:RcvDBDfrom192.168.0.14onEthernet0seq0x1598opt0x2flag0x7len32
stateEXSTART
OSPF:NBRNegotiationDone.WearetheSLAVE
OSPF:SendDBDto192.168.0.14onEthernet0seq0x1598opt0x2flag0x2len52
OSPF:RcvDBDfrom192.168.0.14onEthernet0seq0x1599opt0x2flag0x3len92
stateEXCHANGE
OSPF:ExchangeDonewith192.168.0.14onEthernet0
OSPF:SendDBDto192.168.0.14onEthernet0seq0x159Aopt0x2flag0x0len32
OSPF:Synchronizedwith192.168.0.14onEthernet0,stateFULL
OSPF:BuildrouterLSAforarea0,routerID192.168.0.11
OSPF:NeighborchangeEventoninterfaceEthernet0
OSPF:DR/BDRelectiononEthernet0
OSPF:ElectBDR192.168.0.13
OSPF:ElectDR192.168.0.14
DR:192.168.0.14(Id)BDR:192.168.0.13(Id)

Вам также может понравиться