You are on page 1of 85

1

Introduction To OSPF

Manjunath Krishna
Objectives 2

• Describe the background and basic features of OSPF


• Identify and apply the basic OSPF configuration
commands
• Describe, modify and calculate the metric used by OSPF
• Describe the Designated Router/Backup Designated Router
(DR/BDR) election process in multiaccess networks
• Describe the uses of additional configuration commands in
OSPF
Distance Vector VS Link State 3
Introduction 4
5
Introduction to OSPF
Background of OSPF
• Began in 1987
• 1989 OSPFv1 released in RFC 1131
This version was experimental & never deployed
• 1991 OSPFv2 released in RFC 1247
• 1998 OSPFv2 updated in RFC 2328
• 1999 OSPFv3 published in RFC 2740
Why OSPF? 6

• Vendor Neutral A.K.A Open Standard


• The Rise OF MPLS
• IP Fast Reroute
Why OSPF? 7

Vendor Neutral

• No Longer Cisco Only Networks


• Expand Purchasing With other vendors
• Heterogeneous Vendor Environment
• Open standard making vendor choice flexible
• Save CapEX and OPEX
Why OSPF? 8

Rise of MPLS

• PE/CE customer Protocol being OSPF or BGP


• Need Link state Protocols for Traffic Engineering in
MPLS
• Increased Scalability and ability to influence traffic path
• Need of Link state protocols for Traffic Engineering
Database
Why OSPF? 9

IP FAST REROUTE

• Fast Failover during Routing Failures


• Altenate route vs Multiple Routes
• Loop Free Alternatives
10
Introduction to OSPF

OSPF Message Encapsulation


• OSPF packet type
– There exist 5 types
• OSPF packet header
– Contains - Router ID and
area ID and Type code for
OSPF packet type
• IP packet header
Contains - Source IP
address, Destination IP
address, & Protocol field set to
89
11
Introduction to OSPF

Administrative Distance
• Default Administrative Distance for OSPF is 110
12

Basic Elements of OSPF


OSPF Characteristics 13

• Hierarchical Network Design with Areas


• Form Neighborship with Adjacent routers in same Area
• Advertise Status of the link with LSA’s
• Send LSA if change is Detected
• Use Djikstra Algorithm to determine shortest path
• Classless protocol Supporting VLSM
14
Link-State

Z’s Link-state
Q’s Link-state
Z

A Q 2
B Z 13
Q Y X 13
C

Topology information is
X stored in a DB separate
X’s Link-state from the routing table
Link-State Routing 15

• Neighbor discovery
• Construct a Link State Packet (LSP)
• Distribute the LSP
– Link State Announcement – LSA
• Route calculation
• If a link fails
– Flood new LSPs
– All routers recalculate their routing tables
Low Bandwidth Utilization 16

OSPF Routers

LSA

X R1

LSA

• Only propagate changes


• Use Multicast in multi-access networks
Using the Optimal Path 17

The optimal path is determined by adding the costs of


the interfaces : Cost = 10^8/(Bandwidth)
N2 CostEthernet
=1 Metro
CostEthernet
=1 N3
Metro

R2

R3

N1 R1 N5
Cost = 10
R4

N4 Cost = 10
Fast Convergence 18

• Detection plus LSA/SPF

R2

Alternate Path

N1
R1
X R3
N2

Primary Path
Fast Convergence 19

• Finding a new path


– Flood LSAs in the area
– Based in acknowledgements (Ack)
LSA
– Synchronized topology DB
– Each router calculates its routing table for each N1
destination network R1
X
Uses IP Multicast to Send/Receive changes 20

• Multi-Access networks
– All routers must accept packets sent to the AllSPFRouters (224.0.0.5)
address
– All DR and BDR routers must accept packets sent to the AllDRouters
(224.0.0.6) address
• Hello packets are sent to the AllSPFRouters address (Unicast
for point-to-point and virtual links)
21

SPF Algorithm/Djikstra Algorithm


Djikstra Algorithm 22
Djikstra Algorithm 23

• Find shortest path between the nodes in the graph


24

OSPF Areas
OSPF Areas 25

• Group of contiguous
nodes/networks
• Per area topology DB
Area 2 Area 3
– Invisible outside the area
– Reduces routing traffic
Area 0
• Backbone Area is contiguous Backbone Area
– All others areas must connect to the
backbone
• Virtual Links

Area 1
Area 4
26

OSPF States
OSPF States 27
OSPF States 28
29

Types OF Routers
Router Classification 30

IR

Area 2 Area 3

ABR/BR
Area 0
• Internal Router (IR)
IR/BR • Area Border Router (ABR)
ASBR
• Backbone Router (BR)
To another AS • Autonomous System Border
Area 1 Router (ASBR)
31

Types OF Routes
OSPF Route Types 32

Area 2 Area 0 Area 3

ABR Intra-Area Route


– All routes within an area
ASBR
Inter-Area Route
To Another AS – Routes announced from area to
another by an ABR

External Route
– Routes imported into OSPF from
another protocol or Static routes
33

DR/BDR Election
Designated Router (DR) 34

 One per multi-access network


Generates network links advertisements
Assists in DB synchronization
Backup
Designated Designated
Router Router

Designated Backup
Router Designated
Router
Designated Router by Priority 35

• Configured priority (per interface)


• Otherwise determined by the highest router ID
– The router ID is the loopback interface address, in
configured otherwise is the highest IP address

131.108.3.2 131.108.3.3

DR

R1 Router ID = 144.254.3.5 R2 Router ID = 131.108.3.3

144.254.3.5
Inter-Area Route Summarization 36

• Prefix or all subnets


• Prefix or all networks R2
• ‘Area range’ command
Metro Backbone
Ethernet
Area 0

With Network Next Hop R1 (ABR)


Summarization 1 R1
Area 1
Without Network Next Hop
Summarization 1.A R1
1.A 1.B 1.C
1.B R1
1.C R1
External Routes 37

• Redistributed into OSPF


• Flooded without changes throughout the AS
• OSPF supports two type of external metrics
– Type 1
– Type 2 (Default)

RIP
IGRP
EIGRP
OSPF BGP
etc.
Redistribute
External Routes 38

• Type 1 external metric: metrics are added to the


internal link cost To N1
External Cost = 1

Cost = 10
R1
To N1
R2 External Cost = 2

Cost = 8

R3
Network Type 1 Next Hop
N1 11 R2
N1 10 R3 Selected
Route
External Routes 39

• Type 2 external metric: metrics are compared without


adding the internal link cost To N1
External Cost = 1

Cost = 10
R1
To N1
R2 External Cost = 2

Cost = 8

R3
Network Type 2 Next Hop
N1 1 R2 Selected Route
N1 2 R3
Topology/Links-State DB 40

• A router has a separate DB for each area it belongs


• All routers within an area have an identical DB
• SPF calculation is done separately for each area
• LSA flooding is limited to the particular area
Protocol Functionality 41

• Bringing up adjacencies
• LSA Types
• Area Classification
The Hello Protocol 42

• Responsible to establish and maintain neighbor


relationships
• Elects designated router in multi-access networks

Hello

FDDI
Dual Ring
Hello Hello
The Hello Packet 43

• Router Priority
• Hello Interval
Hello
• Router dead interval
• Network mask FDDI
Dual Ring
• Options: T-bit, E-bit Hello Hello
• List of neighbors
Neighbor States 44

• 2-way
– The router sees itself in other Hello packets
– DR is selected from neighbors in state 2-way or greater

2-way

DR BDR
Neighbor States 45

• Full
– Routers are fully adjacent
– DB is synchronized
– Relationship to the DR and
BDR
Full

DR BDR
When to Become Adjacent 46

• Underlying network is point-to-point


• Underlying network type is virtual link
• The router itself is the DR
• The router itself is the BDR
• The neighboring router is the DR
• The neighboring router is the BDR
LSAs Propagate Along Adjacencies 47

DR BDR

• LSAs acknowledged along adjacencies


Routing Protocol Packets 48

• Share a common protocol header


• Routing protocol packets are sent with a TOS of 0
• Five types of OSPF routing protocol packets
– Hello – packet type 1
– DB Description – packet type 2
– Link-state request – packet type 3
– Link-state update – packet type 4
– Link-state Acknowledgment – packet type 5
OSPF Packet Types 49
Routing Protocol Packets 50

• Share a common protocol header


• Routing protocol packets are sent with a TOS of 0
• Five types of OSPF routing protocol packets
– Hello – packet type 1
– DB Description – packet type 2
– Link-state request – packet type 3
– Link-state update – packet type 4
– Link-state Acknowledgment – packet type 5
51

LSA Types
Different Types of LSAs 52

• Five LSA types


– Type 1 : Router LSA
– Type 2 : Network LSA
– Type 3 y 4: Summary LSA
– Type 5 y 7: External LSA
Different Types of LSAs 53
Router LSA (Type 1) 54

• Describes the state and cost of the router’s link to the


area
• All the router’s links in an area must be described in a
single LSA
• Flooded throughout the particular area and not beyond
• Router indicates whether it is an ASBR, ABR, or the
end point of a virtual link
Network LSA (Type 2) 55

• Generated for every transit broadcast or NBMA


network
• Describes all the routers attached to the network
• Only the DR originates this type of LSA
• Flooded throughout the area and not beyond
Summary LSA (Type 3 y 4) 56

• Describes a destination outside the area but still


within the AS
• Flooded throughout a single area
• Originated by an ABR
• Only intra-area routes are advertised into the
backbone (Area 0)
• Type 4 is the information about the ASBR
External LSA (Type 5) 57

• Defines routes to destinations outside the AS


• Default route is also sent as external
• Two Types of external LSA:
• E1: Considers the total cost of to the external destination
• E2: Considers only the cost of the outgoing interface to the
external destination
Not Summarized: Specific Link 58

• Specific link LSA advertised out


• Link state changes propagate out
ASBR External Links

Backbone
1.A Area #0 3.A
1.B 3.B
1.C 3.C
1.D 3.D
2.A
2.B
2.C
1.B 1.A 3.B
3.A
Token
Ring
Token
Token
Ring 2.B Token
Ring
Ring
Token
Ring
Token 3.C 3.D
1.D
1.C Ring
2.A

2.C
Summarized: Summary Links 59

• Only Summary LSA advertised out


• Link State changes do not propagate External Links
ASBR

Backbone
Area #0

1 3

1.B 1.A 3.B 3.A


Token
Token Ring Token Token
Ring 2.B Ring Ring
Token
Ring
1.D Token
3.C 3.D
1.C Ring
2.A
Not Summarized: Specific Links 60

• Specific Link LSA advertised in


• Links state changes propagate in
External Links
ASBR

1.A
2.A 1.B
2.B Backboen 1.C
2.C 1.A Area #0 1.D
3.A 1.B 2.A
3.B 1.C 2.B
3.C 1.D 2.C
3.D 3.A
3.B
3.C
3.D
1.B 1.A 3.B
3.A
Token Token
Token Ring
Ring
2.B Token
Ring
Ring
Token
Ring
3.D
1.D Token 3.C
1.C Ring
2.A

2.C
Summarized: Summary Links 61

• Specific Link LSA advertised in


• Link state changes propagate in
External Links
ASBR

Backbone
Area #0

2,3 1,2

1,3
1.B 1.A 3.B 3.A
Token
Ring Token
Token
2.B Ring Ring
Token
Ring
Token 3.D
Ring 1.D 3.C
1.C
2.A
Token
Ring
62

OSPF Areas
Regular Area (Not a stub) 63

From area 1’s point of view


• Summary networks from other areas injected
• External networks injected, for example network
X.1 ASBR X.1
External Networks
1,2
2,3

1,3

1.B 1.A 3.B 3.A


Token
X.1 Token
Ring
2.B 2.A Ring
Token
Ring X.1 1.D
Token
Ring

1.C X.1 Token


Ring
3.C
Token
Ring
2.D

3.D

2.C
Normal Stub Area 64

From area 1’s point of view


• Summary networks from other areas injected
• Default route injected into the area – represent external links
• Default path to closest ABR
• Define all routers in the area as stub
– area x stub command
External Networks
ASBR X.1

2,3 & Default 1,2

1,3

1.B 1.A 3.B 3.A


Token
X.1 Token
Ring
2.B 2.A Ring
Token
Ring X.1 1.D
Token
Ring

X.1 Token 3.D


1.C Token
Ring
2.D 3.C
Ring

2.C
Totally Stubby Area 65

From area 1’s point of view


• Only a default network is injected into the area
– Represents external networks and all inter-area routes
• Default route to the closest ABR
• Define all routers in the area as totally stubby External Networks
– area x stub no-summary command
ASBR X.1

Default 2&3 1,2

1,3

1.B 1.A 3.B 3.A


Token
X.1 Token
Ring
2.B 2.A Ring
Token
Ring X.1 1.D
Token
Ring

1.C X.1 Token


Ring
3.C
Token
Ring
2.D 3.D

2.C
Not-So-Stubby Area 66

• Capable of importing external routes in a limited fashion


• Type-7 LSAs carry external information within an NSSA
• NSSA border routers translate selected type-7 LSAs into
type -5 external network LSAs
External Networks

ASBR X.1

Default 2&3 1,2

1,3

1.B 1.A 3.B 3.A


Token Token

External
Ring
2.B 2.A Ring

X.2
Token
Ring X.1 1.D
Token
Ring
Networks X.1, X.2
1.C
Token
Ring
3.C 3.D
Token
Ring
2.D
X.1, X.2
2.C
67
Basic OSPF Configuration
The router ospf command
• To enable OSPF on a router use the following command
– R1(config)#router ospf process-id
– Process id
 A locally significant number between 1 and 65535
– -this means it does not have to match other OSPF
routers
68
Basic OSPF Configuration
• OSPF network command
– -Requires entering: network add
– wildcard mask - the inverse of the subnet mask
– area-id - area-id refers to the OSPF area. OSPF area is a
group of routers that share link state information
– -Example: Router(config-router)#network network-address
wildcard-ask area area-id
69
Basic OSPF Configuration

• Router ID
– This is an IP address used to identify a router
– 3 criteria for deriving the router ID
 Use IP address configured with OSPF router-id command
-Takes precedence over loopback and physical interface addresses
 If router-id command not used then router chooses highest IP
address of any loopback interfaces
 If no loopback interfaces are configured then the highest IP
address on any active interface is used
70
Basic OSPF Configuration

OSPF Router ID
• Commands used to verify current router ID
– Show ip protocols
– Show ip ospf
– Show ip ospf interface
Basic OSPF Configuration 71

OSPF Router ID
• Router ID & Loopback addresses
– -Highest loopback address will be used as router ID if router-id
command isn’t used
– -Advantage of using loopback address
– the loopback interface cannot fail  OSPF stability
• The OSPF router-id command
– Introduced in IOS 12.0
– Command syntax
 Router(config)#router ospfprocess-id
 Router(config-router)#router-idip-address
• Modifying the Router ID
– Use the command Router#clear ip ospf process
72
Basic OSPF Configuration

Verifying OSPF
• Use the show ip ospf command to verify & trouble shoot
OSPF networks
– Command will display the following:
 Neighbor adjacency
– -No adjacency indicated by -
 Neighboring router’s Router ID is not displayed
 A state of full is not displayed
– -Consequence of no adjacency-
 No link state information exchanged
 Inaccurate SPF trees & routing tables
73

Basic OSPF Configuration


Verifying OSPF - Additional Commands

Command Description

Displays OSPF process ID,


router ID, networks router is
Show ip protocols advertising & administrative
distance
Displays OSPF process ID,
router ID, OSPF area information
Show ip ospf & the last time SPF algorithm
calculated
Displays hello interval and dead
Show ip ospf interface interval
74

Basic OSPF Configuration


Examining the routing table
• Use the show ip route
command to display the
routing table
– -An “O’ at the beginning
of a route indicates that
the router source is
OSPF
– -Note OSPF does not
automatically summarize
at major network
boundaries
OSPF Metric 75

• OSPF uses cost as the metric for


determining the best route
– -The best route will have the
lowest cost
– -Cost is based on bandwidth of
an interface
 Cost is calculated using the
formula
– 108 / bandwidth
– -Reference bandwidth
 defaults to 100Mbps
 can be modified using
 auto-cost reference-bandwidth
command
76
OSPF Metric
• COST of an OSPF route
– Is the accumulated value from one router to the next
77
OSPF Metric

• Usually the actual speed of a link


is different than the default
bandwidth
– This makes it imperative that the
bandwidth value reflects link’s
actual speed
 Reason: so routing table has best
path information
• The show interface command
will display interface’s bandwidth
– -Most serial link default to
1.544Mbps
78
Basic OSPF Configuration

Modifying the Cost of a link


• Both sides of a serial link should be configured with the
same bandwidth
– Commands used to modify bandwidth value
 Bandwidth command
– Example: Router(config-if)#bandwidth bandwidth-kbps
 ip ospf cost command – allows you to directly specify interface
cost
-Example:R1(config)#interface serial 0/0/0
R1(config-if)#ip ospf cost 1562
79
Basic OSPF Configuration

Modifying the Cost of the link


• Difference between bandwidth command & the ip ospf cost
command
– Ip ospf cost command
 Sets cost to a specific value
– Bandwidth command
 Link cost is calculated
80
OSPF Network Types

• OSPF defines five


network types:
– Point-to-point
– Broadcast Multiaccess
– Nonbroadcast
Multiaccess (NBMA)
– Point-to-multipoint
– Virtual links
81
More OSPF Configuration

Fine-Tuning OSPF
• Since link speeds are getting
faster it may be necessary to
change reference bandwidth
values
– Do this using the auto-cost
reference-bandwidth
command
– Example:
 R1(config-router)#auto-cost
reference-bandwidth 10000
82
More OSPF Configuration

Fine-Tuning OSPF
• Modifying OSPF timers
– Reason to modify timers
 Faster detection of network failures
– Manually modifying Hello & Dead intervals
 Router(config-if)#ip ospf hello-interval  seconds
 Router(config-if)#ip ospf dead-interval seconds
– Point to be made
 Hello & Dead intervals must be the same between neighbors
83
Summary

• RFC 2328 describes OSPF link state concepts and


operations
• OSPF Characteristics
– A commonly deployed link state routing protocol
– Employs DRs & BDRs on multi-access networks
 DRs & BDRs are elected
 DR & BDRs are used to transmit and receive LSAs
– Uses 5 packet types:
– 1: HELLO
» 2: DATABASE DESCRIPTION
» 3: LINK STATE REQUEST
» 4: LINK STATE UPDATE
» 5: LINK STATE ACKNOWLEDGEMENT
»
Summary 84

• OSPF Characteristics
– Metric = cost
 Lowest cost = best path
• Configuration
– Enable OSPF on a router using the following command
 R1(config)#router ospf process-id
– use the network command to define which interfaces will
participate in a given OSPF process
 Router(config-router)#network network-address
wildcard-mask area area-id
Summary 85

• Verifying OSPF configuration


– Use the following commands
 show ip protocol
 show ip route
 show ip ospf interface
 show ip ospf neighbor

You might also like