How is Ns2 Implemented

In general, we have provided all the essential details about the significance of implementing network simulator 2.

Step: 1 Installation of Ns2

To install network simulator 2, we have to implement the commands that have been highlighted in the following.

sudo apt-get install ns2

Installation of Ns2

Step: 2 Code for Ns2 Implementation

We have to write the Ns2 source code which is stored along with the file extension of .cc and .h in Ns2.35 and the implement the below mentioned Ns2 code for the proposed routing algorithm.

struct hdr_ip *ih = HDR_IP(p);

struct hdr_LMACA_request *rq = HDR_LMACA_REQUEST(p);

LMACA_rt_entry *rt;

In addition, we have to add the algorithm file name along with the location in Makefile.in file to build the proposed process.

Then, we have to write the Ns2 main simulation script code along with the file extension of .tcl and Ns2 code is used to specify the node mobility locations.

set now [$ns now]

      for {set i 0} {$i< $val(nn)-1 } {incr i} {

            set xx [expr rand()*1000]

            set yy [expr rand()*1000]     

           $ns at $now “$node_($i) setdest $xx $yy $val(Speed)”                    

      }

Step: 3 Run Ns2 Implementation

Then, we have to run the Ns2 implementation through the execution of main tcl file using below mentioned commands.

cd /home/research/Desktop/Ns2_Implementation

sudo ./ns Main.tcl

Running Ns2 Implementation

In addition, the research scholars may face various issues while implementing network simulator 2. Thus, we are providing the complete support for the scholars and you can ping us to aid more!!!