Open Shortest Path First

flutteringevergreenNetworking and Communications

Oct 29, 2013 (3 years and 10 months ago)

140 views

Open Shortest Path First

(OSPF)


-
Sheela Anand

-
Kalyani Ravi

-
Saroja Gadde



What is OSPF


OSPF is a TCP/IP internet routing protocol classified as a
IGP.


Its routers are within one Autonomous System(AS).


Is a Link State Protocol based on SPF technology.


Is a dynamic routing protocol which detects topological
changes in the AS over a short period of time.


Overview of OSPF


Each router maintains a database describing the AS’s
topology called the “Link State Database”.


Each participating router has an identical database.


Each individual piece of this database is a particular
routers local state.


The router distributes its local state through the AS by
flooding.


All routers run the exact same algorithm in parallel.


From LSD, each router constructs a tree of shortest
paths with itself as root (using the Dijkstras algorithm).


This shortest
-
path tree gives the route to each
destination in the AS.

WORKING


When a router starts,it first initializes the routing
protocol data structures.


It then uses the OSPF’s handshaking
Hello Protocol

to
learn about each other,exchange information and later
perform pings with neighbor routers to make certain the
link and/or router is up.


Now the peer routers are considered to be merely
adjacent (part of synchronization
-
not complete).


The routers exchange information describing their
knowledge of the routing domain.This information is
called database description and is placed in LSA
messages.


WORKING


Using the above LSA messages the receiving
router knows if its LSD is consistent with its
peer’s databases.If all is consistent the
neighbor is now defined as fully adjacent.


A router periodically advertises its state (link
state) to detect dead routers in a timely
fashion.


From this database each router calculates a
shortest path tree with itself the root.


This shortest path tree in turn yields a routing
table for the protocol.


OSPF is concerned with Link
State Database synchronization
and much of the OSPF code is
devoted to this very task.

Routing protocol packets


Hello packet: It is used to discover and maintain
neighbor relationships.


Data Description packet and Link State Request
packets:They are used in forming adjacencies.


Link State Update and Link State Acknowledgment
packets:Used for reliable update mechanisms.


Databases


Neighbor Database:


Initial table displaying neighbors






learned through Hello packets.


Link State Database:


Similar in all routers. Formed after each



router floods its neighbor database.


Routing table:


Each router builds this table by




using SPF technology. It gives the



shortest path to all the routers in the AS.

Flooding Advertisements


Flooding is done to send
Hello packets or to send
Update LSA messages.


Router 3 uses flooding to
perform initial
advertisement.

Flooding Advertisements


When these neighbors
receive the LSA, they check
for errors(using checksum),
check the LSA packet type
and make certain the LSA is
more recent than the copy
in the LSD.


Assuming the received LSA
is new, the routers update
their databases, and send
this LSA out all their
interfaces, except the
interface from which the
LSA was received.

Flooding Advertisements


Eventually, all routers in
the routing domain
receive the LSA.


These routers are
required to send back to
the originating neighbor
an acknowledgment


(ACK) of the transmitted
LSA.



After Hello protocol each router has
information of its links (neighbors) and the
costs associated with them in a table called
“Neighbor Table”.


After the Update LSA messages are received, each
router contains a map of the topology of the
autonomous system or area and the costs associated
with all the links that make up the topology in the link
state database.


This database is same for all the participating routers
within an area.


If no areas exist then the LSD is same for all routers
within the AS.


Finally each router uses its LSD and Dijkstra’s
algorithm to build a shortest path tree with itself as
the root.


This gives shortest paths to all the destinations which
is stored in the “Routing Table”.


AREAS


The OSPF divides or
partitions the AS into
smaller parts called
“areas”.


This reduces the amount
of routing traffic that is
sent through the AS,
because the areas are
isolated from each other.


This also reduces the
amount of information a
router must maintain
about the full AS.


AREAS


Routers within an area are not concerned about the details of
the full AS. They obtain this information from a “
designated

router.


Routers connected to multiple areas are called “area border
routers”.


A stub area is one into which routing information on external
routes is not sent. Instead the area border router generates a
default route for destinations outside the area.


OSPF requires that all areas be connected together by a
backbone area (area 0).


This arrangement might be too restrictive, since inter
-
area
routing has to involve a backbone router. This can be avoided
by the use of “Virtual Links” in which routing packets can be
sent from one to another, and not have to traverse over the
backbone.


AREAS


OSPF routers discover external networks through an
external gateway protocol(eg, BGP), and then advertise
these networks within the AS with external LSA’s.



DESIGNATED ROUTER


OSPF requires that one router be assigned a designated
router for a network so that the hosts do not have to be
concerned with route advertising.


In broadcast networks designated router is used to
reduce the number of potential peer relationships.


AREAS


A separate copy of OSPF ’s basic routing algorithm runs
in each area.Therefore each area has its own Link State
Database and a corresponding graph.


With the introduction of areas not all routers in the AS
have an identical Link State Database.


A router has a separate LSD for each area it is
connected to.


All the routers in an area have ,for that area ,identical
area LSD’s.


Intra Area Routing
-
Source and destination for a packet
reside in the same area.


Inter Area Routing
-
Source and destination for a packet
reside in different areas.



Inter Area Routing


The OSPF backbone
contains all area border
routers.


The backbone is
responsible for
distributing packets
between non backbone
areas.


The path that the packet
travels can be broken up
into three contiguous
pieces:an intra area
path, a backbone path
and another intra area
path to the destination.



Inter Area Routing


Each area border router in an area summarizes for the
area its cost to all networks external to the area.


After the SPF tree is calculated for the area ,routes to all
inter area destinations are calculated by examining
summaries of the area border routers.


Finally the AS takes the star configuration,with the
backbone as hub and each of the non
-
backbone areas
as spokes.

Neighbor 1

Neighbor 4

Neighbor 3

Neighbor 2

Neighbor Table

Link State Database

Routing Table

Router 1

Router 2

Receiver

Receiver

Sender

Sender

Neighbor 1

Neighbor 2

Neighbor 3

Neighbor 4

Neighbor Table

Link State Database

Routing Table

Hello

Hello ACK

Database

Description

Activity Diagram

Project Demo


To indicate the router is active the server is run.


We are statically initialising the potential neighbors and
their costs.


String[] names= {"Poirot", "Cadfael","Netlab1"};



String[] m={"4","5","6"};


There are multiple threads, one for each router
.


for(int i=0;i<names.length; i++)



{




new ClientThread(names[i],m[i]);



}



Hello Protocol


Hello packets are sent to each router to determine their
adjacency.


out.println("Hello");


Every router that receives the Hello packet sends an
ACK .


if (str.equals("Hello"))


{






System.out.println("Hello packet");





out.println("hello ack");




}

Building Neighbor table


When the hello ACK arrives the router inserts it into the
neighbor table.




st.executeUpdate( "INSERT INTO table2 VALUES(‘Router’,’its
neighbor’,cost)”);




The Link State Database is synchronized by flooding
Database Description packets from the neighbor table.


for(int l=i;l>=1;l
--
)



{




out.println("Database");




out.println(arr[l][1]);




out.println(arr[l][2]);




out.println(arr[l][3]);



}


Once the Link State Database is synchronized across the
autonomous system, router calculates shortest paths to all
destinations using Dijkstra’s algorithm.



functions1.dijkstra(source,v,e,vertices,ed);


Using shortest path tree,router builds routing table which
is used in making routing decisions.