Open Shortest Path First (OSPF) is a link-state routing protocol that was developed for IP networks and is based on the Shortest Path First (SPF) algorithm. OSPF is an Interior Gateway Protocol (IGP).
2. Open Shortest Path First (OSPF)
This is family of TCP/IP protocols.
Open Shortest Path First (OSPF) is an IP routing protocol that uses a mathematical algorithm to calculate the
most efficient path to direct traffic on IP networks.
This is IGP and link state routing protocol.
OSPF Administrative distance Default Distance Values 110.
OSPF, which uses link-state or shortest path first (SPF) technology, distributes routing information across routers
within a single autonomous system.
Each router maintains an overall network topology.
3. Link State Routing in 4 Steps
Step 1: Neighbor discovery
Each Link State enabled router periodically sends a HELLO message on each of its links. Neighbor routers respond to
these HELLO messages identifying themselves. Within the replies, network addresses of the routers are attached and are
used by the HELLO initiator to build up its neighbor table.
Step 2: Measuring link cost
A set of tests is performed on each router to measure the cost to each of its neighbors. The cost could be a measure of
the end-to-end delay, throughput, or a combination of these metrics. How these tests are performed is out of the scope of
this article. The important thing to know is that each link state enabled router has to somehow possess an estimate of the
cost for each of its links.
Step 3: Building and Distributing Link State Packets
Each router builds up a packet containing its neighbors and the corresponding link costs to these neighbors. At the
beginning of the packet, each router adds its identity along with a sequence number and an age parameter, the latter
being used to ensure no packet will wander around for an indefinite period of time. After the construction process, the
packet is flooded in the network.
Step 4: Evaluating Shortest Paths
Using all the details from its link state table, a router is able to compute, using the Dijkstra algorithm, the shortest path
to any given destination.
5. OSPF is a classless Routing protocol supports VLSM and CIDR.
Its Supports Equal cast load balancing.
Equal cost load balancing in OSPF Equal-cost multiple path (ECMP) evenly load balances traffic over
multiple paths between each two network nodes. ECMP reduces traffic load on each path and enhances
network robustness.
6. OSPF table
Neighbor table – stores information about OSPF neighbors
Topology table – stores the topology structure of a network
Routing table – stores the best routes
7. Neighbor table – stores information about
OSPF neighbors
OSPF Neighbors
OSPF routers need to establish a neighbor relationship before exchanging routing updates. OSPF
neighbors are dynamically discovered by sending Hello packets from each OSPF-enabled interface on a
router. Hello packets are sent to the multicast IP address of 224.0.0.5.
The process is explained in the following figure:
Routers R1 and R2 are directly connected. After OSPF is enabled, both routers send Hellos to establish a
neighbor relationship. You can verify that the neighbor relationship has been established by typing
the ‘show ip ospf neighbors’ command.
8. Topology Table
Topology Table: Contains the entire road map of the network with all available
OSPF routers and calculated best and alternative paths.
Throughout the course of normal OSPF operation, each OSPF router will learn
about the various IP networks in a particular topology. All that information is
stored in the OSPF Topology Table.
Every Routing Protocol has some form of a Topology table, which contains
everything a Routing Protocol knows.
OSPF calls its topology table a Link State Database (LSDB). Each entry within the
LSDB is called a Link State Advertisement (LSA). Both the LSDB and LSA are very
important concepts of the OSPF protocol, and many additional lessons in this
series will unpack these ideas further.
9. Topology Table
The Link State Database can be viewed using the command show ip ospf database,
and below is an example of the Link State Database for Router 5
10. Routing table
OSPF uses the concept of areas. An area is a logical grouping of contiguous
networks and routers. All routers in the same area have the same topology table,
but they don’t know about routers in the other areas. The main benefits of
creating areas are that the size of the topology and the routing table on a router
is reduced, less time is required to run the SPF algorithm, and routing updates are
also reduced.
11. OSPF Neighbor States
Before establishing a neighbor relationship, OSPF routers need to go through several state changes.
These states are explained below:
1. Init state – a router has received a Hello message from the other OSPF router
2. 2-way state – the neighbor has received the Hello message and replied with a Hello message of his
own
3. Exstart state – beginning of the Link State Database (LSDB) exchange between both routers. Routers
are starting to exchange link state information.
4. Exchange state – DBD (Database Descriptor) packets are exchanged. DBDs contain LSAs headers.
Routers will use this information to see what LSAs need to be exchanged.
5. Loading state – one neighbor sends LSRs (Link State Requests) for every network it doesn’t know
about. The other neighbor replies with the LSUs (Link State Updates), which contain information about
requested networks. After all the requested information have been received, other neighbor goes
through the same process
6. Full state – both routers have the synchronized database and are fully adjacent to each other.