OSPF is a routing protocol for IP. It is a link-state protocol, as opposed to a distance-vector protocol. A link-state protocol
makes its routing decisions based on the states of the links that connect source and destination machines. The state of the
link is a description of that interface and its relationship to its neighboring networking devices. The interface information
includes the IP address of the interface, network mask, type of network to which it is connected, routers connected to that
network, and so on. This information is propagated in various types of link-state advertisements (LSAs).
A router stores the collection of received LSA data in a link-state database. This database includes LSA data for the links
of the router. The contents of the database, when subjected to the Dijkstra algorithm, extract data to create an OSPF routing
table. The difference between the database and the routing table is that the database contains a complete collection of raw
data; the routing table contains a list of shortest paths to known destinations through specific router interface ports.
OSPF is the IGP of choice because it scales to large networks. It uses areas to partition the network into more manageable
sizes and to introduce hierarchy in the network. A router is attached to one or more areas in a network. All of the networking
devices in an area maintain the same complete database information about the link states in their area only. They do not know
about all link states in the network. The agreement of the database information among the routers in the area is called convergence.
At the intradomain level, OSPF can import routes learned using Intermediate System-to-Intermediate System (IS-IS). OSPF routes
can also be exported into IS-IS. At the interdomain level, OSPF can import routes learned using Border Gateway Protocol (BGP).
OSPF routes can be exported into BGP.
Unlike Routing Information Protocol (RIP), OSPF does not provide periodic routing updates. On becoming neighbors, OSPF routers
establish an adjacency by exchanging and synchronizing their databases. After that, only changed routing information is propagated.
Every router in an area advertises the costs and states of its links, sending this information in an LSA. This state information
is sent to all OSPF neighbors one hop away. All the OSPF neighbors, in turn, send the state information unchanged. This flooding
process continues until all devices in the area have the same link-state database.
To determine the best route to a destination, the software sums all of the costs of the links in a route to a destination.
After each router has received routing information from the other networking devices, it runs the shortest path first (SPF)
algorithm to calculate the best path to each destination network in the database.
The networking devices running OSPF detect topological changes in the network, flood link-state updates to neighbors, and
quickly converge on a new view of the topology. Each OSPF router in the network soon has the same topological view again.
OSPF allows multiple equal-cost paths to the same destination. Since all link-state information is flooded and used in the
SPF calculation, multiple equal cost paths can be computed and used for routing.
On broadcast and nonbroadcast multiaccess (NBMA) networks, the designated router (DR) or backup DR performs the LSA flooding.
On point-to-point networks, flooding simply exits an interface directly to a neighbor.
OSPF runs directly on top of IP; it does not use TCP or User Datagram Protocol (UDP). OSPF performs its own error correction
by means of checksums in its packet header and LSAs.
In OSPFv3, the fundamental concepts are the same as OSPF Version 2, except that support is added for the increased address
size of IPv6. New LSA types are created to carry IPv6 addresses and prefixes, and the protocol runs on an individual link
basis rather than on an individual IP-subnet basis.
OSPF typically requires coordination among many internal routers: Area Border Routers (ABRs), which are routers attached to
multiple areas, and Autonomous System Border Routers (ASBRs) that export reroutes from other sources (for example, IS-IS,
BGP, or static routes) into the OSPF topology. At a minimum, OSPF-based routers or access servers can be configured with all
default parameter values, no authentication, and interfaces assigned to areas. If you intend to customize your environment,
you must ensure coordinated configurations of all routers.