You are on page 1of 47

Open Shortest Path First (OSPF) Protocol

& Operation Overview

Presented by Sai Nyan Lynn Swe


CCIE # 38501 (R&S, SP, DC)
VCIX-N
Technical Director
OPTIMITY CO Ltd
Open Standards Based Interior Gateway Routing Protocol
²  OSPFv2 - RFC 2328 “OSPF Version 2”

²  OSPFv3 - RFC 5340 “OSPF for IPv6”

²  Link-State Protocol

²  Uses Dijkstra SPF Algorithm

²  “Classless” Protocol

²  Supports VLSM And SummarizaPon


Why Use OSPF?
²  Guarantees Loop-Free Topology

²  All routers agree on overall topology

²  Uses Dijkstra SPF Algorithm for calculaPon

²  Standards Based

²  Inter-operability between vendors

²  Large Scalability

²  Hierarchy through “areas”

²  Topology summarizaPon
Why Use OSPF?
²  Fast Convergence

²  AcPvely Tracks Neighbor Adjacencies

²  Event Driven Incremental Updates

²  Efficient UpdaPng

²  Uses reliable mulPcast and unicast updates

²  Non-OSPF devices do not need to process updates

²  Bandwidth Based Cost Metric

²  More flexible than staPc hop count


Why Use OSPF?
²  Control Plane Security

²  Supports mulPple forms of authenPcaPon

²  E.g. Clear Text, MD5, SHA, IPsec, etc.

²  Extensible

²  Future applicaPon support through “opaque” LSA

²  E.g. MPLS Traffic Engineering


How OSPF Works
²  Step 1

²  Discover OSPF Neighbors & Exchange Topology InformaPon

²  Step 2

²  Choose Best Path via SPF

²  Step 3

²  Neighbor and Topology Table Maintenance


Step 1 – Neighbor & Topology Discovery
²  Like EIGRP, OSPF uses Hello packets to discover neighbors on OSPF enabled a_ached links

²  Transport via IP protocol 89 (OSPF)

²  Sent as mulPcast to 224.0.0.5 or 224.0.0.6, or unicast

²  More on this later…

²  Hello packets contain a_ributes that neighbors must agree on to form “adjacency”

²  Once adjacency is negoPated, LSDB is exchanged


Negotiating OSPF Adjacencies
²  OSPF adjacency occurs when connected neighbors use hello packets to agree on unique and
common a_ributes

²  Not all OSPF neighbors actually form adjacency

²  Most OSPF configuraPon problems happen at this stage


Unique OSPF Adjacency Attributes
²  Router-ID

²  Node ID in the Link State Graph

²  Chosen based upon…

²  Manual configuraPon

²  Highest acPve Loopback IP

²  Highest acPve Interface IP

²  Interface IP Address

²  For OSPFv2 the interface’s primary IP address

²  For OSPFv3 the interface’s link-local address


Common OSPF Adjacency Attributes
²  Interface Area-ID

²  Hello interval & dead interval

²  Interface network address

²  Interface MTU

²  Network Type

²  AuthenPcaPon

²  Stub Flags

²  Other opPonal capabiliPes


OSPF Hello Packets
²  OSPF routers periodically send Hello packets out OSPF enabled links every Hello Interval
²  Hello packet contains

²  Local Router-ID

²  Local Area-ID

²  Local Interface Subnet Mask

²  Local Interface Priority

²  Hello Interval

²  Dead Interval

²  AuthenPcaPon Type & Password

²  DR/BDR Addresses•OpPons (e.g. stub flags, etc.)

²  Router IDs of other neighbors on the link


OSPF Adjacency State Machine
Neighbor Discovery – Hello Protocol
No Hello packets received = Down
Down State Send Hello Packets
Transit to Init state

Hello packets received from the neighbor and it


Init State contains the initial router’s router ID.
Transit to two-way state

(Optional) DR and BDR election


Two-Way State Transit to ExStart state

Database Synchronization
Negotiate master / slave relationship and DBD
ExStart State packet sequence number


More LSAs
required
No
Yes
DBD exchanged as LSAs are requested and sent
Exchange State Transit to either Loading or Full state after
completing the database description

Newly learned routes are asked for and current


Loading State database is being processed

Route Calculations
Router is synchronized with the neighbor and
Full State route calculations using the SPF algorithm begins
Neighbor Discovery – Hello Protocol
.1 172.16.5.0 /24 .2
R1 Fa0/0 Fa0/1 R2

Down State

ATempt State

Hello! I’m router ID 172.16.5.1. Is there anyone else on this link?


Init State *
Hello

Hello! I’m router ID 172.16.5.2 and I see 172.16.5.1.


Unicast to R1
*
Hello
R2 neighbor list:
172.16.5.1, int Fa0/1

R1 neighbor list:
172.16.5.2, int Fa0/0

Two-Way State
Database Synchronization & Route Calculation
.1 172.16.5.0 /24 .2
R1 Fa0/0 Fa0/1 R2

I will start the exchange because I have router ID 172.16.5.1.


ExStart State *
Hello
No, I will start the exchange because I have a higher router ID.
*
Hello

Exchange State
Here is a summary of my link-state database.
*
DBD
Here is a summary of my link-state database.
*
DBD

Thanks for the information!


*
LSAck
*
LSAck

I need more information on the 172.16.6.0 network.


Loading State
*
LSR
Here is the entry for 172.16.6.0/24.
*
LSU
Thanks for the information!
*
LSAck
Full State
Step 2 – Choose Best Path via SPF
²  Once databases are synchronized, path selecPon begins

²  Each router’s LSAs include a “cost” a_ribute for each described link

²  Best path to that link is lowest end-to-end cost

²  MulPple Equal Cost paths are allowed (ECMP)

²  Cisco’s implementaPon uses bandwidth based cost, but per RFC it is arbitrary

²  Default Cisco Cost = 100Mbps / Link Bandwidth

²  Reference bandwidth can be modified to accommodate higher speed links (e.g.

TenGigabitEthernet)
Step 3 – Neighbor & Topology Maintenance
²  Once adjacencies established and SPT built, OSPF state machine tracks neighbor and topology
changes

²  Hello packets used to track neighbor changes

²  LSA fields used to track topology changes


Step 3 – Neighbor & Topology Maintenance
²  Once adjacencies established and SPT built, OSPF state machine tracks neighbor and topology
changes

²  Hello packets used to track neighbor changes

²  LSA fields used to track topology changes


Tracking Neighbor Changes
²  Hello packets conPnue to be sent on each OSPF enabled link every HelloInterval

²  10 or 30 seconds by default depending on interface type

²  If a Hello packet is not received from a neighbor within RouterDeadInterval, the neighbor is
declared down

²  Defaults to 4 Pmes HelloInterval

²  Can be as low as 1 second for faster convergence


Tracking Topology Changes
²  When a new LSA is received it is checked against the database for changes such as

²  Sequence number

²  Used to track new vs old LSAs

²  Age

²  Used to keep informaPon new and withdraw old informaPon

²  Periodic flooding occurs amer 30 minutes–“paranoid” update

²  LSAs that reach MaxAge (60 minutes) are withdrawn

²  Checksum

²  Used to avoid transmission & memory corrupPon


LSA Flooding
²  When change is detected new LSA is generated and “flooded” (sent) out all links

²  OSPF does not use split horizon

²  Self-originated LSAs are simply dropped

²  Not all LSA changes require SPF to recalculate

²  e.g. link up/down event vs. seq number change

²  See RFC 2328 “13. The Flooding Procedure” for details


OSPF Single Area Configuration
²  Configuring Basic OSPF

²  Verifying OSPF Adjacencies

²  Verifying the OSPF Database


OSPF Prerequisites
²  IP rouPng must be enabled

²  I.e. ip rouPng

²  Must be an “up/up” interface running IP

²  Used for OSPF Router-ID


Enabling OSPF
²  Enable global OSPF process

²  router ospf [process-id]

²  Process-id locally significant

²  ExcepPon is MPLS L3VPN

²  Enable interface OSPF process

²  Process level

²  network [address] [wildcard] area [area-id]

²  Interface level

²  ip ospf [process-id] area [area-id]


OSPF Network Statement
²  Useful for enabling OSPF on mulPple interfaces

²  Wildcard mask does not relate to subnet mask

²  Most specific match determines the area

²  network 0.0.0.0 255.255.255.255 area 0

²  network 1.0.0.0 0.255.255.255 area 1

²  network 1.2.0.0 0.0.255.255 area 2

²  network 1.2.3.0 0.0.0.255 area 3

²  network 1.2.3.4 0.0.0.0 area 4


OSPF Interface Statement
²  Enables OSPF on the primary and secondary IP addresses

²  Secondary adverPsement can be disabled

²  OSPF stays enabled even if IP address changes


OSPF Verification
²  Verify OSPF is enabled

²  show ip ospf

²  show ip ospf interface [brief]

²  Verify OSPF adjacencies

²  show ip ospf neighbor

²  debug ip ospf adj

²  Verify OSPF database

²  show ip ospf database [router | network | summary | … ]


Troubleshooting OSPF Adjacencies
Troubleshooting OSPF Adjacencies
²  Understanding the OSPF State Machine

²  InterprePng show commands

²  InterprePng debug commands


Troubleshooting OSPF Adjacencies
²  Where can problems arise?

²  Transport problems

²  A_ribute negoPaPon problems

²  Useful troubleshooPng commands

²  show ip ospf neighbor

²  show ip ospf database

²  debug ip ospf adj

²  debug ip packet

²  Use with cauPon


OSPF Adjacency State Machine
²  Normal OSPF Adjacency State Machine Order

²  Down/A_empt

²  Init

²  2-Way

²  Stop here for DROthers

²  ExStart

²  Exchange

²  Loading

²  Full
OSPF Adjacencies Attributes
²  Unique OSPF Adjacency A_ributes
²  Router-ID

²  Interface IP Address

²  Common OSPF Adjacency A_ributes


²  Interface Area-ID

²  Hello interval & dead interval

²  Interface network address

²  Interface MTU

²  Network Type

²  AuthenPcaPon

²  Stub Flags

²  Other opPonal capabiliPes


OSPF Areas and LSAs
²  Scaling OSPF with Areas
²  OSPF LSA Types

²  OSPF Path SelecPon


²  Intra-Area Path SelecPon

²  Inter-Area Path SelecPon

²  External Path SelecPon


OSPF Areas Overview
²  Areas add hierarchy and scalability to OSPF

²  An area defines a flooding domain

²  All devices in the area agree on the topology

²  Changes inside the area require LSA flooding and full SPF

²  RouPng between areas hides topology details

²  Inter-area rouPng is similar to distance vector

²  Changes outside the area don’t always require LSA flooding or SPF

²  Limits impact on router resources


OSPF Two-Level Hierarchy
²  Backbone area

²  Area 0 (0.0.0.0)

²  Used to summarize topology informaPon between other areas

²  Traffic from one area to another must pass through area 0

²  Must be conPguous

²  Non-backbone areas

²  All other areas 1 – 232 (0.0.0.1 – 255.255.255.255)

²  Must use connecPons to area 0 to reach other areas


OSPF Router Types
²  Backbone routers

²  At least one link in area 0

²  Internal routers

²  All links in one non-backbone area


OSPF Router Types
²  Area Border Router (ABR)

²  Links in both area 0 and in non-backbone area(s)

²  Used to summarize informaPon between area 0 and non-backbone area

²  Autonomous System Boundary Router (ASBR)

²  At least one link in the OSPF domain•At least one link outside the OSPF domain

²  EIGRP, IS-IS, BGP, etc.

²  Used to redistribute informaPon to/from other rouPng domains and OSPF


OSPF LSA Types
²  With different router types in the OSPF domain, different types of adverPsements are
required
²  e.g DR, ABR, ASBR, etc.

²  Different LSA formats used to represent this informaPon


²  Format is defined by type code

²  Type 1, type 2, etc.

²  Which LSA types are sent and received depends on


²  Router’s type

²  OSPF network type

²  Area type
OSPF LSA Types
²  LSA types are…

²  Type 1 – Router LSA

²  Type 2 – Network LSA

²  Type 3 – Network Summary LSA

²  Type 4 – ASBR Summary LSA

²  Type 5 – External LSA

²  Type 7 – NSSA External LSA

²  Type 6 – MulPcast LSA


²  MOSPF not implemented by most vendors

²  Types 8, 9, 10 – Opaque LSA


²  Used for extensibility

²  E.g. MPLS Traffic Engineering


LSAs and Route Types
²  LSAs are grouped together by 3 route types…

²  Intra-Area Routes (O)


²  LSA Types 1 & 2
²  Inter-Area Routes (O IA)
²  LSA Types 3 & 4

²  External Routes
²  E1/E2
²  LSA Type 5

²  N1/N2
²  LSA Type 7
LSA Type 1 – Router LSA
²  Generated by every router in the OSPF domain
²  Not flooded outside the area they originate in

²  Describes its directly connected links


²  What are my link costs

²  Who are my neighbors

²  Used to build the graph for intra-area SPF


LSA Type 2 – Network LSA
²  Generated by the Designated Router (DR) on broadcast and non-broadcast network types
²  Not flooded outside the area they originate in

²  Describes who is adjacent with the DR


²  What is my link cost to the DR

²  Implies my link cost to all others adjacent to that DR

²  Used to reduce redundant informaPon in the database


²  n*(n-1)/2 and flooding scalability issue
LSA Type 3 – Network
²  Generated by ABR
Summary LSA
²  Flooded from area 0 into non-backbone areas and vice-versa

²  Describes ABR’s reachability to links in other areas


²  Includes cost, but hides ABR’s actual path to desPnaPon

²  SPF not run for ABR adverPsed routes


²  ABR can reach link A via SPT in cost X

²  I can reach ABR via SPT in cost Y

²  Implies I can reach link A via SPT in cost X + Y

²  This is why inter-area rouPng is like distance vector


LSA Type 5 – External
²  Generated by ASBR
LSA
²  Flooded to all non-stub areas

²  Describes routes ASBR is redistribuPng


²  Metric

²  Metric Type

²  Type 1 = E1

²  Type 2 = E2 (default)

²  Forward Address
²  Who should I route towards to reach the link?

²  Usually the ASBR itself, but could be someone else in some designs

²  Route Tag
OSPF External Type 1 vs. Type 2
²  External route type controls how metric for external link is calculated
²  Type 1 (E1)
²  Take the cost the ASBR reports in plus the cost to the ASBR

²  Type 2 (E2)
²  Take just the cost the ASBR reports in

²  If there is a Pe, then take the cost to the ASBR as well

²  Type 1 is preferred over Type 2


²  More on manipulaPng path selecPon later…
LSA Type 7 – NSSA External LSA
²  Generated by ASBR inside a Not-So-Stubby-Area

You might also like