DOC PREVIEW
CMU CS 15744 - Based on slides from John Heidemann, Polly Huang, and Amit Man

This preview shows page 1-2-3-4-5 out of 15 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

115-744: Computer Networkingns-2 TutorialBased on slides from John Heidemann, Polly Huang, and Amit ManjhiWhat is ns?• Network simulator• a discrete event simulator• focused on modeling network protocols• wired, wireless, satellite• TCP, UDP, multicast, unicast• Web, telnet, ftp• Ad hoc routing; sensor networks• Infrastructure: stats, tracing, error models etc. ns --- what is it good for?• Evaluate performance of existing network protocols.• Prototyping and evaluation of new protocols.• Large-scale simulations not possible in real experiments.Used to:ns• Event-driven simulator• Model world as events• Simulator has list of events• Process: take next one, run it, until done• Each event happens in instant of virtual time, but takes arbitrary real time• Single thread of control• Packet levelHow does it work:2Ns models• Traffic/applications• CBR, FTP, telnet, web• Routing/Queuing• Drop-tail, FQ, SFQ, RED, DRR• Wired routing, adhoc routing etc• Transport• TCP (variants), UDP, multicast (SRM)ns - software structure• Object oriented (C++, OTcl) – code reuse• Scalability + Extensibility• Control/”data” separation• Split C++/OTcl object• C++ for packet-processing (fast to run)• OTcl for control - (fast to write)• Simulation setup and configurationotcl and C++: The Duality       Your ns-scriptOutline• Overview••Tcl, OTcl basicsTcl, OTcl basics• ns basics• Extending ns• ns internals3Tcl basicsproc fact {x} {set ret 1if {$x > 2} {for {set i 1} {$i <= $x} {incr i} {set ret [expr $i * $ret]}}puts “factorial of $x is $ret”}fact 5  factorial of 5 is 120Tcl basicsproc fact {x} {set ret 1if {$x > 2} {for {set i 1} {$i <= $x} {incr i} {set ret [expr $i * $ret]}}puts “factorial of $x is $ret”}fact 5  factorial of 5 is 120• $ for de-referencing• Spaces - important•{} defines a block • set, puts • proc definition:proc name args bodyBasic otclClass mommom instproc init {age} {$self instvar age_set age_ $age}mom instproc greet {} {$self instvar age_puts “$age_ years old mom: How are you doing?”}set a [new mom 45]$a greet• instead of single class declaration multiple definitions• instproc adds class methods• instvar adds instance variable, and brings them to the local scope• $self : this in Java, C++• all methods virtual (as in Java)Basic otcl - inheritanceClass kid -superclass momkid instproc greet {} {$self instvar age_puts “$age_ years old kid: What’s up, dude?”}set b [new kid 15]$b greet4Outline• Overview• Tcl, OTcl basics••ns basicsns basics• Extending ns• ns internalsBasic structure of ns-scripts• Creating the event scheduler• [Tracing]• Creating network topology• Creating Transport Layer - Agents• Creating Applications - Applications• Events!Creating Event Scheduler• Create scheduler• set ns [new Simulator]• Schedule event• $ns at <time> <event>• <event>: any legitimate ns/tcl commands• Start scheduler• $ns run“Hello World” in nssimple.tclset ns [new Simulator]$ns at 1 “puts \“Hello World!\””$ns at 1.5 “exit”$ns runbovik@gs19% ns simple.tclHello World!bovik@gs19%5Creating Network• Nodes• set n0 [$ns node]• set n1 [$ns node]• Links & Queuing• $ns duplex-link $n0 $n1 <bandwidth> <delay> <queue_type>• Queue type: DropTail, RED, CBQ, FQ, SFQ, DRRRouting + traffic• Unicast• $ns rtproto <type> • <type>: Static, Session, DV• Multicast support also.• Traffic• Simple two layers: transport and application.• Transport: TCP, UDP etc.• Applications: web, ftp, telnet etc. Transport LayerClass AgentAgent/UDP Agent/TCP (=Tahoe)…Other TCP flavorsThe transport layer: UDP• UDP• set udp [new Agent/UDP]• set null [new Agent/NULL]• $ns attach-agent $n0 $udp• $ns attach-agent $n1 $null• $ns connect $udp $null6The transport layer: TCP• TCP• set tcp [new Agent/TCP]• set tcpsink [new Agent/TCPSink]• $ns attach-agent $n0 $tcp• $ns attach-agent $n1 $tcpsink• $ns connect $tcp $tcpsinkTransport LayerClass AgentAgent/UDP Agent/TCP (=Tahoe)…Other TCP flavorsAgent/TCP/FullTCPApplication LayerClass Application{Simulated Applications}(on top of TCP){Traffic generators}(on top of UDP)Creating Traffic: On Top of TCPFTP• set ftp [new Application/FTP]• $ftp attach-agent $tcp• $ns at <time> “$ftp start”Telnet• set telnet [new Application/Telnet]• $telnet attach-agent $tcp7Creating Traffic: On Top of UDP• CBR• set src [new Application/Traffic/CBR]• Exponential or Pareto on-off• set src [new Application/Traffic/Exponential]• set src [new Application/Traffic/Pareto]• Trace driven traffic• Inter-packet time and packet-sizeAttaching a traffic source• set cbr [new Application/Traffic/CBR]• $cbr attach-agent $udp• $ns at <time> “$cbr start”TracingTrace packets on all links:• set f[open out.tr w]• $ns trace-all $f• $ns flush-trace• close $f <event><time><from><to><type><size>--<flags>--<flow id><src><dst><seqno> <pckt id>+ 1 0 2 cbr 210 ------- 0 0.0 3.1 0 0- 1 0 2 cbr 210 ------- 0 0.0 3.1 0 0r 1.00234 0 2 cbr 210 ------- 0 0.0 3.1 0 0          More Tracing• Tracing specific links• $ns trace-queue $n0 $n1 $f• Tracing variables • set cwnd_chan_ [open all.cwnd w]• $tcp trace cwnd_• $tcp attach $cwnd_chan_8Controlling object parameters• Almost all ns objects have parameters• ex. Application/Traffic/Exponential has rate and packetSize• set parameters in OTcl• set etraf [new Application/Traffic/Exponential]• $etraf set rate_ 1Mb• $etraf set packetSize_ 1024Putting it all togetherset ns [new Simulator]set n0 [$ns node]set n1 [$ns node]$ns duplex-link $n0 $n1 1.5Mb 10ms DropTail set tcp [$ns create-connection TCP $n0 TCPSink $n1 0] set ftp [new Application/FTP]$ftp attach-agent $tcp  $ns trace-queue $n0 $n1 $f   $ns at 0.2 "$ftp start“$ns at 1.2 ”exit“$ns runnam – the network animatorn0 n1set nf [open out.nam w]$ns namtrace-all $nfexec nam


View Full Document

CMU CS 15744 - Based on slides from John Heidemann, Polly Huang, and Amit Man

Documents in this Course
Lecture

Lecture

25 pages

Lecture

Lecture

10 pages

Lecture

Lecture

10 pages

Lecture

Lecture

45 pages

Lecture

Lecture

48 pages

Lecture

Lecture

19 pages

Lecture

Lecture

97 pages

Lecture

Lecture

39 pages

Lecture

Lecture

49 pages

Lecture

Lecture

33 pages

Lecture

Lecture

21 pages

Lecture

Lecture

52 pages

Problem

Problem

9 pages

Lecture

Lecture

6 pages

03-BGP

03-BGP

13 pages

Lecture

Lecture

42 pages

lecture

lecture

54 pages

lecture

lecture

21 pages

Lecture

Lecture

18 pages

Lecture

Lecture

18 pages

Lecture

Lecture

58 pages

lecture

lecture

17 pages

lecture

lecture

46 pages

Lecture

Lecture

72 pages

Lecture

Lecture

44 pages

Lecture

Lecture

13 pages

Lecture

Lecture

22 pages

Lecture

Lecture

48 pages

lecture

lecture

73 pages

17-DNS

17-DNS

52 pages

Lecture

Lecture

10 pages

lecture

lecture

53 pages

lecture

lecture

51 pages

Wireless

Wireless

27 pages

lecture

lecture

14 pages

lecture

lecture

18 pages

Lecture

Lecture

16 pages

Lecture

Lecture

14 pages

lecture

lecture

16 pages

Lecture

Lecture

16 pages

Lecture

Lecture

37 pages

Lecture

Lecture

44 pages

Lecture

Lecture

11 pages

Lecture

Lecture

61 pages

Multicast

Multicast

61 pages

Lecture

Lecture

19 pages

Lecture

Lecture

8 pages

Lecture

Lecture

81 pages

Lecture

Lecture

9 pages

Lecture

Lecture

6 pages

Lecture

Lecture

63 pages

Lecture

Lecture

13 pages

Lecture

Lecture

63 pages

Lecture

Lecture

50 pages

lecture

lecture

35 pages

Lecture

Lecture

47 pages

Lecture

Lecture

29 pages

Lecture

Lecture

92 pages

Load more
Download Based on slides from John Heidemann, Polly Huang, and Amit Man
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Based on slides from John Heidemann, Polly Huang, and Amit Man and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Based on slides from John Heidemann, Polly Huang, and Amit Man 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?