Computer Network Lab Using NS2
Computer Network Lab Using NS2
Computer Network Lab Using NS2
PART-B
PROGRAM 1:
1 Problem Statement
Set up a simple network topology which consists of two nodes (n0-n1). Link existence (duplex in nature)
between the nodes is as follows: n0-n1 . The link no-n1 has 10 Mb of bandwidth and 10 ms of delay. Each
node uses Drop Tail queue of which the maximum size is 10.
2 Student Learning Outcomes
#output files
#creation of nodes
#$set n0 [new Node]
set n0 [$ns node]
set n1 [$ns node]
#run
$ns run
3.3 Expected Results
Program 2 :
1 Problem Statement
Set up a network topology using NS2 with nodes n0 , node n1 which are connected to n2 . Also n2 is
connected to n3. Create all links as duplex link and set the link bandwidth, propagation delay and
queue type of the n0,n2 as 10Mb, 10ms and drop tail queue. The link characteristics of n1,n2 is to be
set as 10Mb, 10ms and drop tail queue . Finally set the link characteristics of n2,n3 as 10Kb, 10oms
and drop tail queue.
#simulator initialization
set ns [new Simulator]
#output files
#packet trace output file
set trf [open wirednetwork.tr w]
$ns trace-all $trf
#creation of nodes
#$set n0 [new Node]
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
#connecting through links
$ns duplex-link $n0 $n2 10Mb 10ms DropTail
$ns duplex-link $n1 $n2 10Kb 100ms DropTail
$ns duplex-link $n2 $n3 10Kb 100ms DropTail
#agents[TCP] creation
set t [new Agent/TCP]
$ns attach-agent $n0 $t
Program 3:
1 Problem Statement
Set up star network using NS2 with central source node n0 which connected to n1 ,n2 n3,n4 and n5.
Create link as duplex link and set bandwidth as 1Mb, propagation delay as 10ms and queue type as drop
tail queue. Create a FTP application with TCP as transport layer (attach TCP agent and application agent).
Write a Tcl script to observe the packet flow for the given network in network animator (NAM).
Program 4:
1 Problem Statement
Set up star network using NS2 with central source node n0 which connected to n1 ,n2 n3,n4 and n5.
Create link as duplex link and set bandwidth as 1Mb, propagation delay as 10ms and queue type as drop
tail queue. Create an CBR application with UDP as transport layer (attach TCP and application agent).
Write a Tcl script to observe the packet flow for the given network in network animator (NAM).
proc finish { } {
global ns trf namf
$ns flush-trace
exec nam starnetwork.nam &
close $namf
close $trf
exit 0
}
PROGRAM 5:
1 Problem Statement
Set up a network using NS2 with source source node n0 ,n1 which connected
to n2 with duplex link characteristics as follows. (set set bandwidth as 1Mb,
propagation delay as 10ms and queue type as drop tail queue) . Create a link
between n2 and n3 with a duplex link and set bandwidth as 0.3Mb,
propagation delay as 100ms and queue type as drop tail queue. Create link
from n3 to n4 with link characteristics (set set bandwidth as 0.5Mb,
propagation delay as 40ms and queue type as drop tail queue) . Also Create
link from n3 to n5 with link characteristics (set set bandwidth as 0.5Mb,
propagation delay as 30ms and queue type as drop tail queue). Create two
transport layer agents with TCP and UDP. Create application traffic with
FTP
(Over TCP) , CBR (over UDP). Analyze the packet loss in the network using
NAM animator.
#simulator initialization
#output files
#creation of nodes
$ns run