Download as pdf or txt
Download as pdf or txt
You are on page 1of 33

Indira Gandhi Delhi Technical University

for Women

Lab Practical File


for

DATA COMMUNICATION AND


COMPUTER NETWORKS

Name: PRACHI AGGARWAL


Enrollment No.:03401032020
Branch: Information Technology
Batch:IT1(G)
Network Simulator (NS) is
simply a discrete event-driven
network
Assignment 1 simulation tool for studying the
dynamic nature of
communication
networks
Introduction to network simulators
Network Simulators: Software that is used to predict the performance of a
computer network is known as a network simulator. These are used when
communication networks have turned into too difficult for fixed analytical
techniques to offer a precise understanding of system performance. In a
simulator, the computer network can be moulded with the help of links, devices
and applications and the performance of a network can be reported. These are
available by using new networks and technologies which are used today
like IoT, 5G, WLANs, ad hoc networks of mobile, WSNs, LTE, ad hoc
networks of vehicles, etc.

Different types of network simulators


The different types of network simulators/ network simulation tools are open
source and commercial
• Network Simulator Version 2 (NS-2)
It is an object-oriented kind of simulator mainly used for simulating the
protocols of networking as well as routing protocols for the networks like wired
& wireless. These can be implemented through OTCl & C++.
• Ns3
This type of simulator is mainly designed for the purpose of education as well
as research. When compared with the Ns2 type, it uses Python to work in a
better way because of the low-level of abstraction. The modules of Ns3 include
protocols and network devices, written in the languages of C++, Python.
• Netki
Netki is open-source software that uses User-mode Linux. This simulator is
used whenever there is a need to form a networking environment with small
endeavors. It is a simulation tool based on the command line. It is also used to
create a total network over a single PC through exploiting VN (virtual network)
devices.
• Marionnet
Marionnet/Virtual Network Laboratory is utilized as an educational tool
because of its smart Graphical user interface. By using this, a complex network
can be defined by the user on a host computer.
• Java-based Simulation (JSIM)
It is used mainly in web-based simulation to build by using the event package
otherwise process the package. This is used to design quantitative numeric
models & estimate them with respect to the data from the experiment.
• OPNET
It is used in research & development to provide whole flexibility to study
regarding communication networks, protocols, and applications. When it
includes both programming environment and GUI, then it provides a platform
for the user to form the network when they require it.
• QualNet
It is used for engineers, scholars to build virtual models for all kinds of data,
voice & video networks. In fact, it is a testing, planning and also a training tool
used for signifying the network situation with accuracy.

Advantages of Network Simulation


The advantages of network simulators include the following.
• The main advantage of a simulator is to provide practical feedback to the
users while designing real-world systems.
• They allow the designers of the system to study trouble at numerous
abstraction levels.
• These are used in an effective way which means to teach otherwise
demonstrate the concepts to students.

What is NS2? expeiment conduct

Network simulation (NS) is one of the types of simulation, which is used to


simulate the networks such as in MANETs, VANETs, etc. It provides
simulation for routing and multicast protocols for both wired and wireless
networks. NS is licensed for use under version 2 of the GNU (General Public
License) and is popularly known as NS2. It is an object-oriented, discrete event-
driven simulator written in C++ and Otcl/Tcl.

NS-2 can be used to implement network protocols such as TCP and UDP, traffic
source behavior such as FTP, Telnet, Web, CBR, and VBR, router queues
management mechanism such as Drop Tail, RED, and CBQ, routing algorithms,
and many more. In ns2, C++ is used for detailed protocol implementation and
Otcl is used for the setup. The compiled C++ objects are made available to the
Otcl interpreter and in this way, the ready-made C++ objects can be controlled
from the OTcl level.

Features of NS2
• It’s a networking research discrete event simulator.
• It has a lot of features for simulating protocols including TCP, FTP, UDP,
HTTPS, and DSR.
• It is capable of simulating both wired and wireless networks.
• It is mostly based on Unix.
• Its scripting language is TCL.
• Tclcl is a C++ and otcl linkage language.
• Scheduler for discrete events.

Objectives of NS2 simulation


• Performance.
• Direct Measurement.
• Reactive.
• The behavior/characteristics are affected when the user/system is
disturbed.
• The simulation can be done only on completed running systems.
• Predictive
Advantages of Ns2 simulation
• Ns2 simulation is cheaper sometimes.
• Sometimes it finds bugs (in design) in an advanced manner.
• Generality: over analytic/numerical techniques, it gives more generality.
• Detail: At an arbitrary level, system details also can be simulated.

Why did we choose NS2 over other simulators?


• The real-systems are not available which is complex/costly or
dangerous (e.g., space simulations, and also flight simulations)
• The design alternatives (e.g., different system configurations) were also
evaluated quickly.
• The complex functions for which closed-form formulas or numerical
techniques not available are also evaluated.

Steps to install NS2 on windows


NS2 builds and runs under windows using Cygwin. Cygwin provides Linux like
environment under windows.
System Requirements: A computer with C++ compiler. Building full NS2
package requires large memory space approximately 250MB
I. Steps to install NS 2 on windows 7 are given below
1. Download Cygwin from following link https://www.cygwin.com/setup.exe
2. Run the downloaded setup.exe and you will see screen shown below click
next.
3. Select option "Install From Internet". If you have already downloaded the
package select "Install from local directory" and click next
4. Keep the default installation directory as "C:\cygwin" and click next
5. Keep default local package directory as your download folder and click next.
6. Select the relevant options to install cygwin
7. Cygwin installation is complete now you can run Cygwin from desktop and
see its interface.
II. Steps is to install NS2
1. Download NS2 from following link: https://www.isi.edu/nsnam/dist/ns-
allinone-2.28.tar.gz
2. Decompress the file use winrar. Copy the decompressed folder the Cygwin
installation directory under the subdirectory home. It will be
C:\cygwin\home\system_name : where system_name is name of your system in
above Cygwin installation this path will be C:\Cygwin\home\sys27
3. Run Cygwin from desktop and change the directory to folder you copied just
now in step 2 command to change directory:cd /home/sys27/ns-allinone-2.28
NOTE: please change sys27 to name of your system
4. To start installation type following command:"./install"(WITHOUT qoutes)
5. Add following lines to the .bashrc

export NS_HOME=/home/sys27/ns-allinone-2.28
export PATH=$NS_HOME/nam-1.11:$NS_HOME/tcl8.4.5/unix:$NS_HOME/tk8.4.5/unix:$NS_HOM
E/bin:$PATH
export LD_LIBRARY_PATH=$NS_HOME/tcl8.4.5/unix:$NS_HOME/tk8.4.5/unix:$NS_HOME/otcl-
1.9:$NS_HOME/lib:$LD_LIBRARY_PATH
export TCL_LIBRARY=$NS_HOME/tcl8.4.5/library
Assignment 2

1. WAP to print “Hello World” using tcl

2. WAP to demonstrate user input and output in tcl

3. WAP to demonstrate conditional operator (if else) in tcl


4. WAP to input two numbers and perform all four mathematical operations
5. WAP to check whether number is prime or not

6. WAP to find factorial of number


Assignment 3
1. Introduction to NAM
network animator
Nam is a Tcl/TK based animation tool for viewing network simulation traces and real-
world packet traces. It supports topology layout, packet level animation, and various
data inspection tools.
Nam began at LBL. It has evolved substantially over the past few years.

2. WAP to demonstrate the traffic of duplex link between nodes in


TCL by

i) Running FTP application over TCP


ii) CBR over UDP
D
Assignment 4

Introduction to awk utility i.e., working with trace files

Awk is a scripting language used for manipulating data and generating reports. The awk
command programming language requires no compiling and allows the user to use variables,
numeric functions, string functions, and logical operators.
Awk is a utility that enables a programmer to write tiny but effective programs in the form of
statements that define text patterns that are to be searched for in each line of a document and
the action that is to be taken when a match is found within a line. Awk is mostly used for
pattern scanning and processing. It searches one or more files to see if they contain lines that
matches with the specified patterns and then perform the associated actions.

Awk is abbreviated from the names of the developers – Aho, Weinberger, and Kernighan.

1. AWK Operations:
(a) Scans a file line by line
(b) Splits each input line into fields
(c) Compares input line/fields to pattern
(d) Performs action(s) on matched lines

2. Useful For:
(a) Transform data files
(b) Produce formatted reports
Awk is mostly used for pattern scanning and processing

3. Programming Constructs:
(a) Format output lines
(b) Arithmetic and string operations
(c) Conditionals and loops

a. Simulate a three node point-to-point network with duplex links


between them. Set the queue size and vary the bandwidth and find
the number of packets dropped.
b. Simulate a 4 node point-to-point network with the links connected
as follows: n0-n2, n1-n2 and n2-n3. Apply TCP agent between n0-n3
and UDP between n1-n3. Apply relevant application over TCP and
UDP agents changing the parameter and determine number of
packets sent by TCP/UDP.
Assignment 5
Introduction to routing.

The process of sending packets from one network to another is called


routing. Routing is of two types of static and dynamic. Routes are based
on the destination network. Routing is to find the best path for the
network from one network to another. The best path is chosen on the
basis of metric and administrative distance. Routing is performed by
routers. For this routers make routing tables. Now let's understand about
routing tables.

Routers make routing tables that contain the following information's:


• Destination network and its subnet mask.
• There is information about the next hop router to go to Destination
network.
• Routing metrics and administrative distance are stored

There are 3 types of routing:


Static routing: Static routing is a process in which we have to manually
add routes to the routing table.

Default Routing: This is the method where the router is configured to


send all packets towards a single router (next hop). It doesn’t matter to
which network the packet belongs, it is forwarded out to the router
which is configured for default routing. It is generally used with stub
routers. A stub router is a router that has only one route to reach all
other networks.

Dynamic Routing: Dynamic routing makes automatic adjustments of


the routes according to the current state of the route in the routing table.
Dynamic routing uses protocols to discover network destinations and the
routes to reach them.

Unicast – Unicast means the transmission from a single sender to a


single receiver. It is a point-to-point communication between sender and
receiver. There are various unicast protocols such as TCP, HTTP, etc.
• TCP is the most commonly used unicast protocol. It is a connection-
oriented protocol that relies on acknowledgement from the receiver
side.
• HTTP stands for HyperText Transfer Protocol. It is an object-oriented
protocol for communication.

There are three major protocols for unicast routing:

1. Distance Vector Routing


2. Link State Routing
3. Path-Vector Routing

WAP to demonstrate unicast routing.


Assignment 6
Multicast routing is a networking method for efficient distribution of one-to-
many traffic. A multicast source, such as a live video conference, sends traffic
in one stream to a multicast group. The multicast group contains receivers such
as computers, devices, and IP phones.
Common uses include these technologies:
▪ Voice over IP (VOIP)
▪ Video on demand (VOD)
▪ Video conferencing
▪ IP television (IPTV)
WAP to demonstrate multicast routing.
TELNET stands for Teletype Network. It is a type of protocol that enables
one computer to connect to local computer. It is a used as a standard
TCP/IP protocol for virtual terminal service which is given by ISO.
Computer which starts connection known as the local computer.
• Computer which is being connected to i.e., which accepts the connection
known as remote computer. When the connection is established between
local and remote computer.
• During telnet operation whatever that is being performed on the remote
computer will be displayed by local computer. Telnet operates on
client/server principle. Local computer uses telnet client program and the
remote computers uses telnet server program.
Assignment 7
Simulate the different types of Internet traffic such as FTP and
TELNET over a network and analyse the throughput.
Assignment 8
Introduction to Ethernet/LAN. Simulate an Ethernet LAN using n
nodes (6-10), change error rate and data rate and compare throughput.
Ethernet is a type of communication protocol that is created at Xerox PARC in
1973 by Robert Metcalfe and others, which connects computers on a network
over a wired connection. It is a widely used LAN protocol, which is also known
as Alto Aloha Network. It connects computers within the local area network and
wide area network. Numerous devices like printers and laptops can be
connected by LAN and WAN within buildings, homes, and even small
neighbourhoods.
It offers a simple user interface that helps to connect various devices easily,
such as switches, routers, and computers. A local area network (LAN) can be
created with the help of a single router and a few Ethernet cables, which enable
communication between all linked devices. This is because an Ethernet port is
included in your laptop in which one end of a cable is plugged in and connect
the other to a router. Ethernet ports are slightly wider, and they look similar to
telephone jacks.
With lower-speed Ethernet cables and devices, most of the Ethernet devices are
backward compatible. However, the speed of the connection will be as fast as
the lowest common denominator. For instance, the computer will only have the
potential to forward and receive data at 10 Mbps if you attach a computer with a
10BASE-T NIC to a 100BASE-T network. Also, the maximum data transfer
rate will be 100 Mbps if you have a Gigabit Ethernet router and use it to connect
the device.
Collision
• In a half-duplex Ethernet network, a collision is the result of two devices
on the same Ethernet network attempting to transmit data at exactly the
same time. The network detects the "collision" of the two transmitted
packets and discards them both.
• Collisions are a natural occurrence on Ethernets. Ethernet uses Carrier
Sense Multiple Access/ Collision Detect (CSMA/CD) as its method of
allowing devices to "take turns" using the signal carrier line.
• When a device wants to transmit, it checks the signal level of the line to
determine whether someone else is already using it. If it is already in use,
the device waits and retries, perhaps in a few seconds. If it isn't in use,
the device transmits.
Assignment 9
Simulate an Ethernet LAN using n nodes and set multiple traffic
nodes and determine collision across different nodes.
Congestion Window
Congestion Window (cwnd) is a TCP state variable that limits the amount of data the
TCP can send into the network before receiving an ACK.
Assignment 10
Simulate an Ethernet LAN using n nodes and set multiple traffic
nodes and plot congestion window for different
source/destination.

You might also like