Skip to main content

How to Run TCL File in Network Simulator 2

1. Install NS2 and set the path.

2. After Installing NS2, go the $prompt and run ns filename
For example, ns tcp.tcl (if the file name is tcp.tcl)

3. after the previous statement automatically the .nam and .tr files will be created in the same folder (the tcl file should contain the provision of tracing the nam and trace file.. those examples we will discuss later in the blog)
(nam means Network Animator and tr means Trace file)

4. to see the demo in GUI, run nam tcp.nam
(a window will be opened and you can click the run button )
5. .tr file is actual file helpful to see the performance factors like(throughput, packet drop, etc).
You can parse the .tr file using softwares like tracegraph202(need to download separately) or xgraph( which comes along with ns2)


  1. sir,
    i am in final year of b-tech iam doing in my project "implementation of flow and error control using ns2" so till now i have install ns2 2.29 on ubuntu 9.4

    kindly send me the source code for "implementing flow and error control " as soon as possible.

  2. Dear Sir,
    Im a doing a project on Mobile Adhoc network using ns2 2.34 ,we propose a new routing protocol to support the selection of stable and high speed route in Multi-Rate Mobile Ad-hoc Networks (MANET). We introduce another approach for modeling the mobility aspect under the relation with the variation of communication rate. Maximize the proposed "Route Selection Indicator" (RBI) ensures that the selected route is the most stable, has highest speed among route candidates. Kindly provide me the source code to choose the stable,highspeed route using RSI metric.

  3. hello sir
    i am learner or ns2... how to run .tcl file in ns2

  4. Shilpananda R Hegde26 February 2011 at 12:23

    sir i am pursuing my engineering now and presently belong to 8th semister. I am doing project on
    " Model Based technique for data reliability in wireless sensor network using ns-2". but i didnt know how to implement wireless sensor network using ns2. so please send the source code for implementation...

    waiting for your help

  5. sir,
    hav nstalled ns2 2.34 allinone,but aftr nstallation it is not giving % on wrting ns,rather it is giving
    divya@divya-laptop:~$ ns
    Usage: host [-v] [-a] [-t querytype] [options] name [server]
    Listing: host [-v] [-a] [-t querytype] [options] -l zone [server]
    Hostcount: host [-v] [options] -H [-D] [-E] [-G] zone
    Check soa: host [-v] [options] -C zone
    Addrcheck: host [-v] [options] -A host
    Listing options: [-L level] [-S] [-A] [-p] [-P prefserver] [-N skipzone]
    Common options: [-d] [-f|-F file] [-I chars] [-i|-n] [-q] [-Q] [-T] [-Z]
    Other options: [-c class] [-e] [-m] [-o] [-r] [-R] [-s secs] [-u] [-w]
    Special options: [-O srcaddr] [-j minport] [-J maxport]
    Extended usage: [-x [name ...]] [-X server [name ...]]
    pls help me ,so tht i can start ma project as soon as possible:)

  6. sir
    i m doing my dissertation on the topic of performance evalution of dsdv and aodv routing protoals for wsn. please send me the source code in ns2.34.
    i will be the thankful to you

  7. sir
    i am the new person to work with ns2...while i run the tcl file,the .tr file was create,but the .nam file cant able to create.will u please help me how to create the nam file.thank u.

  8. sir
    i am doing final yr project in wireless sensor network in ns2.34 and i installed ns2.34 in ubuntu 11.04 and successfully runs the tcl files. i need patch for wireless network and the installation steps please help me sir
    thank you sir.

  9. sir,
    i want the sources codesof some wireless routing protocols like dsdv,aodv etc. where can we find or get them.please list the sources..
    with regards

  10. you can find examples in the ns2 source itself.

  11. Very useful website even for the beginners who dont about NS2

  12. Sir,
    I m not be able to wireless scripts on ns2.34 on ubuntu11.04.It gives mobility error plzzzz help me.

  13. Dear Sir,
    Im a doing a project on Mobile Adhoc network using ns2,we propose a new routing protocol to support the selection of stable and high speed route in Multi-Rate Mobile Ad-hoc Networks (MANET). I am installing ns2 on my laptop's window xp by using cygwin. some issues occurred while installing. help me to come out from this dilemma..

  14. sir,how are we going to know or read the output of the trace file??


Post a comment

Popular posts from this blog

Implementing a new system call in Kernel version 2.6.32

A system call is used by application or user programs to request service from the operating systems. Since the user programs does not have direct access to the kernel whereas the OS has the direct access. OS can access the hardware through system calls only. The following files has to be modified for implementing a system call /usr/src/linux- /usr/src/linux- /usr/src/linux- /usr/src/linux- New set of files to be created Create a new directory newcall/ inside the path “ /usr/src/linux- ” Create new files Makefile, newcall.c and put them in the /usr/src/linux- folder Create new user files (in any folder of Linux) to test the system call testnewcall.c, testnewcall.h (created in /home/pradeepkumar ) syscall_table_32.S Find the file /usr/src/linux-

How to Access MOODLE in Intranet and Internet

When Moodle is accessed either in Intranet or internet, there will not be any issue. But occasions when the MOODLE Site has to be accessed both in the intranet and in the Internet, here is a simple trick Server Used: IBM Blade Servers Operating system: Windows Server 2008 Moodle Version: 2.4 WAMP Server is used. Number of Users: 3000 (Students) + 200 (Faculty) Open the config.php from ~/moodle/config.php include these lines $CFG->wwwroot = 'http://'.$server_id.'/vitcc'; $CFG->dataroot  = 'C:\\wamp\\moodledata'; before the following line $CFG->directorypermissions = 07xx; Restart the WAMP Server and you can Check MOODLE Site both in Internet and Intranet. The above Image tells the intranet Link and the internet link can be opened outside the campus network

Electrical Machine Design (equations)

Factors DC Machine Transformers Induction Machines Synchronous Machines Output Equation P a =C o D 2 Ln, where Pa=P/h for generators, Pa=P for motors For Single Phase Q=2.22 f B m A i K w A w d 10 -3 For Three Phase Q=3.33 f B m A i K w A w d 10 -3 Q=C o D 2 L n s KVA Input Q= HP * 0.746 / Cos f * h Q=C o D 2 L n s KVA Input Q= HP * 0.746 / Cos f * h For Turbo alternators Q=1.11B av ac K ws V a 2 L 10 -3 /n s Output Coefficient C o =B av ac* 10 -3 where Bav-magnetic loading and ac - electric loading DNA C o =11 K ws B av ac 10 -3 C o =11 K ws B av ac 10 -3 Choice of Magnetic Loading Flux Density in Teeth Frequency of Flux Reversals Size of machine DNA Magnetizing current, Flux Density, Iron loss Iron loss, Stability, Voltage Rating, Parallel Operation, Transient ShortCircuit current