Presentation is loading. Please wait.

Presentation is loading. Please wait.

Choe, Hyun Jung (Stella)

Similar presentations


Presentation on theme: "Choe, Hyun Jung (Stella)"— Presentation transcript:

1 Choe, Hyun Jung (Stella)
UTA CSE 4346/5346 Networks II NS-2 Tutorial - Part 2 - Choe, Hyun Jung (Stella) Spring 2008 Networks II Department of Computer Science and Engineering The University of Texas at Arlington CReWMaN

2 GTA Office Hours Monday and Thursday 2:30 PM ~ 3:30 PM NH 239
UTA CSE 4346/5346 Networks II GTA Office Hours Monday and Thursday 2:30 PM ~ 3:30 PM NH 239 CReWMaN

3 Outline Simulation Examples Project Q & A Analysis example: awk
UTA CSE 4346/5346 Networks II Outline Simulation Examples Visualization: nam, xgraph Analysis example: awk Project Overview Submission Guideline Q & A Today, I will show you some ns2 simulation examples and discuss class project. CReWMaN

4 UTA Simulation Examples CReWMaN

5 simple.tcl #Create a simulator object set ns [new Simulator]
UTA CSE 4346/5346 Networks II simple.tcl #Create a simulator object set ns [new Simulator] #Open the NAM trace file set nf [open out.nam w] $ns namtrace-all $nf # Open trace file set tf [open out.tr w] $ns trace-all $tf CReWMaN

6 #Define a 'finish' procedure proc finish {} { global ns nf
UTA CSE 4346/5346 Networks II #Define a 'finish' procedure proc finish {} { global ns nf $ns flush-trace #Close the trace file close $nf exit 0 } CReWMaN

7 #Create links between the nodes
UTA CSE 4346/5346 Networks II #Create four nodes set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] #Create links between the nodes $ns duplex-link $n0 $n2 2Mb 10ms DropTail $ns duplex-link $n1 $n2 2Mb 10ms DropTail $ns duplex-link $n2 $n3 1.7Mb 20ms DropTail CReWMaN

8 #Setup a TCP connection set tcp [new Agent/TCP]
UTA CSE 4346/5346 Networks II #Setup a TCP connection set tcp [new Agent/TCP] $ns attach-agent $n0 $tcp set sink [new Agent/TCPSink] $ns attach-agent $n3 $sink $ns connect $tcp $sink $tcp set fid_ 1 #Setup a FTP over TCP connection set ftp [new Application/FTP] $ftp attach-agent $tcp $ftp set type_ FTP CReWMaN

9 #Setup a UDP connection set udp [new Agent/UDP]
UTA CSE 4346/5346 Networks II #Setup a UDP connection 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 #Setup a CBR over UDP connection set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp $cbr set type_ CBR $cbr set packet_size_ 1000 $cbr set rate_ 1mb CReWMaN

10 #Schedule events for the CBR and FTP agents $ns at 0.1 "$cbr start"
UTA CSE 4346/5346 Networks II #Schedule events for the CBR and FTP agents $ns at 0.1 "$cbr start" $ns at 1.0 "$ftp start" $ns at 4.0 "$ftp stop" $ns at 4.5 "$cbr stop" #Detach tcp and sink agents (not really necessary) $ns at 4.5 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n3 $sink" #Call the finish procedure after 5 seconds of simulation time $ns at 5.0 "finish" (Manual - 18p.) NS simulator is based on two languages: c++ and Otcl (Tool Command Language) There are two class hierarchies: the compiled c++ hierarchy and and the interpreted Otcl one, with one to one correspondence between them. The compiled c++ hierarchy allows us to achieve efficiency in the simulation and faster execution times reducing event processing time. This is particularly useful for the detailed definition and operation of protocols. TCL is easy to use with a very simple syntaxes and it allows a very easy integration with other languages. We can defined a particular network topology, the specific protocols and applications that we wish to simulate in the Otcl script. The behavior is already defined in the compiled hierarchy. Also we can define the form of the output that we wish to obtain from the simulation. We will discuss how to program using Tcl later. CReWMaN

11 #Print CBR packet size and interval
UTA CSE 4346/5346 Networks II #Print CBR packet size and interval puts "CBR packet size = [$cbr set packet_size_]" puts "CBR interval = [$cbr set interval_]" #Run the simulation $ns run CReWMaN

12 TCP: Default Parameters
UTA CSE 4346/5346 Networks II TCP: Default Parameters # max bound on window size Agent/TCP set window_ 100 # congestion windows Agent/TCP set cwnd_ 10 # initial/reset value of cwnd Agent/TCP set windowInit_ 1 # MSS size Agent/TCP set packetSize_ 1500 CReWMaN

13 NAM #Define a 'finish' procedure proc finish {} { global ns nf
UTA CSE 4346/5346 Networks II NAM #Define a 'finish' procedure proc finish {} { global ns nf $ns flush-trace #Close the trace file close $nf #Execute NAM on the trace file exec nam out.nam & exit 0 } CReWMaN

14 awk Set awkCodeTr { if ( NF == 12 ) { event =$1 time = $2
UTA CSE 4346/5346 Networks II awk Set awkCodeTr { if ( NF == 12 ) { event =$1 time = $2 if (event = “d”) { dropCount += 1; print time, dropCount >> “drop.a”; } CReWMaN

15 UTA CSE 4346/5346 Networks II XGRAPH exec xgraph -bb -tk -x time -y lossRatio -bg White -geometry 540x405 /tmp/team3/fs.xg & CReWMaN

16 Using Variables set testTime 60.0 …… $ns at $testTime “$cbr0 stop”
UTA CSE 4346/5346 Networks II Using Variables set testTime 60.0 …… $ns at $testTime “$cbr0 stop” $ns at $testTime “$cbr1 stop” $ns at $testTime “tcp stop” $ns at [expr $testTime + 1.0] “finish” CReWMaN

17 UTA CSE 4346/5346 Networks II DiffServ To provide QoS by dividing traffic into different categories, scheduling packets accordingly Major components Policy Edge router Core router Implementation virtual queues, causing packets from one virtual queue to be dropped more frequently than packets from another. CReWMaN

18 DiffServ Configuration
UTA CSE 4346/5346 Networks II DiffServ Configuration $dsredq set numQueues_ 1 $dsredq setNumPrec 2 $dsredq configQ $dsredq setSchedularMode WRR $ns simplex-link $edge $core 10Mb 5ms dsRED/edge $ns simplex-link $core $edge 10Mb 5ms dsRED/core CReWMaN

19 # Set DS RED parameters from Edge to Core:
UTA CSE 4346/5346 Networks II # Set DS RED parameters from Edge to Core: set qEC [[$ns link $edge $core] queue] $qEC meanPktSize $packetSize $qEC set numQueues_ 1 $qEC setNumPrec 2 $qEC addPolicyEntry [$s1 id] [$dest id] TokenBucket 10 $cir0 $cbs0 $qEC addPolicyEntry [$s2 id] [$dest id] TokenBucket 10 $cir1 $cbs1 $qEC addPolicerEntry TokenBucket 10 11 $qEC addPHBEntry $qEC addPHBEntry $qEC configQ $qEC configQ CReWMaN

20 # Set DS RED parameters from Core to Edge:
UTA CSE 4346/5346 Networks II # Set DS RED parameters from Core to Edge: set qCE [[$ns link $core $e1] queue] $qCE meanPktSize $packetSize $qCE set numQueues_ 1 $qCE setNumPrec 2 $qCE addPHBEntry $qCE addPHBEntry $qCE configQ 93 $qCE configQ CReWMaN

21 UTA Project CReWMaN

22 UTA CSE 4346/5346 Networks II Phase 1 Purpose To be familiar with NS2 To master how to configure network topology Steps Setup system environment Run specified two example files Establish specified network topology Establish traffic flows Submit your file You are free to experiment various parameters if your simulation satisfies requirements, specified topology and traffic flows! CReWMaN

23 Phase 2 Purpose Requirements
UTA CSE 4346/5346 Networks II Phase 2 Purpose To know how to trace/monitor/analyze simulation results To understand different characteristics of TCP and UDP congestion control Requirements Simulate your program with specified parameter values Generate result graphs to verify the performance Compare and analyze the results Make a comprehensive analysis report CReWMaN

24 Topology CSE 4346/5346 Networks II CReWMaN UTA 5 Mbps, 5/10ms
Host 1 Host 2 Host 3 Host 4 Host 5 Host 6 5 Mbps, 5/10ms 2 Mbps, 10ms 1 Mbps, 10ms CReWMaN

25 Phase 3 Purpose Requirement
UTA CSE 4346/5346 Networks II Phase 3 Purpose To help the student master the concepts and practices quality of service (QoS) and traffic management Requirement Use Differentiated Service modules Try to satisfy specified QoS requirements CReWMaN

26 Phase 4 Purpose Requirement
UTA CSE 4346/5346 Networks II Phase 4 Purpose To help the student master the concepts and practices of traffic engineering To compare and analyze the relationship of measured performance metrics Requirement Measure additional QoS metrics Compare the results CReWMaN

27 Submission Format Analysis Report Readme phase#_last name.*
UTA CSE 4346/5346 Networks II Submission Format Analysis Report *.ps or *.pdf Readme *.txt phase#_last name.* phase4_choe.tcl, phase4_choe.ps, phase4_choe.tar.gz CReWMaN

28 Compression mkdir phase1 cp files phae1 tar –cvf project.tar ./phase1
UTA CSE 4346/5346 Networks II Compression mkdir phase1 cp files phae1 tar –cvf project.tar ./phase1 gzip phase1.tar phase1.tar.gz Please DO NOT include trace files! CReWMaN

29 Hard Deadline Hard copy Soft copy
UTA CSE 4346/5346 Networks II Hard Deadline Hard copy to Gergely Záruba prior to the beginning of class on the due date Soft copy to prior to the beginning of class on the due date Late submissions will receive 10% (of the total possible grade) deduction. They will also be amortized 20% (of the total possible grade) each day after the assignment was due. CReWMaN


Download ppt "Choe, Hyun Jung (Stella)"

Similar presentations


Ads by Google