Open Shortest Path First (OSPF)
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. OSPF is
an open standard and designated by the Internet Engineering Task Force (IETF) as one
of several Interior Gateway Protocols (IGPs) within the family of TCP/IP protocols.
Based on link-state or shortest path first (SPF) technology, OSPF distributes routing
information between routers in a single autonomous system (AS). This capability
differentiates OSPF from older TCP/IP routing protocols, which were designed for less
complex networks than those used today.
Using Dijkstra's shortest path algorithm, OSPF calculates the shortest path for all
routers in an area of the AS to efficiently use network bandwidth and ensure scalability.
The AS may be divided into multiple interconnected networks, such as a wide area
network (WAN). The topology is visible only to the routers in the same area.
As a dynamic routing protocol, OSPF not only routes IP packets based on the
destination IP address (given in the packet header), but it also detects topological
changes in the AS. After detecting changes, OSPF calculates new, loop-free routes after
a short period (known as convergence time) in which routing traffic is kept to a
minimum.
All the routers in the same area of the OSPF network maintain the same link-state
database that describes the area topology. Each router receives link-state advertisement
(LSA) messages containing information about neighboring routers and path costs from
the other routers in that area. Using these LSAs, each router generates the link-state
database and uses the SPF algorithm to calculate a shortest-path spanning tree.
OSPF was designed and developed by the IETF for TCP/IP environments, mainly large
enterprise networks. OSPF version 2 is defined in RFC 2328 of the IETF Network
Working Group. This protocol is broadly implemented in enterprise
routers. IPv6 revisions to this standard are captured in OSPF version 3 and defined in
IETF RFC 5340.
How Open Shortest Path First works
Two important concepts in OSPF are areas and neighbors.
Areas are groups of routers in an AS, essentially forming a collection of zones with
logical boundaries. Areas are typically identified with a number. Area 0 is always
the backbone, to which all other areas connect.
OSPF-enabled routers in the same area establish "neighbor" relationships using
a HELLO packet to exchange routing information.
In OSPF, the routers do not need to send the entire routing table to neighboring routers
every few seconds. Instead, information is sent only when a change has taken place.
When an OSPF router in a given area of the AS that learns of a routing table change or
detects a change in the network immediately multicasts the information to all other
OSPF-enabled nodes in the area. Multicasting is a way to ensure every router in that
area has the same information about the AS topology, a concept known as flooding.
This information is used to calculate the best end-to-end path to the eventual destination
in the AS.
Notably, the multicast contains only the latest update. Routing tables can be incredibly
large, and retransmitting them in full every time can degrade network performance.
When routes change -- which can occur due to equipment failure or the addition of new
devices -- the time it takes OSPF routers to reconcile these changes and identify the best
new, loop-free path between endpoints is called convergence time.
Advantages of Open Shortest Path First
There are several benefits to OSPF. One benefit of the OSPF protocol is that all routers
in the AS have complete information about the network topology, which allows them
to calculate routes that satisfy specific quality of service (QoS) requirements. This
feature is particularly advantageous for traffic engineering.
Another benefit is that the routes can be calculated (and recalculated) very quickly when
the network topology changes. Another way of saying this is that OSPF results in a
shorter convergence time after a network change. For this reason, OSPF is a suitable
protocol for large and/or heterogeneous networks where changes happen frequently.
Thirdly, routing traffic can be managed by dividing the AS into multiple areas. Doing
so ensures that area topologies are kept separate, which reduces the size of the link-state
database of each area as well as traffic, minimizing delays.
OSPF LSA route types denote the route topology information and where it
originated.
Type 1 identifies a single router and referred to as Intra-Area (O).
Type 2 is a network LSA since it is associated with a network segment (DR/BDR)
and designated as Intra-Area (O) as well.
Type 3 is a summary LSA (link-state advertisements) generated only by an
ABR(area border routers) and referred to as Inter-Area (IA).
Type 4 LSA is a summary ASBR (autonomous system border router) advertised only
from an ABR, that advertises a route to the ASBR.
Type 7 is an NSSA (not-so-stubby-area) LSA that originates from an ASBR and is
converted to Type 5 LSA at an ABR. They provide routes to external routing
domains for OSPF routers.
Routing Information Protocol
Routing Information Protocol'' (RIP) is a distance-vector protocol which uses hop
count as its primary metric. It governs the router and directs them to share
information with the neighbouring routers connected to the local area network. In
order to prevent
routing loops, RIP implements the maximum number of hops allowed in a path from
source to destination. The hop count can be defined as the number of routers between
the source and destination. The maximum number of hops allowed in a RIP network
is 15 which limits RIP to small networks only (local area network). The hop count
of 16 indicates that the network is unreachable.
RIP protocol runs with an Administrative Distance (AD) of 120 and port 520 on the
OSI model of network layer.
Command It is used for request and response. It is an 8-bit field. The request is
represented by 1 whereas the response is represented by 2
Version Version represents the protocol version of RIP in use. Lets assume we use
version 1 of the protocol, then we enter 1 in this field
Reserved It is a reserved filed and it's represented by 0
Family This is a 16-bit field. Since we use TCP/IP protocol, we put 2 in this field
Network Address: It's a 14 byte field. Since we use IPv4 which gets filled in 4 bytes,
rest 10 bytes remain zero
Distance The hope count or the total number of routers require to reach the
destination network is represented by this field
Benefits of RIP
Following are the benefits of RIP:
Easy to understand
Feasible to configure
Supported by all the routers
Support load balancing
Additionally, RIP is preferred over static routing due to the fact that it doesn't require
manual updates when the topology changes and its simple to configure.
Versions of RIP
There are in total 3 versions of RIP:
RIPv1
RIPv2
RIPng
RIPv1
Addressing: Classful routing, meaning it does not support Variable Length
Subnet Masking (VLSM) or Classless Inter-Domain Routing (CIDR).
Updates: Sends routing updates via broadcast to the [Link]
address.
Compatibility: Designed for IPv4 and is an older, less efficient version no
longer recommended for use.
RIPv2
Addressing:
Classless routing, fully supporting VLSM and CIDR, allowing for varied subnet
masks.
Updates:
Uses multicast for updates to the address [Link], making it more efficient than
RIPv1's broadcast method.
Features:
Carries subnet mask information in its advertisements and supports authentication
for better security.
Compatibility:
Designed for IPv4 networks.
RIPng (RIP Next Generation)
Addressing:
Specifically designed for IPv6 networks, supporting the new IP addressing scheme.
Updates:
Uses multicast for updates to the IPv6 multicast address FF02::9.
Features:
While built for IPv6, it retains many of the mechanics of RIPv2 but does not include
its own authentication, relying instead on the IPsec framework provided by IPv6.