0% found this document useful (0 votes)
20 views2 pages

NS2 Simoulator

The document provides instructions for installing and running a basic network simulation using the NS2 simulator. It describes downloading required packages, creating a simple network topology with two nodes and a TCP connection between them, and running a file transfer simulation between the nodes.

Uploaded by

bhagyasri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

NS2 Simoulator

The document provides instructions for installing and running a basic network simulation using the NS2 simulator. It describes downloading required packages, creating a simple network topology with two nodes and a TCP connection between them, and running a file transfer simulation between the nodes.

Uploaded by

bhagyasri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

NS2 Simulator

sudo apt-get install ns2


sudo apt-get install nam
sudo apt-get install xgraph

gedit first.tcl
ns first.tcl

set ns [new Simulator]


set f [open out.tr w]

$ns trace-all $f
set fr [open out.nam w]
$ns namtrace-all $fr

set n0 [$ns node]


set n1 [$ns node]

$ns duplex-link $n0 $n1 2Mb 2ms DropTail

set tcp0 [new Agent/TCP]


set tcp1 [new Agent/TCPSink]

$ns attach-agent $n0 $tcp0


$ns attach-agent $n1 $tcp1
$ns connect $tcp0 $tcp1

set ftp [new Application/FTP]


$ftp attach-agent $tcp0
proc finish {} {
global ns f fr
$ns flush-trace
close $fr
exec nam out.nam &
exit
}

$ns at .1 "$ftp start"


$ns at 2 "$ftp stop"
$ns at 2.1 "finish"
$ns run

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy