1

Simulasi pertama dengan NS2

Posted by Alfian Abdul Ghaffar on 20.49


Topology yang digunakan adalah sebagai berikut :
Berhubung masih nobitol, jadinya masih script kiddies T_T
--------------------------------------------------------------
#Create a simulator object
set ns [new Simulator]
#Create a trace file
set mytrace [open out.tr w]
$ns trace-all $mytrace

#create a NAM trace file
set myNAM [open out.nam w]
$ns namtrace-all $myNAM
#Define a procedure finish
proc finish {} {
 global ns mytrace myNAM
 $ns flush-trace
 close $mytrace
 close $myNAM
 exec nam out.nam &
exit 0
}
#Create two nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
$n0 color blue
$n0 label "cnc1"
$n1 color red
$n1 label "cnc2"
$n2 color green
$n2 label "cnc3"
#Create a duplex link between the nodes
$ns duplex-link $n0 $n1 100Mb 5ms DropTail
$ns duplex-link $n1 $n2 54Mb 10ms DropTail
#Create a TCP agent
set tcp [new Agent/TCP]
$ns attach-agent $n0 $tcp
set sink [new Agent/TCPSink]
$ns attach-agent $n2 $sink
$ns connect $tcp $sink
$tcp set fid_ 2
#Create an FTP session
set ftp [new Application/FTP]
$ftp attach-agent $tcp
#Schedule events
$ns at 0.05 "$ftp start"
$ns at 60 "$ftp stop"
$ns at 61 "finish"
#start the Simulation
$ns run
--------------------------------------------------------------
Selamat Mencoba ^_^

1 Comments


SALAM...
tumpang tanya...bagaimana mahu menggunakan AWK script...
kalau sudah ada file AWK script..bagaimana mahu run file tersebut didalam terminal..?
dan apa command yg perlu ditype dalam terminal?
boleh tunjukkan cara step-by-step..
terima kasih...
fatinmasturahmj@yahoo.com
malaysia

jika ada facebook boleh saya add??

Posting Komentar

Copyright © 2009 Doa, Usaha dan Secercah Harapan All rights reserved. Theme by Laptop Geek. | Bloggerized by FalconHive.