How to Run Nam File in Ns2

Through this article, our research professionals have depicted step by step process to run Nam files in the network simulator 2.

Step: 1 Install Nam File for Ns2 in Ubuntu

As the first process, we have to install the Nam file for Ns2 in Ubuntu through the implementation of the below mentioned commands in the terminal window.

sudo dpkg –install nam_1.15-10_i386.deb

Installation of Ns2 in Ubuntu

Step: 2 Run Nam File in Ns2

Following that, we have to write the below mentioned code in Ns2 main TCL file to run the Nam file in Ns2.

  • Ns2 code for open the NAM trace file

set ns [new Simulator]

set nf [open out.nam w]

$ns namtrace-all $nf

  • Ns2 code for close and execute NAM on the trace file

global ns nf

 $ns flush-trace

 close $nf

 exec nam out.nam &

To run the Nam file in Ns2, we have to change the Ns2 main file location through implementing the below mentioned commands.

sudo ./ns Main_with_nam.tcl

Run Nam File in Ns2

Finally, we have highlighted the result that is acquired through running Nam based Ns2 simulation in Ubuntu.

At last, you guys can just make a call to us to acquire more research assistances.