<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.csi.cuny.edu/cunyhpc/index.php?action=history&amp;feed=atom&amp;title=NS2</id>
	<title>NS2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.csi.cuny.edu/cunyhpc/index.php?action=history&amp;feed=atom&amp;title=NS2"/>
	<link rel="alternate" type="text/html" href="https://wiki.csi.cuny.edu/cunyhpc/index.php?title=NS2&amp;action=history"/>
	<updated>2026-05-18T16:45:18Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>https://wiki.csi.cuny.edu/cunyhpc/index.php?title=NS2&amp;diff=94&amp;oldid=prev</id>
		<title>James: Created page with &quot;Running NS2 is a four step process.  Prepare a Tcl script for NS2 like the example (&#039;&#039;&#039;&#039;&#039;ex.tcl&#039;&#039;&#039;&#039;&#039;) shown below. This example has 2 nodes with 1 link and uses UDP agent with the CBR traffic generator.  &lt;pre&gt; set ns [new Simulator] set tr [open trace.out w] $ns trace-all $tr  proc finish {} {         global ns tr         $ns flush-trace         close $tr         exit 0 }  set n0 [$ns node] set n1 [$ns node]  $ns duplex-link $n0 $n1 1Mb 10ms DropTail  set udp0 [new Agent...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.csi.cuny.edu/cunyhpc/index.php?title=NS2&amp;diff=94&amp;oldid=prev"/>
		<updated>2022-10-20T20:13:19Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Running NS2 is a four step process.  Prepare a Tcl script for NS2 like the example (&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;ex.tcl&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;) shown below. This example has 2 nodes with 1 link and uses UDP agent with the CBR traffic generator.  &amp;lt;pre&amp;gt; set ns [new Simulator] set tr [open trace.out w] $ns trace-all $tr  proc finish {} {         global ns tr         $ns flush-trace         close $tr         exit 0 }  set n0 [$ns node] set n1 [$ns node]  $ns duplex-link $n0 $n1 1Mb 10ms DropTail  set udp0 [new Agent...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Running NS2 is a four step process.&lt;br /&gt;
&lt;br /&gt;
Prepare a Tcl script for NS2 like the example (&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;ex.tcl&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;) shown below. This&lt;br /&gt;
example has 2 nodes with 1 link and uses UDP agent with the CBR traffic&lt;br /&gt;
generator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set ns [new Simulator]&lt;br /&gt;
set tr [open trace.out w]&lt;br /&gt;
$ns trace-all $tr&lt;br /&gt;
&lt;br /&gt;
proc finish {} {&lt;br /&gt;
        global ns tr&lt;br /&gt;
        $ns flush-trace&lt;br /&gt;
        close $tr&lt;br /&gt;
        exit 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
set n0 [$ns node]&lt;br /&gt;
set n1 [$ns node]&lt;br /&gt;
&lt;br /&gt;
$ns duplex-link $n0 $n1 1Mb 10ms DropTail&lt;br /&gt;
&lt;br /&gt;
set udp0 [new Agent/UDP]&lt;br /&gt;
$ns attach-agent $n0 $udp0&lt;br /&gt;
set cbr0 [new Application/Traffic/CBR]&lt;br /&gt;
$cbr0 set packetSize_ 500&lt;br /&gt;
$cbr0 set interval_ 0.005&lt;br /&gt;
$cbr0 attach-agent $udp0&lt;br /&gt;
set null0 [new Agent/Null]&lt;br /&gt;
$ns attach-agent $n1 $null0&lt;br /&gt;
$ns connect $udp0 $null0  &lt;br /&gt;
&lt;br /&gt;
$ns at 0.5 &amp;quot;$cbr0 start&amp;quot;&lt;br /&gt;
$ns at 4.5 &amp;quot;$cbr0 stop&amp;quot;&lt;br /&gt;
$ns at 5.0 &amp;quot;finish&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$ns run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a SLURM batch submit script like the one shown here: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --partition production&lt;br /&gt;
#SBATCH --job-name NS2-job&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --ntasks=1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# You must explictly change to your working&lt;br /&gt;
# directory in SLURM&lt;br /&gt;
&lt;br /&gt;
cd $HOME/my_NS2_wrk&lt;br /&gt;
&lt;br /&gt;
/share/apps/ns2/ns-allinone-2.31/ns-2.31/ns ./ex.tcl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Submit the job with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
qsub submit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Graph the result.  At the HPC Center, &amp;#039;nam&amp;#039; files can be produced, but cannot be run&lt;br /&gt;
because they require a graphical environment for execution.  Trace Graph is a free&lt;br /&gt;
network trace file analyzer developed for NS2 trace processing. Trace Graph can&lt;br /&gt;
support any trace format if converted to its own or NS2 trace format.  Supported NS2&lt;br /&gt;
trace file formats include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wired,satellite,wireless,new trace,wired-wireless. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more information on Trace Graph look here [http://www.tracegraph.com].&lt;br /&gt;
&lt;br /&gt;
Users graphing results in Trace Graph must use Linux with X window system and allow X11 forwarding.&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
</feed>