Sunteți pe pagina 1din 11

LINK STATE ROUTING PROTOCOL

CHAPTER 1

INTRODUCTION

Link state routing protocols are like a road map. A link state router cannot be fooled
as easily into making bad routing decisions, because it has a complete picture of the network.
The reason is that unlike the routing-by-rumour approach of distance vector, link state routers
have first-hand information from all their peer 7 routers. Each router originates information
about itself, its directly connected links, and the state of those links (hence the name). This
information is passed around from router to router, each router making a copy of it, but never
changing it. The ultimate objective is that every router has identical information about the
internetwork, and each router will independently calculate its own best paths. Link state
protocols, sometimes called shortest path first or distributed database protocols, are built
around a well-known algorithm from graph theory, E. W. Dijkstra'a shortest path algorithm

Examples of link-state routing protocols include Open Shortest Path First (OSPF)
and Intermediate System to Intermediate System (IS-IS). The concept of link-state routing is
that every node constructs a map of the connectivity to the network, in the form of a graph,
showing which nodes are connected to which other nodes. Each node then independently
calculates the next best logical path from it to every possible destination in the network. Each
collection of best paths will then form each node's routing table.

Link-state routing uses link-state routers to exchange messages that allow each router
to learn the entire network topology. Based on this learned topology, each router is then able
to compute its routing table by using a shortest path computation.

Features of link state routing protocols

 Link state packet – A small packet that contains routing information.

 Link state database – A collection information gathered from link state packet.

 Shortest path first algorithm (Dijkstra algorithm) – A calculation performed on the


database results into shortest path

 Routing table – A list of known paths and interfaces.

Dept. of ECE, JSSTU, Mysore Page 1 2018-2019


LINK STATE ROUTING PROTOCOL

Distributing Maps in Link State:

This covers only the simplest configuration; i.e., one with no areas, so that all nodes have a
map of the entire network. The hierarchical case is somewhat more complex; see the various
protocol specifications. As previously mentioned, the first main stage in the link-state
algorithm is to give a map of the network to every node. This is done with several subsidiary
steps.

Determining the neighbors of each node:


First, each node needs to determine what other ports it is connected to, over fully working
links; it does this using a reachability protocol which it runs periodically and separately with
each of its directly connected neighbours.

Distributing the information for Map:

each node periodically (and in case of connectivity changes) sends a short message, the link-
state advertisement, which:

 Identifies the node which is producing it.


 Identifies all the other nodes (either routers or networks) to which it is directly
connected.
 Includes a 'sequence number', which increases every time the source node makes up a
new version of the message.

This message is sent to all that node’s neighbours. As a necessary precursor, each node in the
network remembers, for every one of its neighbours, the sequence number of the last link-
state message which it received from that node. When a link-state advertisement is received
at a node, the node looks up the sequence number it has stored for the source of that link-state
message: if this message is newer (i.e., has a higher sequence number), it is saved, and a copy
is sent in turn to each of that node's neighbours. This procedure rapidly gets a copy of the
latest version of each node's link-state advertisement to every node in the network.

Networks running link state algorithms can also be segmented into hierarchies which limit
the scope of route changes. These features mean that link state algorithms scale better to
larger networks.

Creating the Map:

Finally, with the complete set of link-state advertisements (one from each node in the
network) in hand, each node produces the graph for the map of the network. The algorithm
iterates over the collection of link-state advertisements; for each one, it makes links on the
map of the network, from the node which sent that message, to all the nodes which that
message indicates are neighbours of the sending node.

No link is considered to have been correctly reported unless the two ends agree; i.e., if one
node reports that it is connected to another, but the other node does not report that it is
connected to the first, there is a problem, and the link is not included on the map

Dept. of ECE, JSSTU, Mysore Page 2 2018-2019


LINK STATE ROUTING PROTOCOL

Calculating Routing Table:

As initially mentioned, the second main stage in the link-state algorithm is to produce routing
tables, by inspecting the maps. This is again done with several steps.

Each node independently runs an algorithm over the map to determine the shortest path from
itself to every other node in the network; generally some variant of algorithms used. This is
based around a link cost across each path which includes available bandwidth among other
things.
A node maintains two data structures: a tree containing nodes which are "done", and a list
of candidates. The algorithm starts with both structures empty; it then adds to the first one the
node itself. The variant of a Greedy Algorithm then repetitively does the following:

 All neighbour nodes which are directly connected to the node are just added to the tree
(excepting any nodes which are already in either the tree or the candidate list). The rest
are added to the second (candidate) list.
 Each node in the candidate list is compared to each of the nodes already in the tree. The
candidate node which is closest to any of the nodes already in the tree is itself moved into
the tree and attached to the appropriate neighbour node. When a node is moved from the
candidate list into the tree, it is removed from the candidate list and is not considered in
subsequent iterations of the algorithm.
The above two steps are repeated as long as there are any nodes left in the candidate list.
(When there are none, all the nodes in the network will have been added to the tree.) This
procedure ends with the tree containing all the nodes in the network, with the node on which
the algorithm is running as the root of the tree. The shortest path from that node to any other
node is indicated by the list of nodes one traverses to get from the root of the tree, to the
desired node in the tree.
With the shortest paths in hand, the next step is to fill in the routing table. For any given
destination node, the best path for that destination is the node which is the first step from the
root node, down the branch in the shortest-path tree which leads toward the desired
destination node. To create the routing table, it is only necessary to walk the tree,
remembering the identity of the node at the head of each branch, and filling in the routing
table entry for each node one comes across with that identity

Dept. of ECE, JSSTU, Mysore Page 3 2018-2019


LINK STATE ROUTING PROTOCOL

CHAPTER 2

ADVANTAGES AND DISADVANAGES OF LINK STATE ROUTING


PROTOCOL

Advantages:

 Link-state protocols use cost metrics to choose paths through the network. The cost
metric reflects the capacity of the links on those paths.
 Link-state protocols use triggered updates and LSA floods to immediately report
changes in the network topology to all routers in the network. This leads to fast
convergence times.
 Each router has a complete and synchronized picture of the network. Therefore, it is
very difficult for routing loops to occur.
 Routers use the latest information to make the best routing decisions.
 The link-state database sizes can be minimized with careful network design. This
leads to smaller Dijkstra calculations and faster convergence.
 Every router, at the very least, maps the topology of its own area of the network. This
attribute helps to troubleshoot problems that can occur.
 Link-state protocols support CIDR and VLSM.

Disadvantages:

 They require more memory and processor power than distance vector protocols. This
makes it expensive to use for organizations with small budgets and legacy hardware.
 They require strict hierarchical network design, so that a network can be broken into
smaller areas to reduce the size of the topology tables.
 They require an administrator who understands the protocols well.
 They flood the network with LSAs during the initial discovery process. This process
can significantly decrease the capability of the network to transport data. It can
noticeably degrade the network performance.

Dept. of ECE, JSSTU, Mysore Page 4 2018-2019


LINK STATE ROUTING PROTOCOL

CHAPTER 3

INTRODUCTION TO NS2

Setting up a network to do some real experiments is the best way for studying
about communication in internet. However, setting a network is not easy and costly. For
this reason, a virtual network provided by network simulator is used for experiment in only
one computer. Specially, NS2 which is free and easy to use is the popular all over the
world.

NS2 Manual

NS2 use Tcl language for creating simulation scenario file (for example, sample.tcl).
Network topology, transmission time, using protocol etc... are defined in scenario file. If we
execute this scenario file, the simulation result will be output to out.tr and out.nam file.

1. out.tr - all the information about communication is written in this file. We can find out the
way a packet was forwarded. This file is called as trace file.

2. Out.nam - contains the data for animation of the experiment result. This file can be
executing by Nam, an animation software. The state of forwarding packet in Nam is shown
in Fig.2. If simulation use TCP, we can also observe the state of TCP congestion control by
a trace file.

3. out.tcp - Record the change of TCP parameters by time. Using Gnuplot software to plot a
graph, it is easy to observe the appearance of congestion control. This file is called as TCP
trace file.

Dept. of ECE, JSSTU, Mysore Page 5 2018-2019


LINK STATE ROUTING PROTOCOL

Fig 3.1: shows the difference between real and simulation network

A computer network is usually defined as a collection of computers interconnected for


gathering, processing, and distributing information. Computer is used as a broad term here to
include devices such as workstations, servers, routers, modems, base stations, and wireless
extension points. These computers are connected by communication links such as copper
cables, fiber optic cables, and microwave/satellite/radio links. A computer network can be
built as a nesting and/or interconnection of several networks. The Internet is a good example
of computer networks. In fact, it is a network of networks, within which tens of thousands of
networks interconnect millions of computers worldwide.

Simulations approach is, it recreates real-world scenarios using computer programs. It is used
in various applications ranging from operations research, business analysis, manufacturing
planning, and biological experimentation, just to name a few. Compared to analytical
modelling, simulation usually requires fewer simplification assumptions, since almost every
possible detail of system specifications can be incorporated in a simulation model. When the
system is rather large and complex, a straightforward mathematical formulation may not be
feasible. In this case, the simulation approach is usually preferred to the analytical approach

Dept. of ECE, JSSTU, Mysore Page 6 2018-2019


LINK STATE ROUTING PROTOCOL

CHAPTER 4

NETWORK

Fig 4: Block diagram for Link-state routing protocol

Fig 4.2: Schematic diagram of Link-State-routing protocol.

Dept. of ECE, JSSTU, Mysore Page 7 2018-2019


LINK STATE ROUTING PROTOCOL

CHAPTER 5

SOURCE CODE
5.1 PROTOCOL PROGRAM

set ns [new Simulator]

set nf [open out.nam w]


$ns namtrace-all $nf

set tr [open out.tr w]


$ns trace-all $tr

proc finish {} {
global nf ns tr
$ns flush-trace
close $tr
exec nam out.nam &
exit 0
}

set n0 [$ns node]


set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]

$ns duplex-link $n0 $n1 10Mb 10ms DropTail


$ns duplex-link $n1 $n3 10Mb 10ms DropTail
$ns duplex-link $n2 $n1 10Mb 10ms DropTail

$ns duplex-link-op $n0 $n1 orient right-down


$ns duplex-link-op $n1 $n3 orient right
$ns duplex-link-op $n2 $n1 orient right-up

set tcp [new Agent/TCP]


$ns attach-agent $n0 $tcp

set ftp [new Application/FTP]


$ftp attach-agent $tcp

set sink [new Agent/TCPSink]


$ns attach-agent $n3 $sink

Dept. of ECE, JSSTU, Mysore Page 8 2018-2019


LINK STATE ROUTING PROTOCOL

set udp [new Agent/UDP]


$ns attach-agent $n2 $udp

set cbr [new Application/Traffic/CBR]


$cbr attach-agent $udp

set null [new Agent/Null]


$ns attach-agent $n3 $null

$ns connect $tcp $sink


$ns connect $udp $null

$ns rtmodel-at 1.0 down $n1 $n3


$ns rtmodel-at 2.0 up $n1 $n3

$ns rtproto LS

$ns at 0.0 "$ftp start"


$ns at 0.0 "$cbr start"

$ns at 5.0 "finish"

$ns run

Dept. of ECE, JSSTU, Mysore Page 9 2018-2019


LINK STATE ROUTING PROTOCOL

CHAPTER 6

RESULTS AND CONCLUSION

6.1 Snapshot of output

Fig 6.1: Node is created and data is transferred

Fig 6.2: Data transferring and receiving through nodes.

Dept. of ECE, JSSTU, Mysore Page 10 2018-2019


LINK STATE ROUTING PROTOCOL

CONCLUSION
Thus a point to point network with a duplex link between the nodes has been established
using an ns2 simulator. The Queue size has been set to a variable size. The bandwidth has been
made to vary. The screenshot represents the output of simulation

REFERENCES

[1] http://myns2prac.blogspot.com/2012/12/ns2-simulation-using-link-state-routing.html

[2] https://en.wikipedia.org/wiki/Link-state_routing_protocol

Dept. of ECE, JSSTU, Mysore Page 11 2018-2019

S-ar putea să vă placă și