03 OSPF_explained_Final
03 OSPF_explained_Final
Interfaces
Token
Ring
OSPF Terminology
Neighbors
Interfaces
Token
Ring
OSPF Terminology
Neighbors
Interfaces
Cost = 10
Token
Ring
Cost = 1785 Cost = 6
OSPF Terminology
Neighbors
Interfaces
Area 1 Cost = 10
Area 0
Token
Ring
Cost = 1785 Cost = 6
OSPF Terminology
Autonomous System
Neighbors
Interfaces
Area 1 Cost = 10
Area 0
Token
Ring
Cost = 1785 Cost = 6
OSPF Terminology
Autonomous System
Neighbors
Interfaces
Area 1 Cost = 10
Area 0
Token
Ring
Cost = 1785 Cost = 6
Neighborship
Database
Lists Neighbors
OSPF Terminology
Autonomous System
Neighbors
Interfaces
Area 1 Cost = 10
Area 0
Token
Ring
Cost = 1785 Cost = 6
Neighborship Topology
Database Database
Lists Neighbors Lists All Routes
OSPF Terminology
Autonomous System
Neighbors
Interfaces
Area 1 Cost = 10
Area 0
Token
Ring
Cost = 1785 Cost = 6
Interconnects
areas;
accepts all
LSAs.
Types of Areas
Stub Area Backbone
Area 0
Interconnects
Does not accept
areas;
external LSAs.
accepts all
LSAs.
Types of Areas
Stub Area Backbone Totally Stubby
Area 0 Area
Interconnects
Does not accept Does not accept
areas;
external LSAs. external or
accepts all
LSAs. summary LSAs.
Backbone Area
A backbone area is the logical and physical structure
for the Autonomous System and is attached to
multiple areas.
Note
All OSPF routers inside a stub area have to be configured as stub routers
because whenever an area is configured as stub, all interfaces that belong to
that area will start exchanging hello packets with a flag that indicates that
the interface is stub. Actually this is just a bit in the hello packet (“E” bit)
that gets set to 0. All routers that have a common segment have to agree on
that flag. If the routers don’t agree, then they will not become neighbors and
routing will not take effect.
Stub and Totally
Stubby Area Restrictions
Area 2
0.0.0.0
R3
R4
Virtual Link
Area 1 Area 2
Transit
Area
Area
Area33
Area 0 Area 0
Area 3
External
AS
Types of OSPF Routers
Area 1 Backbone Area 0 Area 2
Internal
Routers
Internal
Routers
External
AS
Types of OSPF Routers
Area 1 Backbone Area 0 Area 2
Backbone/
Internal
Internal Routers
Routers
Internal
Routers
External
AS
Types of OSPF Routers
Area 1 Backbone Area 0 Area 2
ABR and
Backbone
Router Backbone/
Internal
Internal Routers
Routers
Internal
Routers
ABR and
Backbone
Router
External
AS
Types of OSPF Routers
Area 1 Backbone Area 0 Area 2
ABR and
Backbone
Router Backbone/
Internal
Internal Routers
Routers
Internal
Routers
Full Mesh
Partial Mesh
DR BDR
Hello
Link-State Change
DR
1 LSU
x A
B
1 LSU
x A
B
2
Link-State Change
DR
LSU
1 LSU
x
3
B
A
LSU
4 I need to update
my routing table.
1 LSU
x
3
B
A
LSU
Hello
B A C
Router ID
afadjfjorqpoeru
39547439070713 Neighbors
*
Hello/dead intervals
Area-ID*
Router priority
Hello DR IP address
BDR IP address
Authentication password *
*
Stub area flag
Hello
B A C
Router ID
afadjfjorqpoeru
39547439070713 Neighbors
*
Hello/dead intervals
Area-ID*
Router priority
Hello DR IP address
BDR IP address
Authentication password *
*
Stub area flag
• Down
• Attempt
• Init
• 2-way
• Exstart
• Exchange
• Loading
• Full
Exchange Process
172.16.5.1/24 172.16.5.2/24
A B
E0 E1
Down State
Exchange Process
172.16.5.1/24 172.16.5.2/24
A B
E0 E1
Down State
I am router ID 172.16.5.1 and I see no one.
Init State
Router B
Neighbors List
172.16.5.1/24, int E1
Exchange Process
172.16.5.1/24 172.16.5.2/24
A B
E0 E1
Down State
I am router ID 172.16.5.1 and I see no one.
Init State
Router B
Neighbors List
172.16.5.1/24, int E1
I am router ID 172.16.5.2, and I see 172.16.5.1.
Exchange Process
172.16.5.1/24 172.16.5.2/24
A B
E0 E1
Down State
I am router ID 172.16.5.1 and I see no one.
Init State
Router B
Neighbors List
172.16.5.1/24, int E1
I am router ID 172.16.5.2, and I see 172.16.5.1.
Router A
Neighbors List
172.16.5.2/24, int E0
Two-Way State
Discovering Routes
DR
E0 E0
172.16.5.1 172.16.5.3
afadjfjorqpoeru
Exstart State
39547439070713
afadjfjorqpoeru
afadjfjorqpoeru
afadjfjorqpoeru
39547439070713
Loading State
afadjfjorqpoeru
39547439070713
Loading State
No
Add to database
Send LSAck
to DR
Flood LSA
End
Maintaining LSA Information
LSU
Is entry in Is seq. #
LSA link-state Ignore LSA
database? the same?
Yes Yes
No
Add to database
Send LSAck
to DR
Flood LSA
End
Maintaining LSA Information
LSU
Is entry in Is seq. #
LSA link-state Ignore LSA
database? the same?
Yes Yes
No
No
Add to database
Is seq. #
higher?
Send LSAck
to DR No
End End
Maintaining LSA Information
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
End End
OSPF Interface states
• An OSPF-enabled interface will
transition through several states before
it becomes fully functional.
– Down
– Point-to-Point
– Waiting
– DR
– Backup
– DRother
– Loopback
Interface states: Down
Down This is the initial interface
state. The interface is not
functional, all interface parameters
are set to their initial values, and
no protocol traffic is transmitted or
received on the interface.
Interface states: Point-to-point
Point-to-Point This state is applicable
only to interfaces connected to point-to-
point, point-to-multipoint, and virtual
link network types. When an interface
transitions to this state, it is fully
functional. It will begin sending Hello
packets every HelloInterval and will
attempt to establish an adjacency with
the neighbor at the other end of the
link.
Interface states:Waiting
• Waiting This state is applicable only to
interfaces connected to broadcast and
NBMA network types. When an interface
transitions to this state, it will begin
sending and receiving Hello packets and
will set the wait timer. The router will
attempt to identify the network's DR
and BDR while in this state.
Interface states: DR
• DR In this state, the router is the
DR on the attached network and
will establish adjacencies with the
other routers on the multi-access
network.
Interface states: Backup
• Backup In this state, the router is
the BDR on the attached network,
and will establish adjacencies with
the other routers on the multi-
access network.
Interface states: DRother
• DRother In this state, the router is
neither the DR nor the BDR on the
attached network. It will form
adjacencies only with the DR and
BDR, although it will track all
neighbors on the network.
Interface states: Loopback
• Loopback In this state, the
interface is looped back via
software or hardware. Although
packets cannot transit an interface
in this state, the interface address
is still advertised in Router LSAs,
so that test packets can find their
way to the interface.
OSPF Header
OSPF packet encapsulations
OSPF Header and packet
Types
All OSPF protocol packets share a
common protocol header.
There are several OSPF packet types
– Hello Packet
– Database Description Packet
– Link-State Request Packet
– Link-State Update Packet
– Link-State Acknowledgment Packet
OSPF Common Packet
Header
OSPF Packet Header
Version (1 octet) This field details the current version
of OSPF used by the local router. It is set to a value of 2,
the default value.
Type (1 octet) This field specifies the type of OSPF
packet. Possible values include:
1- Hello packet
2- Database descriptor
3- Link-state request
4- Link-state update
5- Link-state acknowledgment
Packet Length (2 octets) This field displays the total
length, in octets, of the OSPF packet.
.
OSPF Packet Header
Router ID (4 octets) The router ID of the advertising
router appears in this field.
Area ID (4 octets) This field contains the 32-bit area ID
assigned to the interface used to send the OSPF packet.
Checksum (2 octets) This field displays a standard IP
checksum for the entire OSPF packet, excluding the 64-
bit authentication field.
Authentication Type (2 octets) The specific type of
authentication used by OSPF is encoded in this field.
Possible values are:
0-Null authentication
1-Simple password
2-MD5 cryptographic authentication
Authentication (8 octets) This field displays the authentication data to
verify the packet's integrity.
OSPF Packet Types
OSPF Packet Types
TypePacket Name Protocol
Function
1 Hello Discover /
Maintain
Neighbors
2 Database Summarize
Description Database
Contents
OSPF Packet Types cont..
TypePacket Name Protocol
Function
3 Link State Database
Request Download
4 Link State Database
Update Update
5 Link State Flooding
Ack Ack
Type 1 - OSPF Hello Packet
Hello Packet
• Hello is sent to establish and maintain a neighbor
relationship
• Hello packets are sent out all configured interfaces
and await a response
• Hello packet, type code 1, is addressed to the
AllSPFRouters multicast address of 224.0.0.5 for
broadcast and point-to-point connections
• All other type networks unicast Hello.
OSPF Hello Packet
OSPF Hello Packet
• Version. Identifies the OSPF version running on the
router originating the hello packet
• Packet length. Provides the total length of the hello
packet
• Router ID. Contains the originating router identification
number of the appropriate interface
• Area ID. Contains the area number to which the
originating router belongs
• Checksum. This section is, of course, used to ensure the
packets integrity has not been comprised during
transmission.
• Network Mask (4 octets) This field contains the subnet
mask of the advertising OSPF interface. Unnumbered point-
to-point interfaces and virtual links set this value to 0.0.0.0.
• Hello Interval (2 octets) This field displays the value of the
hello interval requested by the advertising router. Possible
values range from 1 to 255, with a default value of 10
seconds.
OSPF Hello Packet
Options (1 octet) The local router advertises its capabilities in
this field. Each bit in the Options field represents a different
function. The various bit definitions are:
Bit 7 The DN bit is used for loop prevention in a Virtual Private Network (VPN) environment.
An OSPF router receiving an update with the bit set does not forward that update.
Bit 6 The O bit indicates that the local router supports opaque LSAs.
Bit 5 The DC bit indicates that the local router supports Demand Circuits.
Bit 4 The EA bit indicates that the local router supports the External Attributes LSA for carrying
BGP information in an OSPF network.
Bit 3 The N/P bit describes the handling and support of not-so-stubby LSAs.
Bit 2 The MC bit indicates that the local router supports multicast OSPF LSAs.
Bit 1 The E bit describes the handling and support of external LSAs.
Bit 0 The T bit indicates that the local router supports TOS routing functionality.
OSPF Hello Packet
• Router Priority (1 octet) This field contains the priority of the local router.
The value is used in the election of the designated router and backup
designated router. Possible values range from 0 to 255, with a default value
of 128.
• Router Dead Interval (4 octets) This field shows the value of the dead
interval requested by the advertising router. Possible values range from 1 to
65,535.
• Designated Router (4 octets) The interface address of the current
designated router is displayed in this field. A value of 0.0.0.0 is used when
no designated router has been elected.
• Backup Designated Router (4 octets) The interface address of the current
backup designated router is displayed in this field. A value of 0.0.0.0 is used
when no backup designated router has been elected.
• Neighbor (Variable) This field displays the router ID of all OSPF routers
for which a hello packet has been received on the network segment.
Database Description Packet
• After discovering its neighbors, the local router
begins to form an adjacency with each neighbor.
• This adjacency process requires that each router
advertise its local database information.
• The DD packet, type code 2, summarizes the local
database by sending LSA headers to the remote
router.
• The remote router analyzes these headers to
determine whether it lacks any information within
its own copy of the link-state database
DD Packet
DD Packet
Area 1 Area 2
Autonomous System
– Consists of areas and autonomous systems
– Minimizes routing update traffic
OSPF Multiarea Components
Routers LSAs Areas
afadjfjorqpoeru
39547439070713
Area 0
Internal Type 1
I am a backbone.
afadjfjorqpoeru
39547439070713
Type 2
ABR Area 1
afadjfjorqpoeru
39547439070713
I am standard.
Type 3/4
ASBR
afadjfjorqpoeru
39547439070713
Area 2
I am a stub.
Type 5
Backbone
LSA
LSA Header
LSA fields
• Age is the time, in seconds, since the
LSA was originated. As the LSA is
flooded, the age is incremented by
InfTransDelay seconds at each router
interface it exits. The age is also
incremented in seconds as it resides in
a link-state database.
• Options In the LSA header specifies the
optional capabilities supported by the
portion of the OSPF domain described
by the LSA.
LSA fields
• Type is the LSA type.
• Link State ID identifies the
portion of the OSPF domain being
described by the LSA. The specific
usage of this field varies according
to the LSA type; the descriptions of
each LSA include a description of
how the LSA uses this field.
LSA fields
• Advertising Router is the router ID of
the router that originated the LSA.
• Sequence Number is incremented
each time a new instance of the LSA is
originated, so that other routers can
identify the most recent instance of the
LSA.
LSA fields
• Checksum is the Fletcher checksum of
the complete contents of the LSA
except for the Age field. If the Age field
were included, the checksum would
have to be recalculated every time the
age was incremented.
• Length is the number of octets of the
LSA, including the header.
LSA options field
LinkType Connection
1
Point-to-point connection to another router
2
Connection to a transit network
3
Connection to a stub network
4
Virtual link
Router LSA Link ID
Link ID identifies the object to which the link
connects. This is dependent on the link
type, Link ID is the same as the Link State
ID in the header of the neighboring router's
LSA. During the routing table calculation,
this value is used to find the neighbor's LSA
in the link state database.
Router LSA Link ID cont..
Type Value of Link ID Field
BBone
afadjfjorqpoeru
39547439070713
Type 1
Flooding LSUs to
Multiple Areas
Area 50 Stub
Area 1 Area 0
BBone
BBone
afadjfjorqpoeru
39547439070713 afadjfjorqpoeru
afa 39547439070713
39 djfjo
54
74 rqp
39 oe
07 r u
07
13
Ty
Type 5 pe Default
5
Flooding LSUs to
Multiple Areas
Routing Table
Intra-Area Area 1
Routes
– intra-area
– inter-area
– type 1 external
– type 2 external
Path Type
• Intra-area paths are to destinations within
one of the router's attached areas.
• Inter-area paths are to destinations in
another area but within the OSPF
autonomous system. An interarea path,
tagged with an IA, will always pass through
at least one ABR.
Path Type
• Type 1 external paths (E1) are to destinations
outside the OSPF autonomous system. When an
external route is redistributed into any
autonomous system, it must be assigned a metric
that is meaningful to the routing protocol of the
autonomous system. Within OSPF, the ASBR is
responsible for assigning a cost to the external
routes they advertise. Type 1 external paths have a
cost that is the sum of this external cost plus the
cost of the path to the ASBR.
Calculating Costs for Summary
and AS External Routes
Area 0
E1
R4 R3 R1
10 10
E1
1785
1785
R5 R4 R3 R1
10 10 10
E1
1785
1785
R4 R3 R1
10 10
E1
1785
1785
R5 R4 R3 R1
10 10 10
E1
1785
1785