How to Run Ns2 Program in Ubuntu

Our research professionals have provided this article “how to run Ns2 program in Ubuntu” to get to know about the process of running Ns2 based program mainly in Ubuntu.

Ns2 Program in Ubuntu

Initially, we have highlighted the sample Ns2 program code for your reference in the following.

  • Specification of network configuration

set val(chan)               Channel/WirelessChannel

set val(prop)               Propagation/TwoRayGround

set val(ant)      Antenna/OmniAntenna

set val(ifq)      Queue/DropTail/PriQueue

set val(ifqlen)             50

set val(netif)  Phy/WirelessPhy

  • Node configuration

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

            set node_($i) [$ns node]    


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

            $node_($i) color black

            $ns at 0.000000001 “$node_($i) color odourless”

            $ns at 0.000000001 “$node_($i) add-mark m10 pink hexagon”


Run Ns2 Program in Ubuntu

To run the Ns2 program in Ubuntu, we have to change the project location and implement the main file through executing the following commands.

cd /home/research/Desktop/ns2_simulation

./ns Main.tcl

Run Ns2 Program in Ubuntu

As the final note, we have highlighted the result that is acquired through running Ns2 program in Ubuntu.

Result of Running Ns2 Program in Ubuntu

If you have any complications while executing by your own then make a call to us at any time and we are providing 24/7 research support.