P a g e | 1
Implementation of OSPF Protocol on Router using Packet Tracer
Mini Project Report
Submitted in partial fulfillment of the requirements
for the Degree of
Bachelor of Technology
Project Head: Arun Kumar Konkati (07P71A1215)
Team Members: Arun Kumar Nayak (07P71A1216)
Ashok Kumar P (07P71A12118)
Department of Information Technology
Swami Vivekananda Institute of Technology
P a g e | 2
Department of Information Technology
Swami Vivekananda Institute of Technology, Hyderabad
Mini Project Report entitled
"Implementation of OSPF Protocol on Router using Packet Tracer Simulator"
submitted by Mr. Arun Kumar Konkati (Project Head) with team members
Mr. Arun Kumar Nayak and Mr. Ashok Kumar P may be accepted.
Date: August 01, 2010
P a g e | 3
I would like to express sincere gratitude to my guide, Prof: for his constant
encouragement, support and advice during the course of my Mini Project. I am very much thankful
to him for his invaluable suggestions and guidance.
Roll no. 07P71A1215
Arun Kumar Nayak
Roll no. 07P71A1216
Ashok Kumar P
Roll no. 07P71A12118
P a g e | 4
TABLE OF CONTENTS
Table of Contents.................................................................................................................4
2.1 OSPF Process ……………...………………...........................................................7
2.2 Link State Advertisements (LSAs)……………......................................................8
OSPF Router Types
3.1 Router Types….………………………….............................................................10
3.2 OSPF Packet Format...……………...……………………....................................11
3.3 OSPF Operation……………... ………………………………………………….13
OSPF Network Architecture....……….………………………………………….15
Results & Conclusions ………..………………………………………..……….18
Advantages and Disadvantages………………………………………..……….19
P a g e | 5
Routing is the process of selecting paths in a network along which to send network traffic. Routing
is performed for many kinds of networks, including the telephone network (Circuit switching),
electronic data networks (such as the Internet), and transportation networks. It is concerned
primarily with routing in electronic data networks using packet switching technology. In
internetworking, the process of moving a packet of data from source to destination. In packet
switching networks, routing directs packet forwarding, the transit of logically addressed packets
from their source toward their ultimate destination through intermediate nodes; typically hardware
devices called routers, bridges, gateways, firewalls, or switches.
Routing is usually performed by a dedicated device called a router. Routing is a key feature of the
Internet because it enables messages to pass from one computer to another and eventually reach the
target machine. The routing process usually directs forwarding on the basis of routing tables which
maintain a record of the routes to various network destinations. Thus, constructing routing tables,
which are held in the router's memory, is very important for efficient routing.
For (Static Routing) or Non-Adaptive routing there is no algorithm, and is manually engineered.
The advantage of this routing type is maximum computing resources are saved but are conditioned.
Networks have to be prepared for disaster, by additional planning. For larger networks, static
routing is avoided. For (Dynamic Routing) or Adaptive routing algorithms are Routing
Information Protocol (RIP), Open Shortest Path First (OSPF). Dynamic routing dominates the
As the Internet and IP networks become mission critical business tools, there has been increased
interest in techniques and methods to monitor the routing posture of networks. Incorrect routing or
routing issues cause undesirable performance degradation, flapping and/or downtime. Monitoring
routing in a network is achieved using Route analytics tools and techniques
P a g e | 6
OSPF ROUTING PROTOCOL:
Open Shortest Path First (OSPF) is a dynamic routing protocol for use in Internet Protocol (IP)
networks. Specifically, it is a link-state routing protocol and falls into the group of interior gateway
protocols, operating within a single autonomous system (AS). It is an Interior Gateway Protocol
used to distribute routing information within a single Autonomous System.
OSPF is perhaps the most widely-used interior gateway protocol (IGP) in large enterprise networks;
IS-IS, another link-state routing protocol, is more common in large service provider networks. The
most widely-used exterior gateway protocol is the Border Gateway Protocol (BGP), the principal
routing protocol between autonomous systems on the Internet.
An autonomous system (AS) is a collection of connected Internet Protocol (IP) routing prefixes
under the control of one or more network operators that presents a common, clearly defined routing
policy to the Internet. Group of computers controlled by the single administrative then it is called as
the autonomous system.
Link State Advertisements
Because only link state advertisements are exchanged rather than complete network information (as
in RIP), OSPF networks converge far more quickly than RIP networks. In addition, Link State
Advertisements are triggered by network changes (like the triggered updates in RIP). The Dijkstra's
algorithm used to calculate the (shortest path first)SPF tree is CPU intensive, therefore it is
advisable to run it (the Soloist) on a router slot that either has a slow speed network attached or
none at all.
P a g e | 7
2. OSPF Process
2.1 The OSPF Process
The Link State Database (LSDB) contains the link state advertisements sent around the 'Area' and
each router holds an identical copy of this LSDB. The router then creates a Shortest Path First
(SPF) tree using Dijkstra's algorithm on the LSDB and a routing table can be derived from the SPF
tree which now contains the best route to each router.
Each router within an Area maintains an identical LSDB by maintaining communications with
other routers by way of adjacencies. The formation of an adjacency occurs between two routers A
and B that are in the initial Down state as follows:
1. Init state: Hello packets are exchanged between routers A and B, in order to form a Neighbor
Relationship. Then based on these packets they decide whether or not to become adjacent. The
Hello packet contains the router ID and the hello and dead intervals and is sent to the multicast
2. Two-way state: The routers add each other to their Neighbor (Adjacencies) database and they
3. DR and BDR Election:
Initially, on forming an adjacency, the router with the highest Router Priority (information held
within the 'hello' packet) becomes the DR, or the router with the highest router ID (highest IP
address or the loopback interface address). The router with the next highest ID becomes the BDR.
The BDR just receives the same information as the DR but only performs the task of a DR when the
4. After election the routers are in the Exstart state as the DR and BDR create an adjacency with
each other and the router with the highest priority acts as the master and they begin creating their
link-state databases using Database Description Packets.
5. The process of discovering routes by exchanging Database Description Packets (DBD) is
known as Exchange. These packets contain details such as the link-state type, the address of the
advertising router, the cost of the link and the sequence number that identifies how recent the link
P a g e | 8
6.Link State Request: In order to update its LSDB the slave router sends a Link State Request.
This is known as the Loading state.
7.Full: In the Full state the routers can route traffic and the routers continue sending each other
hello packets in order to maintain the adjacency and the routing information.
2.2 Link State Advertisements (LSAs):
It is important to know different Link State Advertisements (LSAs) offered by OSPF
Type 1: Router link advertisements generated by each router for each area it belongs to
Type 1 LSAs are flooded to a single area only.
Type 2: Network link advertisements generated by designated routers (DRs) giving the
set of routers attached to a particular network. Type 2 LSAs are flooded to the area that
contains the network.
Type 3/4: These are summary link advertisements generated by ABRs describing inter
area routes. Type 3 describes routes to networks and is used for summarization. Type 4
describes routes to the ASBR.
Type 5: Generated by the ASBR and provides links external to the Autonomous System
(AS). Type 5 LSAs are flooded to all areas except stub areas and totally stubby areas.
Type 6: Group membership link entry generated by multicast OSPF routers.
Type 7: NSSA external routes generated by ASBR. Only flooded to the NSSA. The ABR
converts LSA type 7 into LSA type 5 before flooding them into the backbone (area 0).
P a g e | 9
An OSPF consisting of multiple Areas Linked by Routers
P a g e | 10
3. OSPF Router Types
3.1 Router Types: OSPF defines the following router types:
Area border router (ABR)
Autonomous system boundary router (ASBR)
Internal router (IR)
Backbone router (BR)
The router type is an attribute of an OSPF process. A given physical router may have one or more
OSPF processes. For example, a router that is connected to more than one area, and which receives
routes from a BGP process connected to another AS, is both an area border router and an
autonomous system boundary router.
Each router has an identifier, customarily written in the dotted decimal format (e.g., 184.108.40.206) of an
IP address. This identifier must be established in every OSPF instance. If not explicitly configured,
the highest logical IP address will be duplicated as the router identifier. However, since the router
identifier is an IP address, it does not have to be a part of any routable subnet in the network, and
often isn't to avoid confusion.
These router types should not be confused with the terms designated router (DR), or backup
designated routers (BDR), which are attributes of a router interface, not the router itself.
A designated router (DR) is the router interface elected among all routers on a particular
multiaccess network segment, generally assumed to be broadcast multiaccess.
A backup designated router (BDR) is a router that becomes the designated router if the current
designated router has a problem or fails. The BDR is the OSPF router with second highest priority
at the time of the last election.
Area border router
An area border router (ABR) is a router that connects one or more areas to the main backbone
network. It is considered a member of all areas it is connected to. An ABR keeps multiple copies of
the link-state database in memory, one for each area to which that router is connected.
P a g e | 11
Autonomous system boundary router
An autonomous system boundary router (ASBR) is a router that is connected to more than one
Routing protocol and that exchanges routing information with routers in other protocols. ASBRs
typically also run an exterior routing protocol (e.g., BGP), or use static routes, or both. An ASBR is
used to distribute routes received from other, external ASs throughout its own autonomous system.
An internal router is a router that has OSPF neighbor relationships with interfaces in the same area.
Backbone routers are all routers that are connected to the OSPF backbone, irrespective whether they
are also area border routers or internal routers of the backbone area. An area border router is always
a backbone router, since all areas must be either directly connected to the backbone or connected to
the backbone via a virtual link (spanning across another area to get to the backbone).
3.2 OSPF Packet Format
All OSPF packets begin with a 24-byte header, as illustrated in figure below:
OSPF Packets Consist of Nine Fields
The following descriptions summarize the header fields illustrated in Figure.
• Version number—Identifies the OSPF version used.
• Type—Identifies the OSPF packet type as one of the following:
Hello—Establishes and maintains neighbor relationships.
Database description—Describes the contents of the topological database. These
messages are exchanged when an adjacency is initialized.
Link-state request—Requests pieces of the topological database from neighbor
routers. These messages are exchanged after a router discovers (by examining database
description packets) that parts of its topological database are outdated.
P a g e | 12
Link-state update—Responds to a link-state request packet. These messages also are
used for the regular dispersal of LSAs. Several LSAs can be included within a single
link-state update packet.
Link-state acknowledgment—Acknowledges link-state update packets.
• Packet length—Specifies the packet length, including the OSPF header, in bytes.
• Router ID—Identifies the source of the packet.
• Area ID—Identifies the area to which the packet belongs. All OSPF packets are associated with a
• Checksum—Checks the entire packet contents for any damage suffered in transit.
• Authentication type—Contains the authentication type. All OSPF protocol exchanges are
authenticated. The authentication type is configurable on per-area basis.
• Authentication—Contains authentication information.
• Data—Contains encapsulated upper-layer information.
The "Main OSPF Packet Header" is the same for all 5 types of packets (with exception of the Type
field) where as the following sub-headers will vary from type to type and are shown below the
Main OSPF Packet Header.
The five different formats for each "Type" of OSPF v3 packet are listed below:
Type 1: The Hello Packet
Type 2: The Database Description Packet
Type 3: The OSPF Link State Update Packet
Type 4: The OSPF Link State Acknowledgement Packet
Type 5: The OSPF Link State Request Packet
P a g e | 13
3.3 OSPF Operation
Let’s use an example to illustrate OSPF operation. Imagine that there are four interconnected
switches and each switch is connected to a central network – this is the OSPF backbone area. When
everything is first turned on, OSPF routers detect which networks are directly accessible. They also
try to determine who their neighboring routers are. Routers identify neighboring routers by
transmitting "hello" packets on all their ports. In these packets, each router identifies itself.
P a g e | 14
Authentication can be used to validate the communication between routers, but this is optional since
an explicit trust relationship can be setup between routers so they "trust" one another. When a router
receives a "hello" packet from a neighbor a "relationship" is established and information is
exchanged. When it is determined that more than one router is present within an area, a primary
(designated) router is selected as well as a backup designated router. Once the designated router is
selected, all other routers establish a relationship with it to exchange database information. The
database exchange process uses OSPF request and response messages to exchange data. Once the
databases are fully exchanged and synchronized, the routers are said to be in a full state.
After they are synchronized, the routers run the shortest path algorithm. Each router constructs a
tree structure from itself to all known destinations. By building this structure, the routers are able to
determine how to best forward a packet to any destination across the network. A similar database
relationship is also established with the backup router; however, this is only used in case of the
designated router’s failure. Once the network is up and running, the routers periodically send
"hello" packets on their interfaces. This is done to verify that all links are still active and also to
make sure of the neighboring routers’ status. If a link failure or loss of communication between
neighboring devices occurs, the router or routers that detect the change advertise this information to
other routers, so they can update their databases. This guarantees that all routers are updated with
the most current network topology information as quickly as possible. To summarize, OSPF
separates networks into areas and each area has a designated router. All routers in an area send
database updates about attached networks and stations to the designated router, and the designated
router sends that information to all other routers in the area. Using the database information, routers
construct tree structures using the shortest path first algorithm, allowing them to forward packets
P a g e | 15
4. OSPF Network Architecture
It allows sets of networks to be grouped together in an area. The topology of an area is hidden from
the other AS thus reducing the routing traffic.
OSPF has restrictions when multiple areas are involved. It needs to configure one area as area 0
which is the backbone. It is helpful to start with area 0 and then expand into other areas later. It is
the center of all the areas and all the areas have to be physically connected to the backbone. This is
required as the OSPF expects all areas to inject routing information into this area. Virtual links
could be used to link the areas that are not physically connected to the backbone.
Area distribution showing backbone area
In Link-state routing protocol, each router maintains a database describing the AS’s topology. This
is referred to as Link State Database (LSDB). It includes router’s local state including router’s
usable interfaces and reachable neighbors. The router then distributes its local state throughout the
AS using flooding. All routers run the same algorithm in parallel and from the link state database;
each router constructs a tree of shortest paths with itself as a root. In case of more than one equal-
cost route, traffic is distributed among them.
Any change in routing information is flooded to all routers in the network. It is a dynamic routing
protocol and quickly detects the topological changes in AS and calculates new loop-free routes after
a period of convergence. This period of convergence is short and involves a minimum of routing
P a g e | 16
Areas are introduced to put a boundary on explosion of link-state updates. Flooding and calculation
of the Dijkstra algorithm on a router is limited to changes within an area. All routers within an
area have the exact link-state database. Routers that belong to multiple areas, and connect these
areas to the backbone area are called area border routers (ABR). ABRs must therefore maintain
information describing the backbone areas and other attached areas.
Routers use Hello Protocol to elect neighbors on that segment. Routers become neighbors as they
see themselves listed in the neighbor’s Hello packet. This guarantees a two way communication.
Adjacency is the next step after neighboring process. Adjacent routers are routers that go beyond
the simple Hello exchange and proceed into the database exchange process. In order to minimize
the amount of information exchange on a particular segment, one router is elected as a designated
Router (DR) and a backup designated router (BDR). This cuts the information exchange from
O(n*n) to O(n) where n is the number of routers. DR and BDR election is done via Hello protocol.
Information exchange between routers in an area in OSPF
OSPF allows certain areas to be configured as stub areas. Routing from these areas to the outside
world is based on a default route. Configuring a stub area reduces the topological database size
inside an area and reduces the memory requirements of the routers inside the area. A stub area is
an area which does not receive external routes except the default route, but does receive inter-area
routes. This kind of area is useful when, all Internet access goes through autonomous system
border routers (ASBRs) in Area 0.0.0.0, but there are multiple paths to other nonzero areas in the
OSPF domain. All routers in the area need to agree they are stub, so that they do not generate types
of LSA not appropriate to a stub area.
Stub areas are areas that do not propagate AS external advertisements. By not propagating AS
external advertisements, the size of the topological databases is reduced on the internal routers of a
P a g e | 17
stub area. This in turn reduces the processing power and the memory requirements of the internal
Totally Stubby Area:
Only default summary route is allowed in Totally Stubby Area
Not-So-Stubby Areas (NSSA): An OSPF stub area has no external routes in it. A NSSA allows
external routes to be flooded within the area. These routes are then leaked into other areas. This is
useful when you have a non-OSPF router connected to an ASBR of a NSSA. The routes are
imported, and flooded throughout the area. However, external routes from other areas still do not
enter the NSSA.
External routes can be calculated using external type 1 and external type 2 metrics. The cost of type
2 always the external cost, irrespective of the interior cost to reach the route. A type 1 cost is
addition of external cost and internal cost to reach the route. Type 1 is always preferred over a type
2 route for the same destination
OSPF cost (metric) of an interface is an indication of the overhead required to send packets across a
certain interface. It is inversely proportional to the bandwidth of the interface. Higher bandwidth
indicates lower cost.
It is also possible to authenticate the OSPF packets such that routers can participate in routing
domains based on predefined passwords.
Depending on the study, the following things should be kept in mind while designing an OSPF
1.Since ABRs keep a copy of the database for all areas, the number of areas per ABR
should be set according to the CPU power, number of routes per area, and number of external
routes per area. To avoid overload its better to spread the areas over routers.
2.Non Broadcast Multi-Access network performs better in case of a point-to-point point-to-
multipoint configuration rather than multipoint networks.
3.Memory issues are faced when too many external routers are injected in the OSPF
domain. Use of ABR and stub areas minimizes the number of routes exchanged and hence memory.
In some cases, it is seen beneficial to change the OSPF link weights to avoid congestion and to
support more demands against the default Cisco’s inverse-capacity-weights.
P a g e | 18
5. Results & Conclusions
OSPF protocol defined in RFC 2328, provides a high functionality open protocol that allows
multiple vendor networks to communicate using TCP/IP protocol family. OSPF was the first widely
deployed routing protocol that could converge a network in the low seconds, and guarantee loop-free
paths. It has a great many features that allow the imposition of policies about the propagation of routes,
for load sharing, and for selective route importing. It can also provide better load-sharing on external
links than other IGPs.
The traditional RIP has its limits which has given way to OSPF. Some limitations of RIP that
causes problem in large network are:
RIP network cannot span more that 15 hops. If the path includes more than 15
routers the network is considered unreachable.
RIP is unable to handle Variable Length Subnet Masks (VLSM). This leads to
shortage of IP addresses.
RIP does not take into account the network delays and link costs. It makes a routing
decision based only on number of hop counts rather than considering a longer but a
better bandwidth and a slower delay path.
RIP treats network as a flat network i.e. without any concept of areas or boundaries.
There cannot be any abstraction on routing table.
Broadcast of full routing table will consume a large amount of bandwidth. This is an
important issue in slow link networks.
OSPF is seen to address many shortcomings discussed earlier:
There is no limitation on the hop counts.
The use of VLSM allows flexible IP address allocation.
It uses IP multicast to send link-state updates. This ensures less processing on routers
that are not meant to listen to the packets. This is only done in case of a change
instead of doing it periodically. This helps in a better use of bandwidth.
The network is divided into areas which avoids link state updates to be sent over the
Routing authentication is used.
P a g e | 19
6. Advantages & Disadvantages
OSPF is able to quickly update all routers on large, complex networks. It is able to forward traffic
across multiple paths to a single destination (equal cost, multi-path capability). OSPF also uses
metrics to determine the best path to a destination – it does not just depend on hop count as RIP
does. Unfortunately, because of OSPF’s ability to handle large complex networks it is also more
complex for the network manager to configure and set up, and it requires greater computing power
within the router.
The manager must manually understand, calculate, and factor in path costs that the routers will use
during router-to-router exchanges.
Advantages of OSPF:
1. OSPF is an open standard, not related to any particular vendor.
2. OSPF is hierarchical routing protocol, using area 0 (Autonomous System) at the top of the
3. OSPF uses Link State Algorithm, and an OSPF network diameter can be much larger than that
4. OSPF supports Variable Length Subnet Masks (VLSM), resulting in efficient use of networking
5. OSPF uses multicasting within area’s. After initialization, OSPF only sends updates on routing
table sections which have changed, it does not send the entire routing table, which in turn
conserves network bandwidth.
6. Using areas, OSPF networks can be logically segmented to improve administration, and
decrease the size of routing tables.
Disadvantages of OSPF:
1. OSPF is very processor intensive due to implementation of SPF algorithm. OSPF maintains
multiple copies of routing information, increasing the amount of memory needed.
2. OSPF is a more complex protocol to implement compared to RIP.