0% found this document useful (0 votes)
15 views

Network Lab

The document discusses implementing a "Hello World" TCL program in the NS2 network simulator. It provides an overview of TCL, NS2, and NAM. It also outlines the steps taken to install NS2 and NAM, including using apt-get to install NS2, purging and reinstalling nam, and downloading/unpacking the NAM zip file. It includes a simple TCL program that outputs "hello world" and screenshots of the program running in NS2.

Uploaded by

24khushi kumawat
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Network Lab

The document discusses implementing a "Hello World" TCL program in the NS2 network simulator. It provides an overview of TCL, NS2, and NAM. It also outlines the steps taken to install NS2 and NAM, including using apt-get to install NS2, purging and reinstalling nam, and downloading/unpacking the NAM zip file. It includes a simple TCL program that outputs "hello world" and screenshots of the program running in NS2.

Uploaded by

24khushi kumawat
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Name: Jatin Ghind Batch No: S23 Roll No: 133

Assignment No: 2

Aim:
To study installation and configuration of NS2 and implementation of TCL
Hello World.

TCL Programming: Tcl (Tool Command Language) is a very powerful but easy
to learn dynamic programming language, suitable for a very wide range of uses,
including web and desktop applications, networking, administration, testing and
many more. Open source and business-friendly, Tcl is a mature yet evolving
language that is truly cross platform, easily deployed and highly extensible. It
aims at providing the ability for programs to interact with other programs and
also for acting as an embeddable interpreter. Even though the original aim was
to enable programs to interact, you can find full-fledged applications written in
Tcl/Tk.

NS2: Ns (from network simulator) is a name for a series of discrete event


network simulators, specifically ns-1, ns-2, and ns-3. Ns is a discrete event
simulator targeted at networking research. Ns provides substantial support for
simulation of TCP, routing, and multicast protocols over wired and wireless
(local and satellite) networks.

NAM: 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, andvarious data inspection tools.It has a graphical interface, which
can provide information such as number of packet drops at each link. This trace
data is typically derived as output from a network simulator like ns or from real
network measurements,

e.g., using tcpdump.

We can either start NAM with the command


'nam <nam-file>'
where '<nam-file>' is the name of a NAM trace file that was generated by NS or
one can execute it directly out of the Tcl simulation script for visualisation of
node movement.
Name: Jatin Ghind Batch No: S23 Roll No: 133

Steps for NS2 and NAM installation with screenshot:

Step 1: sudo apt-get install NS2


Step 2: ns
Step 3: Press – Control C
Step 4: sudo apt-get purge nam
Step 5: downloading zip file.
Step 6: unzipping zip file.
Step 7: unpacking and setting up nam.
Step 8: nam.

Hello World Program with output.

Running/Executing a TCL file in NS2


• ns jatin.tcl

Output:

Explanation:-
set ns [new Simulator] - Sets a new simulator of the name „ns‟.
$ns at 1 "puts \"hello world\"" -Puts “hello world” in the simulator of the file.
$ns at 1.5 "exit" - Exits the simulator.
$ns run – Runs the simulator.

You might also like