Remote Networking and Systems CSE 590 ns2 instructional exercise
Slide 2ns2-Network Simulator One of the most well known test system among systems administration analysts. Discrete occasion, Packet level test system Events like 'got an ack parcel', 'enqueued an information bundle' Network convention stack written in C++ Tcl ( T ool C ommand L anguage) utilized for indicating situations and occasions. Unix Based. Runs likewise in windows utilizing cygwin Simulates both wired and remote systems.
Slide 3Goal of this instructional exercise Understand how to compose Tcl scripts to recreate basic system topologies and activity designs. Investigate the follow documents and comprehend the execution of the conventions.
Slide 4Overview Wired Creating a straightforward two hub arrange topology Adding activity to the connection UDP movement TCP movement Fault infusion Wireless TCP execution on a direct chain of n hubs
Slide 5#Create a test system protest set ns [new Simulator] Simple two hub wired system n0 n1 Step 1: Step 2: #Open follow documents set f [open out.tr w] $ns follow all $f
Slide 6Simple two hub wired system n0 n1 Step 3: #Create two hubs set n0 [$ns node] set n1 [$ns node] Step 4: #Create a duplex connection between the hubs $ns duplex-interface $n0 $n1 1Mb 10ms DropTail
Slide 7Simple two hub wired system #Create a test system question set ns [new Simulator] #Open follow records set f [open out.tr w] $ns follow all $f #Define a "complete" method proc complete {} { worldwide ns $ns flush-follow leave 0 } #Create two hubs set n0 [$ns node] set n1 [$ns node] #Create a duplex connection between the hubs $ns duplex-interface $n0 $n1 1Mb 10ms DropTail #Call the complete methodology following 5 seconds of reenactment time $ns at 5.0 "finish" #Run the reproduction $ns run
Slide 8Adding activity to the connection n0 n1 udp #Create a UDP specialist and join it to hub n0 set udp0 [new Agent/UDP] $ns append operator $n0 $udp0
Slide 9Adding movement to the connection n0 n1 udp cbr # Create a CBR activity source and join it to udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 set packetSize_ 500 $cbr0 set interval_ 0.005 $cbr0 append specialist $udp0
Slide 10Adding activity to the connection n0 n1 udp invalid cbr #Create a Null specialist (an activity sink) and connect it to hub n1 set null0 [new Agent/Null] $ns append operator $n1 $null0
Slide 11Adding activity to the connection n0 n1 udp invalid cbr #Connect the movement source with the activity sink $ns associate $udp0 $null0 #Schedule occasions for the CBR operator $ns at 0.5 "$cbr0 start" $ns at 4.5 "$cbr0 stop"
Slide 12sender n0 n2 n3 collector switch n1 sender Simulate a basic topology – UDP Traffic #Create a test system question set ns [new Simulator] #Open follow documents set f [open out.tr w] $ns follow all $f #Define a "complete" strategy proc complete {} { global ns $ns flush-follow exit 0 } #Create four hubs set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node]
Slide 13sender n0 n2 n3 beneficiary switch n1 sender Simulate a basic topology – UDP Traffic #Create interfaces between the hubs $ns duplex-connect $n0 $n2 1Mb 10ms DropTail $ns duplex-connect $n1 $n2 1Mb 10ms DropTail $ns duplex-interface $n3 $n2 1Mb 10ms SFQ
Slide 14sender n0 n2 n3 recipient switch n1 sender Simulate a basic topology – UDP Traffic #Create a UDP specialist and connect it to hub n0 set udp0 [new Agent/UDP] $udp0 set class_ 1 $ns connect specialist $n0 $udp0
Slide 15sender n0 n2 n3 recipient switch n1 sender Simulate a basic topology – UDP Traffic # Create a CBR movement source and append it to udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 set packetSize_ 500 $cbr0 set interval_ 0.005 $cbr0 connect operator $udp0
Slide 16sender n0 n2 n3 collector switch n1 sender Simulate a basic topology – UDP Traffic #Create a UDP operator and connect it to hub n1 set udp1 [new Agent/UDP] $udp1 set class_ 2 $ns append specialist $n1 $udp1
Slide 17sender n0 n2 n3 collector switch n1 sender Simulate a basic topology – UDP Traffic # Create a CBR movement source and join it to udp1 set cbr1 [new Application/Traffic/CBR] $cbr1 set packetSize_ 500 $cbr1 set interval_ 0.005 $cbr1 join specialist $udp1
Slide 18sender n0 n2 n3 recipient switch n1 sender Simulate a basic topology – UDP Traffic #Create a Null operator (an activity sink) and append it to hub n3 set null0 [new Agent/Null] $ns connect operator $n3 $null0
Slide 19sender n0 n2 n3 collector switch n1 sender Simulate a basic topology – UDP Traffic #Connect the activity sources with the activity sink $ns interface $udp0 $null0 $ns associate $udp1 $null0
Slide 20Simulate a basic topology – UDP Traffic #Schedule occasions for the CBR operators $ns at 0.5 "$cbr0 start" $ns at 1.0 "$cbr1 start" $ns at 4.0 "$cbr1 stop" $ns at 4.5 "$cbr0 stop" #Call the complete technique following 5 seconds of recreation time $ns at 5.0 "finish" #Run the recreation $ns run
Slide 21Trace Analysis http://nsnam.isi.edu/nsnam/index.php/NS-2_Trace_Formats
Slide 22TCP Traffic sender s1 s2 G r sender collector portal s3 sender 0, 1, 2 are senders 3 is a Gateway 4 beneficiary
Slide 23TCP Traffic #Create a TCP operator and join it to hub s1 set tcp1 [new Agent/TCP/Reno] $ns connect specialist $s1 $tcp1 set window_ 8 $tcp1 set fid_ 1
Slide 24TCP Traffic #Create a TCP specialist and append it to hub s2 set tcp2 [new Agent/TCP/Reno] $ns append operator $s2 $tcp2 set window_ 8 $tcp2 set fid_ 2 #Create a TCP operator and connect it to hub s3 set tcp3 [new Agent/TCP/Reno] $ns append specialist $s3 $tcp3 set window_ 4 $tcp3 set fid_ 3
Slide 25TCP Traffic #Create TCP sink operators and connect them to hub r set sink1 [new Agent/TCPSink] set sink2 [new Agent/TCPSink] set sink3 [new Agent/TCPSink] $ns connect specialist $r $sink1 $ns connect operator $r $sink2 $ns append operator $r $sink3
Slide 26TCP Traffic #Connect the activity sources with the activity sinks $ns associate $tcp1 $sink1 $ns interface $tcp2 $sink2 $ns associate $tcp3 $sink3
Slide 27TCP Traffic #Create FTP applications and append them to specialists set ftp1 [new Application/FTP] $ftp1 join operator $tcp1 set ftp2 [new Application/FTP] $ftp2 join operator $tcp2 set ftp3 [new Application/FTP] $ftp3 connect operator $tcp3
Slide 28TCP Traffic #Define a "complete" methodology proc complete {} { worldwide ns $ns flush-follow leave 0 } $ns at 0.1 "$ftp1 start" $ns at 0.1 "$ftp2 start" $ns at 0.1 "$ftp3 start" $ns at 5.0 "$ftp1 stop" $ns at 5.0 "$ftp2 stop" $ns at 5.0 "$ftp3 stop" $ns at 5.25 "finish" $ns run
Slide 29Complex topology and connection disappointment sender 0 1 6 5 2 4 3 recipient
Slide 30Complex topology and connection disappointment #Create a test system protest set ns [new Simulator] #Tell the test system to utilize dynamic steering $ns rtproto DV #Define a "complete" methodology proc complete {} { worldwide ns $ns flush-follow leave 0 }
Slide 31Complex topology and connection disappointment #Create seven hubs for {set i 0} {$i < 7} {incr i} { set n($i) [$ns node] } #Create connects between the hubs for {set i 0} {$i < 7} {incr i} { $ns duplex-interface $n($i) $n([expr ($i+1)%7]) 1Mb 10ms DropTail }
Slide 32Complex topology and connection disappointment #Create a UDP specialist and append it to hub n(0) # Create a CBR activity source and connect it to udp0 #Create a Null operator (a movement sink) and join it to hub n(3) #Connect the movement source with the activity sink #Schedule occasions for the CBR operator and the system elements $ns at 0.5 "$cbr0 start" $ns rtmodel-at 1.0 down $n(1) $n(2) $ns rtmodel-at 2.0 up $n(1) $n(2) $ns at 4.5 "$cbr0 stop" #Call the complete strategy following 5 seconds of recreation time $ns at 5.0 "finish" #Run the reenactment $ns run
Slide 33Wireless Linear Topology 1 2 3 4 … n Run Wireless TCP for every association independently and look how the TCP clog window changes.
Slide 34Have fun with ns2 !!! More information: http://www.cs.sunysb.edu/~samir/cse590/ns-simulator.htm
SPONSORS
SPONSORS
SPONSORS