0
Simulasi pertama dengan NS2
Posted by Alfian Abdul Ghaffar
on
10.33
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 ^_^
Posting Komentar