Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 16

Network Simulator Installation

A Dissertation Submitted to the


University of Mumbai, Mumbai
In partial fulfilment of the course work leading to

Bachelor of Engineering
In
Computer Engineering

SUBMITTED BY:
Ms. Sneha Thakur
Mr.Omkar Thakur

Under the guidance of


Prof. Pooja Permare

Department of Computer Engineering


Pillai HOC College of Engineering & Technology, Rasayani
Pillai's HOC Educational Campus, HOCL Colony
Rasayani Tal: Khalapur, Dist Raigad-410207
[2017-18]
Index

Chapter No. Content Name Page No.


1 Introduction 3
2 Literature Survey 4

3 Requirement Gathering 5
4 Installation Process Steps 6

5 NS2 Install 10

6 Conclusion 15

7 Reference 16
INTRODUCTION

A network simulator is software that predicts the behaviour of a computer network. Since
communication Networks have become too complex for traditional analytical methods to
provide an accurate understanding of system behaviour, network simulators are used. In
simulators, the computer network is typically modelled with devices, links, applications etc. and
the performance is analysed. Simulators typically come with support for the most popular
technologies and networks in use today.

In communication and computer network research, network simulation is a technique where a


program models the behaviour of a network either by calculating the interaction between the
different network entities (hosts/packet, etc.) using mathematical formulas, or actually
capturing and playing back observations from a production network. The behaviour of the
network and the various applications and services it supports can then be observed in a test lab;
various attributes of the environment can also be modified in a controlled manner to assess how
the network would behave under different conditions.

A network simulator is software or hardware that predicts the behaviour of a computer network
without an actual network being present. In simulators, the computer network is typically
modelled with devices, traffic etc. and the performance is analysed. Typically, users can then
customize the simulator to fulfil their specific analysis needs. Simulators typically come with
support for the most popular protocols and networks in use today, such as WLAN, Wi-Max,
TCP, WSN, cognitive radio etc.

Generally the simulated networks have entities like links, switches, hubs, applications, etc. NS2
is a name for series of discrete event network simulators like ns-1, ns-2, and ns-3. All of them
are discrete-event network simulators, primarily used in research and teaching. Ns2 is free
software, publicly available under the GNU GPLv2 license for research, development and use.
Literature Survey

Simulation is a very important modern technology. It can be applied to different science,


engineering, or other application fields for different purposes. Computer assisted simulation can
model hypothetical and real-life objects or activities on a computer so that it can be studied to
see how the system function. Different variables can be used to predict the behavior of the
system. Computer simulation can be used to assist the modeling and analysis in many natural
systems. Typical application areas include physics, chemistry, biology, and human-involved
systems in economics, finance or even social science. Other important applications are in the
engineering such as civil engineering, structural engineering, mechanical engineering, and
computer engineering. Application of simulation technology into networking area such as
network traffic simulation, however, is relatively new. For network simulation, more
specifically, it means that the computer assisted simulation technologies are being applied in the
simulation of networking algorithms or systems by using software engineering. The application
field is narrower than general simulation and it is natural that more specific requirements will
be placed on network simulations.
Requirement Gathering

Software Requirement
Operating system : Windows XP/7/Linux
Implementation : NS2
NS Version : NS2.2.28
Language : Tool Command Language

Hardware Requirement
Hardware Disk Space : Minimum of 20GB
RAM : Minimum of 512MB
Processor : Intel Core Dual
INSTALLTION PROCESS STEPS:

1. First of all, get the Linux OS image or CD. You can get it for free from Linux website
http://www.ubuntu.com/GetUbuntu/download Or, if you are looking for old versions,
you can find it in: http://mirrors.isu.net.sa/

2. If you are a windows user, then you have to download Linux in a separate partition, or
use a virtual machine. My advice to you is to use a virtual machine. One of the best
virtual machine SW is Vmware. You can buy it or Install trial Vmware Workstation SW
from: http://www.vmware.com/support/product-support/workstation/
There are bunch of alternative Free SW to create Virtual machines, one of them is
Virtual Box. You can download it from: http://www.virtualbox.org/wiki/Downloads

3. In this manual, I will be using Vmware to create my virtual machine. To create a virtual
machine: Open the Vmware workstation -> Click "New Virtual Machine"
4. Choose "Typical" and click "Next"

5. Then browse to the directory where you saved the Ubuntu iso image, or choose install it
from a dis if you Ubuntu is placed in a CD and click "Next".
6. Enter a user name and password to log in to Ubuntu after you install it, and click "Next"

7. Give your virtual machine a name, and choose its location, and click "Next"
8. Choose the size for the hard disk for the virtual machine, I will leave this as default, and then
click "Next"

9. Click "Finish", and the Ubuntu installation will start


Note: You can change the RAM size and many of the virtual machine specifications but this is
out of this manual scope. Just keep in mind that you are using your real machine resources like
RAM, Processor to run the virtual machine.

10. After that, the installation will continue, and after that you finish installing Ubuntu
INSTALL NS2

1. Download the NS2 files from the Internet


http://sourceforge.net/projects/nsnam/files/ns-2/2.34/
2. Extract the files
3. Put the files in the Home folder

4. Set the appropriate permissions for the ns-allinone-2.34 to allow executing the files
inside it. To do that: Right click the folder -> Properties -> Permissions , and choose
the appropriate group with the appropriate file access, then click "Allow executing file
as program" and then click "Apply permissions to enclosed files"
5. From the Accessories -> Terminal

6. Type the following command to know in which directory you are: ~$ pwd

7. You need to be in the directory where you placed the ns-allinone-2.34 folder

8. If you are not in the /home/e , then move to it by using the command cd

9. Now, supposing you are in the directory /home/e (e can be any other user) type the
following command to move inside the ns-allinone-2.34 using the command cd
$ cd ns-allinone-2.34

10. Then, type the following command (you will be asked to enter the system password to
process. Also, you will be asked if you want to continue, type: y to continue): $ sudo
apt-get install build-essential autoconf automake libxmu-dev

11. Type the following command to install NS2 $ ./install


RUN YOUR FIRST NAM EXAMPLE

1. From the terminal type the following:


$ cd ns-allinone-2.34
$ cd nam-1.14
$ cd edu
$ exec nam A2-stop-n-wait-loss.nam

Program:

#Create a simulator object


set ns [new Simulator]
#Define different colors for data flows (for NAM)
$ns color 1 Blue
$ns color 2 Red
#Open the NAM trace file
set nf [open out.nam w]
$ns namtrace-all $nf
#Define a 'finish' procedure
proc finish {} {
global ns nf
$ns flush-trace
#Close the NAM trace file
close $nf
#Execute NAM on the trace file
exec nam out.nam &
exit 0
}

#Create four nodes


set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
#Create links between the nodes
$ns duplex-link $n0 $n2 2Mb 10ms DropTail
$ns duplex-link $n1 $n2 2Mb 10ms DropTail
$ns duplex-link $n2 $n3 1.7Mb 20ms DropTail
#Set Queue Size of link (n2-n3) to 10
$ns queue-limit $n2 $n3 10
#Give node position (for NAM)
$ns duplex-link-op $n0 $n2 orient right-down
$ns duplex-link-op $n1 $n2 orient right-up
$ns duplex-link-op $n2 $n3 orient right
#Monitor the queue for link (n2-n3). (for NAM)
$ns duplex-link-op $n2 $n3 queuePos 0.5
#Setup a TCP connection
set tcp [new Agent/TCP]
$tcp set class_ 2
$ns attach-agent $n0 $tcp
set sink [new Agent/TCPSink]
$ns attach-agent $n3 $sink
$ns connect $tcp $sink
$tcp set fid_ 1
#Setup a FTP over TCP connection
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ftp set type_ FTP
#Setup a UDP connection
set udp [new Agent/UDP]
$ns attach-agent $n1 $udp
set null [new Agent/Null]
$ns attach-agent $n3 $null
$ns connect $udp $null
$udp set fid_ 2
#Setup a CBR over UDP connection
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $udp
$cbr set type_ CBR
$cbr set packet_size_ 1000
$cbr set rate_ 1mb
$cbr set random_ false
#Schedule events for the CBR and FTP agents
$ns at 0.1 "$cbr start"
$ns at 1.0 "$ftp start"
$ns at 4.0 "$ftp stop"
$ns at 4.5 "$cbr stop"
#Detach tcp and sink agents (not really necessary)
$ns at 4.5 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n3 $sink"
#Call the finish procedure after 5 seconds of simulation time
$ns at 5.0 "finish"
#Print CBR packet size and interval
puts "CBR packet size = [$cbr set packet_size_]"
puts "CBR interval = [$cbr set interval_]"
#Run the simulation
$ns run
2. The following window appears; click the Play button to see the protocol animation
CONCLUSION

Network simulators for the people who are not very familiar with this topic, or for someone
who want to get some general information related to it. So in this paper, we first gave a brief
introduction on some key concepts of network simulation and network simulators. After that,
we introduced four typical network simulators: OPNET, NS2, NS3, and OMNeT++. Their main
features, current status and future development are also analyzed and discussed. As an
assumptive expectation, the open sourced and well designed embedded Object-oriented
programming feature will be appealing to the academia and industry in the long run. It seems
that the easier for the users to learn and to use, the more organizations participate in, the more
specialized in the documentation, the more development and popularity that simulator will
achieve.
REFERENCE

1. http://www.wan-sim.net/
2. http://nsnam.isi.edu/nsnam/index.php/Main_Page
3. http://www.nsnam.org/documents.html
4.http://www.cs.cornell.edu/skeshav/real/overview.html

You might also like