OSPF routers establish relationships, or states,
with their neighbors for efficiently sharing link-state
information. In contrast, distance-vector routing protocols, such as RIP,
blindly broadcast or multicast their complete routing table out every interface,
hoping that a router is out there to receive it. Every 30 seconds, by default,
RIP routers send only one kind of message - their complete routing table. OSPF
routers, on the other hand, rely on five different kinds of packets to identify
their neighbors and to update link-state routing information.
These five packet types make OSPF capable of
sophisticated and complex communications. These packet types will be discussed
in more detail later in the chapter. At this point, you should become familiar
with the different relationships, or states, that are possible between OSPF
routers, the different OSPF network types, and the OSPF Hello protocol.
OSPF States
The key to effectively designing and troubleshooting OSPF networks is to
understand the relationships, or states, that develop between OSPF routers. OSPF
interfaces can be in one of seven states.
OSPF neighbor relationships progress through these states, one at a time, in the
order presented.
- Down State
In the Down state, the OSPF process has not exchanged information with any
neighbor. OSPF is waiting to enter the next state, which is the Init state.
- Init State
OSPF routers send Type 1 (hello) packets at regular intervals (usually 10
seconds) to establish a relationship with neighbor routers. When an
interface receives its first hello packet, the router enters the Init state,
which means the router knows a neighbor is out there and is waiting to take the
relationship to the next step.
There are two kinds of relationships - two-way state and
adjacency - although there are many phases in
between. A router must receive a hello from a neighbor before it can establish
any relationship.
- Two-Way State
Using hello packets, every OSPF router tries to establish a Two-way state, or
bi-directional communication, with every neighbor router on the same IP network.
Among other things, hello packets include a list of the sender's known OSPF
neighbors. A router enters the Two-Way state when it sees itself in a neighbor's
hello. For example, as shown in Figure ,
when RTB learns that RTA knows about RTB, RTB declares a two-way state to exist
with RTA.
The Two-Way state is the most basic relationship
that OSPF neighbors can have, but routing information is not shared between
routers in this relationship. To learn about other routers' link states and
eventually build a routing table, every OSPF router must form at least one
adjacency. An adjacency is an advanced relationship between OSPF routers that
involves a series of progressive states that rely not just on hellos, but also
on the other four types of OSPF packets. Routers that attempt to become adjacent
to one another exchange routing information even before the adjacency is fully
established. The first step toward full adjacency is the ExStart state, which is
described next.
- ExStart State
Technically, when a router and its neighbor enter the ExStart state, their
conversation is characterized as an adjacency, but the routers have not become
fully adjacent yet. ExStart is established using Type 2 database description (DBD)
packets, also known as DDPs. The two neighbor routers use hello packets to
negotiate who is the "master" and who is the "slave" in
their relationship and DBD packets to exchange databases. 
The router with the highest OSPF router ID
"wins" and becomes master. (The OSPF router ID is discussed later in
this chapter.) When the neighbors establish their roles as master and slave,
they enter the Exchange state and begin sending routing information.
- Exchange State
In the Exchange state, neighbor routers use Type 2 DBD packets to send each
other their link-state information .
In other words, the routers describe their link-state databases to each other.
The routers compare what they learn with their existing link-state databases. If
either of the routers receives information about a link that is not already in
its database, the router requests a complete update from its neighbor. Complete
routing information is exchanged in the Loading state.
- Loading State
After the databases have been described to each router, they may request
information that is more complete by using Type 3 packets, link-state
requests (LSRs). When a
router receives an LSR, it responds with an update by using a Type 4 link-state
update (LSU) packet.
These Type 4 LSU packets contain the actual link-state advertisements (LSAs),
which are the heart of link-state routing protocols. As shown in Figure ,
Type 4 LSUs are acknowledged using Type 5 packets, called link-state
acknowledgments (LSAcks).
- Full Adjacency
With the Loading state complete, the routers are fully adjacent. Each router
keeps a list of adjacent neighbors, called the adjacency database. Do not confuse
the adjacency database with the link-state database or the forwarding database. 
|