Skip to content

Simulasi pertama dengan NS2

13 August 2010
tags: , ,

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 ^_^
7 Comments leave one →
  1. fetty permalink
    20 December 2010 9:55 AM

    mas kebetulan sy tugas akhir pake NS2.. cara ngubah jenis anntenanya pk model sectoral bisa g y?

    • 21 December 2010 7:12 AM

      wah kebetulan saya belum pernah coba simulasi wireless, jadi saya kurang tau….

  2. 10 October 2011 3:31 PM

    pernah coba jalanin di windows xp?

  3. 17 May 2012 1:19 PM

    ns2 bisa diinstal di seven gak mas?

  4. 24 June 2012 3:53 PM

    [help me]
    lagi bingung nyari tugas akhir ne..
    mas , kira2 judul yang co2k untuk Tugas Akhir apa yea..?dalam bidang networking

  5. widia permalink
    30 September 2012 4:17 PM

    Mas..
    coding di simulasinya itu setiap detil nya dikasih pnjelasan dunk, soalnya msih gak paham dg NS 2,

    bisa ajarin saya NS2 gk mas?? ^_^

    mksih

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: