NS2-TCP Internet Computing KUT (http://icl.kut.ac.kr)http://icl.kut.ac.kr Youn-Hee Han It is licensed under a Creative Commons Attribution.

Slides:



Advertisements
Similar presentations
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Advertisements

You have been given a mission and a code. Use the code to complete the mission and you will save the world from obliteration…
Chapter 1 The Study of Body Function Image PowerPoint
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Addition Facts
Year 6 mental test 5 second questions
Around the World AdditionSubtraction MultiplicationDivision AdditionSubtraction MultiplicationDivision.
ABC Technology Project
Vacha Dave, University of Texas at Austin 1 Network Simulator Tutorial Advanced Computer Networks (CS378)
Network Simulator and problems in installing. Introduction Problems in installing Wired networks modified example2.tcl commands in OTcl usual problems.
1 Undirected Breadth First Search F A BCG DE H 2 F A BCG DE H Queue: A get Undiscovered Fringe Finished Active 0 distance from A visit(A)
VOORBLAD.
1 Breadth First Search s s Undiscovered Discovered Finished Queue: s Top of queue 2 1 Shortest path from s.
1 Chapter Eleven Arrays. 2 A Motivating Example main( ) { int n0, n1, n2, n3, n4; scanf(“%d”, &n0); scanf(“%d”, &n1); scanf(“%d”, &n2); scanf(“%d”, &n3);
Chapter 5 Test Review Sections 5-1 through 5-4.
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
Addition 1’s to 20.
25 seconds left…...
Week 1.
We will resume in: 25 Minutes.
PSSA Preparation.
Chapter 30 Induction and Inductance In this chapter we will study the following topics: -Faraday’s law of induction -Lenz’s rule -Electric field induced.
Introduction to nam Tim Buchheim 21 November 2002 ns tutorial - fall 2002.
Katz, Stoica F04 EECS 122 Introduction to Computer Networks (Fall 2004) Network simulator 2 (ns-2) Department of Electrical Engineering and Computer Sciences.
NS2 Tutorial – Part II Internet Computing KUT Youn-Hee Han.
1 Multicast in ns-2 報告者 : 陳沐恩. 2 Multicast 簡介 3 Multicast Routing set ns [new Simulator] $ns multicast Or set ns [new Simulator – multicast on] set mproto.
NS-2 (network simulator) NS by example παρουσίαση Κων/νος Τρούλος.
Ns Tutorial 成功大學電機所電腦與網路組 博士候選人 柯志亨
New Opportunities for Load Balancing in Network-Wide Intrusion Detection Systems Victor Heorhiadi, Michael K. Reiter, Vyas Sekar UNC Chapel Hill UNC Chapel.
Wireless and Mobile Computing Simulations Lecture 27.
Introduction to Network Simulator NS-2 Part I
1 NS Fundamentals (contd..) Padma Haldar USC/ISI.
An Introduction to NS-2 * Gayatri Swamynathan CS 276 TA *some slides are from a presentation by Haobo Yu & Nader Salehi, USC/ISI.
NS-2 Shahin Shayandeh December 2004 Session 2. Ns programming  Create the event scheduler  Turn on tracing  Create network  Setup routing  Insert.
Brief Intro to ns2: The most widely used Network Simulator COMP5416 Advanced Network Technologies Based on: Marc Greis's
Ns-2 Tutorial Exercise (1) Multimedia Networking Group, The Department of Computer Science, UVA Jianping Wang Adopted from Nicolas’s slides Jianping Wang,
Ns-2 tutorial Karthik Sadasivam Banuprasad Samudrala CSCI 5931 Network Security Instructor : Dr. T. Andrew Yang.
Network Simulator (NS) Prof. Nelson L. S. da Fonseca State University of Campinas, Brazil.
5-Jul-141 S.Pushpalatha, Associate Professor, PSNACET.
Introduction to NS. Information Main website Documentation, mailing list archive, tutorial Location of Source codes –C++ files.
Katz, Stoica F04 EECS 122 Introduction to Computer Networks (Fall 2003) Network simulator 2 (ns-2) Department of Electrical Engineering and Computer Sciences.
Computer Networks NS. Features F Event driven simulator –developed at UC Berkeley F Network Topologies –nodes (connectivity), links (bandwidth, delay)
Submitters: Stella Pantofel Michael Halperin Igor Berman
EECS122 - UCB1 Measurements and Modeling Table of Contents 1. Measurements Measurements 2. Modeling and its Shortcomings Modeling and its Shortcomings.
Wireless Networking and Systems CSE 590 ns2 tutorial.
JIA-HUI HUANG INSTITUTE OF COMPUTER SCIENCE AND INFORMATION ENGINEERING NATIONAL TAIPEI UNIVERSITY OF TECHNOLOGY Network Simulator – NS-2 1.
Network Simulator-2 Sandeep singla 1998A2A7540. NS-2 A discrete event simulator Focused on modeling network protocols –Wired, wireless –TCP,UDP,unicast,multicast.
TNK092: Network Simulation - Nätverkssimulering Lecture 3: TCP Vangelis Angelakis.
NetFlow Very useful for traffic analysis Very useful for traffic analysis Standard sampler: Standard sampler: –Cisco Netflow –Juniper Traffic Sampling.
1 Network Simulator Tutorial. 2 Network Simulation * Motivation: Learn fundamentals of evaluating network performance via simulation Overview: fundamentals.
Internet Computing KUT Youn-Hee Han
1 NS Fundamentals. USC INFORMATION SCIENCES INSTITUTE 2 OTcl and C++: The Duality C++ OTcl Pure C++ objects Pure OTcl objects C++/OTcl split objects ns.
Ns-2 Tutorial (1) Multimedia Networking Group, The Department of Computer Science, UVA Jianping Wang Jianping Wang, 2002 cs757 1.
1 Introduction to NS-2 r Tutorial overview of NS m Create basic NS simulation r Walk-through a simple example m Model specification m Execution and trace.
NS2-TCP Internet Computing KUT ( Youn-Hee Han It is licensed under a Creative Commons Attribution.
Network Simulator Tutorial Wireless Networks. Acknowledgements Material is taken from the presentations by Jim Kurose, University of Massachusetts, Amherst.
Network Simulator 2. Introduction Open source network simulator NS uses two languages: C++ and OTcl  C++ is fast to run but slower to change Kernel 
TNK092: Network Simulation - Nätverkssimulering Lecture #1: Course basics and a first taste of NS2 Vangelis Angelakis Ph.D.
NS-2 Shahin Shayandeh December 2004 Session 1. Ns-2, the Network Simulator  A discrete event simulator Simple model  Focused on modeling network protocols.
DMET 602: Networks and Media Lab Amr El Mougy Yasmeen EssamAlaa Tarek.
DMET 602: Networks and Media Lab
(Modified from Polly Huang’s and last year’s original)
Network Simulator Tutorial
Choe, Hyun Jung (Stella)
Introduction to ns-2: “The” Network Simulator
Karthik Sadasivam Banuprasad Samudrala
Presentation transcript:

NS2-TCP Internet Computing KUT ( Youn-Hee Han It is licensed under a Creative Commons Attribution 2.5 License

Computer Network2 ex1.tcl (section 4.2) set ns [new Simulator] $ns color 1 Blue $ns color 2 Red set tracefile1 [open out.tr w] set winfile [open WinFile w] $ns trace-all $tracefile1 set namfile [open out.nam w] $ns namtrace-all $namfile proc finish {} { global ns tracefile1 namfile $ns flush-trace close $tracefile1 close $namfile exec nam out.nam & exit 0 } set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] set n4 [$ns node] set n5 [$ns node] $ns duplex-link $n0 $n2 2Mb 10ms DropTail $ns duplex-link $n1 $n2 2Mb 10ms DropTail $ns simplex-link $n2 $n3 0.3Mb 100ms DropTail $ns simplex-link $n3 $n2 0.3Mb 100ms DropTail $ns duplex-link $n3 $n4 0.5Mb 40ms DropTail $ns duplex-link $n3 $n5 0.5Mb 30ms DropTail $ns duplex-link-op $n0 $n2 orient right-down $ns duplex-link-op $n1 $n2 orient right-up $ns simplex-link-op $n2 $n3 orient right $ns simplex-link-op $n3 $n2 orient left $ns duplex-link-op $n3 $n4 orient right-up $ns duplex-link-op $n3 $n5 orient right-down $ns queue-limit $n2 $n3 20 $ns simplex-link-op $n2 $n3 queuePos 0.5 set tcp [new Agent/TCP] $ns attach-agent $n0 $tcp set sink [new Agent/TCPSink] $ns attach-agent $n4 $sink $ns connect $tcp $sink $tcp set fid_ 1 $tcp set packetSize_ 552 set ftp [new Application/FTP] $ftp attach-agent $tcp

Computer Network3 set udp [new Agent/UDP] $ns attach-agent $n1 $udp set null [new Agent/Null] $ns attach-agent $n5 $null $ns connect $udp $null $udp set fid_ 2 set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp $cbr set packetSize_ 1000 $cbr set rate_ 0.01Mb $cbr set random_ false $ns at 0.1 "$cbr start" $ns at 1.0 "$ftp start" $ns at "$ftp stop" $ns at "$cbr stop" proc plotWindow {tcpSource file} { global ns set time 0.1 set now [$ns now] set cwnd [$tcpSource set cwnd_] puts $file "$now $cwnd" $ns at [expr $now+$time] "plotWindow $tcpSource $file" } $ns at 0.1 "plotWindow $tcp $winfile" $ns at "finish" $ns run ex1.tcl (section 4.2)

Computer Network4 Sample of “out.tr” from ex1.tcl (section 4.2) tcp tcp r tcp tcp tcp r tcp tcp tcp r tcp tcp tcp r tcp tcp tcp r tcp ack ack r tcp tcp tcp

Computer Network5 Throughput.pl (section 4.2) # type: perl throughput.pl > file $infile=$ARGV[0]; $tonode=$ARGV[1]; $granularity=$ARGV[2]; #we compute how many bytes were transmitted during time interval specified #by granularity parameter in seconds $sum=0; $clock=0; open (DATA, "<$infile") || die "Can't open $infile $!";

Computer Network6 Throughput.pl (section 4.2) while ( ) = split(' '); #column 1 is time if ($x[1]-$clock <= $granularity) { #checking if the event corresponds to a reception if ($x[0] eq 'r') { #checking if the destination corresponds to 1st argument if ($x[3] eq $tonode) { #cheking if the packet type is TCP if ($x[4] eq 'tcp') { $sum = $sum+$x[5]; } } else { $throughput = $sum/$granularity; print STDOUT "$x[1] $throughput\n"; $clock = $clock + $granularity; $sum=0; } $throughput = $sum/$granularity; print STDOUT "$x[1] $throughput\n"; $clock = $clock + $granularity; $sum=0; close DATA; exit(0);

Computer Network7 Execute: perl throughput.pl out.tr 4 1 > thp Execute: gnuplot plot ‘thp’ w lines 1 plot ‘WinFile’ w lines 1 1 st tracing and analysis (section 4.2)

Computer Network8 rdrop.tcl (section 4.3) set ns [new Simulator] $ns color 1 Blue $ns color 2 Red set tf [open out.tr w] set windowVsTime2 [open WindowVsTimeNReno w] $ns trace-all $tf set nf [open out.nam w] $ns namtrace-all $nf proc finish {} { global ns nf tf $ns flush-trace close $nf close $tf exec nam out.nam & exit 0 } #Create six nodex set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] $ns at 0.1 "$n1 label \"CBR\"" $ns at 1.0 "$n0 label \"FTP\""

Computer Network9 $ns duplex-link $n0 $n2 2Mb 10ms DropTail $ns duplex-link $n1 $n2 2Mb 10ms DropTail $ns simplex-link $n2 $n3 0.07Mb 20ms DropTail $ns simplex-link $n3 $n2 0.07Mb 20ms DropTail $ns duplex-link-op $n0 $n2 orient right-down $ns duplex-link-op $n1 $n2 orient right-up $ns simplex-link-op $n2 $n3 orient right $ns simplex-link-op $n3 $n2 orient left $ns queue-limit $n2 $n3 10 $ns simplex-link-op $n2 $n3 queuePos 0.5 set loss_module [new ErrorModel] $loss_module set rate_ 0.2 $loss_module ranvar [new RandomVariable/Uniform] $loss_module drop-target [new Agent/Null] $ns lossmodel $loss_module $n2 $n3 set tcp [new Agent/TCP/Newreno] $ns attach-agent $n0 $tcp set sink [new Agent/TCPSink/DelAck] $ns attach-agent $n3 $sink $ns connect $tcp $sink $tcp set fid_ 1 $tcp set packetSize_ 552 set ftp [new Application/FTP] $ftp attach-agent $tcp $ftp set type_ FTP rdrop.tcl (section 4.3)

Computer Network10 rdrop.tcl (section 4.3) set udp [new Agent/UDP] $ns attach-agent $n1 $udp set null [new Agent/Null] $ns attach-agent $n3 $null $ns connect $udp $null $udp set fid_ 2 set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp $cbr set type_ CBR $cbr set packetSize_ 1000 $cbr set rate_ 0.01Mb $cbr set random_ false $ns at 0.1 "$cbr start" $ns at 1.0 "$ftp start" $ns at "$ftp stop" $ns at "$cbr stop"

Computer Network11 rdrop.tcl (section 4.3) proc plotWindow {tcpSource file} { global ns set time 0.01 set now [$ns now] set cwnd [$tcpSource set cwnd_] puts $file "$now $cwnd" $ns at [expr $now+$time] "plotWindow $tcpSource $file" } $ns at 1.1 "plotWindow $tcp $windowVsTime2“ set qmon [$ns monitor-queue $n2 $n3 [open qm.out w] 0.1] [$ns link $n2 $n3] queue-sample-timeout $ns at "$ns detach-agent $n0 $tcp; $ns detach-agent $n3 $sink" $ns at "finish" $ns run

Computer Network12 Execute: gnuplot plot ‘thp’ w lines 1 plot ‘WindowVsTimeNReno’ w lines 1 2 nd tracing and analysis (section 4.3)

Computer Network13 ex3.tcl (section 4.4) set ns [new Simulator] set tf [open out.tr w] set windowVsTime [open win w] set param [open parameters w] $ns trace-all $tf set nf [open out.nam w] $ns namtrace-all $nf proc finish {} { global ns nf tf $ns flush-trace close $nf close $tf exec nam out.nam & exit 0 } #Create bottleneck and dest nodes and link between them set n2 [$ns node] set n3 [$ns node] $ns duplex-link $n2 $n3 0.7Mb 20ms DropTail set NumbSrc 5 set Duration 10

Computer Network14 #Source nodes for {set j 1} {$j<=$NumbSrc} {incr j} { set S($j) [$ns node] } #Create a random generator for starting the ftp and for bottleneck link delays set rng [new RNG] $rng seed 0 #parameters for random variables for link delays set RVdly [new RandomVariable/Uniform] $RVdly set min_ 1 $RVdly set max_ 5 $RVdly use-rng $rng #parameters for random variables for beginning of ftp connections set RVstart [new RandomVariable/Uniform] $RVstart set min_ 0 $RVstart set max_ 7 $RVstart use-rng $rng #We define two random parameters for each connection for {set i 1} {$i<=$NumbSrc} {incr i} { set startT($i) [expr [$RVstart value]] set dly($i) [expr [$RVdly value]] puts $param "dly($i) $dly($i) ms" puts $param "startT($i) $startT($i) sec." } ex3.tcl (section 4.4) dly(1) ms startT(1) sec. dly(2) ms startT(2) sec. dly(3) ms startT(3) sec. dly(4) ms startT(4) sec. dly(5) ms startT(5) sec

Computer Network15 #Links between source and bottlenexk for {set j 1} {$j<=$NumbSrc} {incr j} { $ns duplex-link $S($j) $n2 10Mb $dly($j)ms DropTail $ns queue-limit $S($j) $n2 100 } #Monitor the queue for link (n2-n3). (for NAM) $ns duplex-link-op $n2 $n3 queuePos 0.5 #Set Queue Size of link (n2-n3) to 10 $ns queue-limit $n2 $n3 10 #TCP Sources for {set j 1} {$j<=$NumbSrc} {incr j} { set tcp_src($j) [new Agent/TCP/Reno] } #TCP Destinations for {set j 1} {$j<=$NumbSrc} {incr j} { set tcp_snk($j) [new Agent/TCPSink] } #Connections for {set j 1} {$j<=$NumbSrc} {incr j} { $ns attach-agent $S($j) $tcp_src($j) $ns attach-agent $n3 $tcp_snk($j) $ns connect $tcp_src($j) $tcp_snk($j) } ex3.tcl (section 4.4) dly(1) ms startT(1) sec. dly(2) ms startT(2) sec. dly(3) ms startT(3) sec. dly(4) ms startT(4) sec. dly(5) ms startT(5) sec

Computer Network16 #FTP sources for {set j 1} {$j<=$NumbSrc} {incr j} { set ftp($j) [$tcp_src($j) attach-source FTP] $tcp_src($j) set packetSize_ 552 } #Schecule events for the FTP agents: for {set i 1} {$i<=$NumbSrc} {incr i} { $ns at $startT($i) "$ftp($i) start" $ns at $Duration "$ftp($i) stop" } #Procedure for plotting window size. #Gets as arguments the name of the tcp source (called "tcpSource") #and of output file. proc plotWindow {tcpSource file k} { global ns set time 0.03 set now [$ns now] set cwnd [$tcpSource set cwnd_] puts $file "$now $cwnd node $k" $ns at [expr $now+$time] "plotWindow $tcpSource $file $k" } for {set j 1} {$j<=$NumbSrc} {incr j} { $ns at 0.1 "plotWindow $tcp_src($j) $windowVsTime $j" } $ns at [expr $Duration] "finish" $ns run ex3.tcl (section 4.4)

Computer Network17 See win: Edit two.awk Execute: grep “node 1” win > win1 awk –f two.awk win1 3 nd tracing and analysis (section 4.4) node node node node node node node node node node node node 2... BEGIN {FS=" "} {d1=$1}{d2=$2}{print d1"\t" d2} END {}