OSPF
OSPF
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 1
Evolution of OSPF
▪ Open Shortest Path First (OSPF) is a link-state routing protocol that was
developed as a replacement for the distance vector routing protocol.
▪ Distance Vector use the hop count as the only metric for determining best route.
▪ Hop count does not scale well in larger networks with multiple paths of
varying speeds.
▪ OSPF has significant advantages over RIP in that it offers faster convergence
and scales to much larger network implementations.
▪ OSPF is a classless routing protocol that uses the concept of areas for
scalability.
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 2
Features of OSPF
▪ Classless - It is classless by design; therefore, it supports VLSM and CIDR.
▪ Efficient - Routing changes trigger routing updates (no periodic updates). It uses
the SPF algorithm to choose the best path.
▪ Fast convergence - It quickly propagates network changes.
▪ Scalable - It works well in small and large network sizes. Routers can be
grouped into areas to support a hierarchical system.
▪ Secure - It supports Message Digest 5 (MD5) authentication. When enabled,
OSPF routers only accept encrypted routing updates from peers with the same
pre-shared password.
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 3
Administrative
Distance
▪ Administrative distance (AD) is the
trustworthiness (or preference) of the
route source.
▪ OSPF has a default AD of 110.
▪ OSPF can be configured to authenticate
OSPF messages.
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 4
Components of OSPF
▪ Data Structures
OSPF creates and maintains three databases:
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 6
Introduction to the SPF
Algorithm
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 7
OSPF Metric
▪ Routing protocol uses a metric to determine the best path of a packet across a
network. It gives indication of the overhead that is required to send packets across a
certain interface.
▪ OSPF uses cost as a metric. A lower cost indicates a better path than a higher
cost.
▪ The cost of an interface is inversely proportional to the bandwidth of the interface.
• The default reference bandwidth is 10^8 (100,000,000); therefore, the formula is:
ITE PC v4.1• Cost = 100,000,000 bps / interface bandwidth in
Cisco Systems, Inc. bps, 2010 – 2007©
All rights Cisco
Chapter 1 . reserved Public 8
Link-State Routing Process
1. Each router learns the directly connected networks on it’s links. (Interface is
“up”)
2. Routers say (OSPF Hello packets) to its adjacent neighbors on directly connected
networks. (should be on the same autonomous , same network).
3. Each router builds a link-state packet (LSP) containing the state of each directly
connected link. (IP address , neighbor ID, link type, and bandwidth ” cost”)
4. Each router floods the LSP to all neighbors before storing all LSPs received in a
database. Neighbors will also flood the LSPs to their neighbors until all routers
in the area have received the LSPs.
5. Each router uses the database to construct a complete map of the topology and
computes the best path to each destination network using the SPF algorithm.
▪ All routers will have a common map or tree of the topology, but each router will
independently determine the best path to each network within that topology.
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 9
Step 1: Learning
About Directly
Connected Networks
When The link “router interface” is up and assigned an IP and a subnet mask.
◆ Directly connected networks are added to the routing table regardless of the
routing protocols used.
◆ Participate in routing process when included in the network statements. (same
routing protocol).
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 10
R2
I’m
Step 2: Sending ll o,
Hello Packets to Hello, I’m R1 He
Neighbors
Hello, I’m R3
He
llo
,I ’m
R4
▪ Initially:
• Router unaware of any neighbor routers on the link.
• Hello protocol “keep alive messages” are used discover OSPF neighbors and
establish adjacencies, advertise parameters that OSPF neighbors must agree on, and
elect the DR and BDR.
• Receiving no Hello packets from a neighbor considers it as unreachable and the
ITE PC v4.1
adjacency is broken. Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 11
Step 3: Building the
Link-State Packet
◆ Step 3: After establishing adjacency using hellos , each router builds and sends a
link-state packet (LSP) containing the state of each directly connected link out all
it’s interfaces adjacent to routers .
◆ R1 not sent LSPs out its Ethernet interface. (No routers with same routing
protocol).
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 12
◆ Link states – Router send Information about the state of a router’s links
include
• Interface IP address/mask.
• Type of network “Ethernet (broadcast) or serial point-to-point link”.
• Cost of that link.
ITE PC v4.1
Chapter 1
• Any neighbor routers on that link..Cisco Systems, Inc. All rights , 2010 – 2007 ©
reserved
Cisco
Public 13
Step 4:
Flooding
Link-
State
Packets to
Neighbors
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 14
Step 4:
Flooding
Link-
State
Packets
to
Neighbor
s
▪ Step 4: Each router floods the LSP to all neighbors, who then store all LSPs
received in a database.
• Each router floods its link-state information (LSP) to all other link-state routers.
• When a router receives an LSP from a neighboring router, sends that LSP out all
other interfaces, except the interface that received the LSP.
• Flooding effect of LSPs throughout the routing area.
▪ Link-state routing protocols calculate the SPF algorithm after the flooding is complete.
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 15
Step 5: Constructing a
Link-State Database
▪ At first, the tree (topology) only includes its directly connected neighbors.
▪ Using the link-state information from all other routers, R1 can now begin to
construct an SPF tree of the network with itself at the root of the tree.
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 17
Red: New information for
tree.
▪ The SPF algorithm begins by processing the following LSP information from R2:
Connected to neighbor R1 on network 10.2.0.0/16, cost of 20
Connected to neighbor R5 on network 10.9.0.0/16, cost of 10
Has a network 10.5.0.0/16, cost of 2
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 18
Determining the
Shortest Path
▪ Each router constructs its
own SPF tree independently
from all other routers.
▪ SPF algorithm is used now to
find the shortest path to each
network.
▪ Link-state databases must be
identical on all routers.
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 19
Generating a Routing Table from the SPF Tree
SPF Tree for R1
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 20
Single-Area and Multiarea OSPF
▪ An OSPF area is a group of routers that share the same link-state information in
their LSDBs. OSPF supports hierarchical routing using areas to make OSPF more
efficient and scalable.
▪ OSPF can be implemented in one of two ways:
• Single-Area OSPF - all routers are in one area called the backbone area (area
0).It’s useful in smaller networks with few routers.
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 21
Configuring
Single-Area
OSPFv2
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 22
Topology
Kbps 64
Kbps 128
Kbps 256
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 23
The router ospf
Command
R1(config)# router ospf 1
R1(config-router)#
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 24
The network
Command
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 25
▪ [wildcard-mask]
255.255.255.255
- 255.255.255.252
---------------
0. 0. 0. 3
Wildcard mask
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 26
Configure the network
Router-ID does NOT have to
Commands be the same on all routers
R1(config)# router ospf 1 Area-ID must
R1(config-router)# network 172.16.1.16 0.0.0.15 area 0 be the same
R1(config-router)# network 192.168.10.0 0.0.0.3 area 0 on all routers
R1(config-router)# network 192.168.10.4 0.0.0.3 area 0
R2(config)# router ospf 1
Wildcard
R2(config-router)# network 10.10.10.0 0.0.0.255 area 0 mask must
R2(config-router)# network 192.168.10.0 0.0.0.3 area 0 be used
R2(config-router)# network 192.168.10.8 0.0.0.3 area 0
R3(config)# router ospf 1
R3(config-router)# network 172.16.1.32 0.0.0.7 area 0
R3(config-router)# network 192.168.10.4 0.0.0.3 area 0
R3(config-router)# network 192.168.10.8 0.0.0.3 area 0
ITE PC v4.1 Cisco Systems, Inc. All rights , 2010 – 2007 © Cisco
Chapter 1 . reserved Public 27