It has been said that OSPF is difficult to understand.
It's widely known that it was developed by John T. Moy and the Internet
Engineering Task Force in 1988. What isn't so widely known is that Moy and
company actually did most of their work from a secret U.S. government
facility 90 miles north of Las Vegas, Nevada known as Groom Lake or what
has now come to be known as Area 51. This can be proven by reading all the
RFCs concerning OSPF. Area 51 is never mentioned and is therefore
conspicuous by its absence. It's almost as if all reference to it was
methodically removed. We currently use OSPF version 2 as version 1 was
scrapped after it caused a terrible explosion in the lab. Many engineers
at Cisco, who have asked to remain anonymous, confirmed our suspicion that OSPF
was reverse engineered from alien spacecraft. The IETF has not responded
to our requests for an interview, you may draw your own conclusions. In
keeping with OSPF's malevolent and alien nature, we have kicked off this series
with our special guest from Star Trek Voyager, Seven of Nine:

Greetings. I have been ordered by my superiors to
give you people an introduction into the threat that OSPF poses for your
planet. The life force you call OSPF is very intelligent and very
dangerous. It is a social creature that can recognize neighboring
OSPF enabled routers and it will initiate a dialog with it's
neighbors.

Once your OSPF routers have communicated with their
neighbors, they begin to organize themselves into a military like
hierarchy with routers occupying roles as Generals, Captains and
Lieutenants. During this phase they are still weak. This is
called "forming adjacencies". It is during this phase that you
should rip your OSPF routers from their racks and beat them to death while
you still have a chance.

In the next phase the OSPF routers will suddenly and
without warning broadcast their message of doom to all other OSPF enabled
routers. The OSPF Task Force calls this "Flooding Link State
Advertisements". Once this occurs, every router knows what the
entire battlefield looks like. Some people call this map of the
battlefield a "link state database", but calling it an innocuous name does
not make it any less threatening. Now they have knowledge, soon they
will each run their Shortest Path First algorithm and they will posses
intelligence.

If you are still alive after they have ran the SPF algorithm, it
means that you have witnessed the remarkable birth of an electronic life
form. The OSPF routers are truly a collective, no router acts as an
individual, they act as a team. Each router checks on the life signs of
its neighbors. Each is aware of the entire network. These OSPF
routers are not limited by pathetic metrics like hop counts or bandwidth and
delay. Because of the mighty power of the OSPF collective, any router can
route any IP packet to anywhere on your planet. And route packets they
will. Bound only by a vague metric known as "cost" these routers will
route packets with a maniacal fervor! Were it not for the artificially
chilled atmosphere in computer rooms, OSPF would surely spread from routers and
into automobiles and small appliances. This has served as an overview and
a dire warning to those astute enough to take heed. Now we will discuss
the details of this diabolical protocol.

Network Types

OSPF behaves differently on different types of networks.
Networks can be classified as Broadcast Multi Access such as Ethernet, Non
Broadcast Multi Access such as ATM and finally Point to Point such as a frame
relay circuit between two sites. For the purposes of this introduction, we
will discuss OSPFs behavior in an Ethernet environment.

Link State vs. Distance Vector

Routing protocols are divided into two main categories: Link
State and Distance Vector. EIGRP is an exception as it combines properties
of both categories. Distance vector protocols periodically exchange their
routing tables with their neighbors. This is known as "routing by rumor"
because routers are advertising routes to networks that they are not directly
connected to. Distance vector protocols are very easy on a routers CPU but
as more routers are added to a network, the exchanging of entire routing tables
can use up valuable bandwidth. Link state protocols monitor the links they
have with adjacent routers by using a "hello protocol" to test the status of
their links to their neighbors. Link state protocols only advertise their
directly connected networks and their active links. Every link state
router captures these link state advertisements and pieces these together like a
patchwork quilt to create a topology of the entire network or area. Link
state routers then run a computation upon this raw data and determine for
themselves how to route packets to remote networks. Link state protocols
are very quite as they only transmit small hello packets and only transmit link
state advertisements when an actual change in the network topology has
occured. Link state protocols are more CPU intensive, especially when a
router is performing the complex "Shortest Path First" calculation. OSPF
is a link state protocol. OSPF is an open standard and supported on Cisco
routers as well as the inferior equipment produced by Cisco's competitors.

OSPF Supports Hierarchical Network Topologies

OSPF routers will naturally congregate into mobs known as
areas. In a given area all OSPF routers are aware of each other and all
the links between each router in their territory or area. Every OSPF
network must have an area known as zero. Other OSPF areas are given other
numerical designtaions such as "area 2" or "area 3" but all areas must be
directly connected to area 0. When OSPF networks are small they may
consist solely of one area called "area 0" and you will find workgroups within
that area. As The OSPF routers multiply and spread their terror other
areas are added and connected to area 0. At this point you should quickly
evacuate the users from area 0 and place their workgroups in the other
areas. After you have rescued your users from area 0, it becomes a
backbone for the other areas and carries only inter-area traffic between
areas. All the areas under a common administration known as an Autonomous
System. OSPF is an Interior Gateway Protocol and is used to route between
areas in a common autonomous system but routing between autonomous systems must
be handled by an Exterior Gateway Protocol.

OSPF's 5 Steps To Conquest

OSPF is like other life forms in that is actually goes
through various stages as it grows from infant to adult. Here are
the five stages an OSPF router goes through:

Form Adjacencies With Neighbors.

Elect a Leader and a Vice Leader.

Discovering Routes.

Determine Which Routes to Use.

Maintain Routing Information.

For this lecture we will discuss how the routers use the
Hello Protocol to establish adjacencies with their neighbors. The
other stages will be covered in future installments.

The Hello Protocol

When a router learns that it has an interface with OSPF enabled
it suddenly acts very sneaky. It desperately wants to find out if there is
another OSPF router out there but it doesn't want everybody else to know what
they're up too. Most routing protocols would simply send out a broadcast,
but not OSPF. OSPF sends out a hello packet to a multicast address!
Very sneaky. And it gets worse, the OSPF router that receives one of these
stealth hello packets responds using the unicast address of the originating
router! I hope you appreciate this, in 1988 when OSPF was discovered all
respectable routing protocols like RIP used broadcasts. For some reason
John T. Moy and his co-conspirators implemented this secretive, multicast send /
unicast reply for exchanging hello packets when the routers boot up.

A hello packet consists of the following 9 fields of
information:

Router ID of sender.

Hello / Dead Intervals

Neighbors

Router Priority

DR IP Address

BDR IP Address

Authentication Password

Area Number

Stub Area Flag

Hello packets are exchanged every 10 seconds by default. That is
called the hello interval. If a router no longer is receiving hello
packets for a period of 4 hello intervals, the link state between the routers is
considered down, this is known as the dead interval. We will discuss the
other fields in the hello packet in part II and we will introduce Designated
Routers and Backup Designated Routers.

What You Have Learned:

OSPF was reverse engineered from alien technology at Area
51.

OSPF is a link state routing protocol.

OSPF behaves differently on different types of networks.

OSPF is hierarchical with Area 0 being the backbone area
and all other areas must connect directly to area 0.