1 / 23

Network Simulation

Network Simulation. Sept. 8, 2004. Network Research Methodologies. exploring the real world measurement experiment exploring an abstracted model of the world analysis simulation hybrid approach emulation. Exploring the Real World. Measurement needed for reality check Experiment

lucas
Download Presentation

Network Simulation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Network Simulation Sept. 8, 2004 1

  2. Network Research Methodologies • exploring the real world • measurement • experiment • exploring an abstracted model of the world • analysis • simulation • hybrid approach • emulation

  3. Exploring the Real World • Measurement • needed for reality check • Experiment • dealing with implementation issues • only can be used to explore the existing Internet

  4. Exploring an Abstracted Model of the World • Analysis • providing fundamental understanding of the basics • might be too simplified • Simulation • providing a check on the correctness of the analysis • allowing exploration of complicated scenarios

  5. Network Simulation • Advantages • easy to use • new developed protocols/applications • complicated scenarios • controlled environment • reproducible results • Difficulties • realistic traffic • technical and administrative heterogeneity • rapid growth over time • immense changes over time

  6. ns-2 tutorial for dummy 6

  7. What is ns-2? • A discrete event, packet-level simulator • Targeted at networking research • Supports the simulation of • intserv/diffserv, Multicast, Transport, Applications, Wireless (fixed, mobile, satellite) • REAL variant (1989)DARPA (LBL, Xerox PARC, UCB, and USC/ISI) (1995) • Currently; DARPA; NSF; collaboration with researchers: ACIRI, UCB Daedelus, CMU, Sun Microsystems, NORTEL, Cisco, Me!

  8. Status • ns-2 • 100K lines of C++ • 70K lines of OTcl • 50K+ lines of test suite, examples, docs • Platforms • Most UNIX and UNIX-like systems (FreeBSD, Linux, Sun Solaris) • Window 95/98/NT • (Emulation only for FreeBSD for now)

  9. Resources • http://www.isi.edu/nsnam/ns • Tcl (Tool Command Language) • http://dev.scriptics.com/scripting • OTcl (MIT Object Tcl) • ~otcl/doc/tutorial.html (in distribution) • ns manual • Included in distribution: ~ns/doc • http://www.isi.edu/~salehi/ns_doc.ps.gz

  10. Remember • A simulator model of a real-world system is necessarily a simplification. For example, in simulating TCP • No SYN/FIN • Equal size segments • No variable window advertisement • Bugs: “Users of ns are responsible for verifying for themselves that their simulations are not invalidated by bugs”.

  11. OTcl and C++: The Duality Pure OTcl objects Pure C++ objects C++/OTcl split objects C++ OTcl ns

  12. ns-2 a Simple Example 12

  13. Topology snk0 src0 src1 snk1 src2 snk2 r1 r0 src3 snk3 src4 snk4

  14. set ns [new Simulator] for {set i 0} {$i < 5} {incr i} { set src($i) [$ns node] set snk($i) [$ns node] } set r0 [$ns node] set r1 [$ns node] set f0 [open que_trace.tr w] set f1 [open tcp_trace.tr w] Queue set limit_ 50 for {set i 0} {$i < 5} {incr i} { $ns duplex-link $src($i) $r0 \ 10Mb 5ms DropTail $ns duplex-link $snk($i) $r1 \ 10Mb 5ms DropTail } $ns duplex-link $r0 $r1 1Mb 5ms DropTail $ns trace-queue $r0 $r1 $f0 A tcl Script

  15. for {set i 0} {$i < 5} {incr i} { set tcp($i) [new Agent/TCP/Reno] $tcp($i) set fid_ $i $ns attach-agent $src($i) $tcp($i) set tcp_sink($i) [new Agent/TCPSink] $ns attach-agent $snk($i) $tcp_sink($i) $ns connect $tcp($i) $tcp_sink($i) set ftp($i) [new Application/FTP] $ftp($i) attach-agent $tcp($i) } $tcp(0) trace cwnd_ $tcp(0) attach-trace $f1 for {set i 0} {$i < 5} {incr i} { $ns at [expr $i*0.0234] "$ftp($i) start" $ns at 60 "$ftp($i) stop" } $ns at 60 "finish" proc finish {} { global f0 f1 close $f0 close $f1 exit 0 } $ns run A tcl Script (cont.)

  16. Resulting Queue Trace File + 0.436856 10 11 tcp 1000 ------- 0 0.0 1.0 35 154 d 0.436856 10 11 tcp 1000 ------- 0 0.0 1.0 35 154 - 0.436872 10 11 tcp 1000 ------- 0 0.0 1.0 22 80 + 0.437656 10 11 tcp 1000 ------- 0 0.0 1.0 36 155 r 0.441872 10 11 tcp 1000 ------- 0 0.0 1.0 21 79 + 0.444856 10 11 tcp 1000 ------- 0 0.0 1.0 37 157 d 0.444856 10 11 tcp 1000 ------- 0 0.0 1.0 37 157 - 0.444872 10 11 tcp 1000 ------- 2 4.0 5.0 7 82 + 0.445656 10 11 tcp 1000 ------- 0 0.0 1.0 38 158 r 0.449872 10 11 tcp 1000 ------- 0 0.0 1.0 22 80 + 0.452856 10 11 tcp 1000 ------- 0 0.0 1.0 39 160 d 0.452856 10 11 tcp 1000 ------- 0 0.0 1.0 39 160 - 0.452872 10 11 tcp 1000 ------- 2 4.0 5.0 8 83

  17. Resulting TCP Trace File 5.53501 0 0 1 0 cwnd_ 14.425 5.54301 0 0 1 0 cwnd_ 14.494 5.55101 0 0 1 0 cwnd_ 14.563 5.55901 0 0 1 0 cwnd_ 14.632 5.56701 0 0 1 0 cwnd_ 14.700 5.57501 0 0 1 0 cwnd_ 14.768 5.58301 0 0 1 0 cwnd_ 14.836 5.59101 0 0 1 0 cwnd_ 14.903 5.59901 0 0 1 0 cwnd_ 14.970 5.69501 0 0 1 0 cwnd_ 7.000 6.06301 0 0 1 0 cwnd_ 7.143 6.19901 0 0 1 0 cwnd_ 7.283 6.20701 0 0 1 0 cwnd_ 7.420

  18. Trace File Handle while(fscanf(in,"%c %f %d %d %s %d %s %d %f %f %d %d\n", &c, &ttime, &t1, &t2, stemp1, &t3, stemp2, &fid, &ft1, &ft2, &seqno, &t4) > 0) { if (c == '+') { no_pkt[fid] ++; } else if (c == 'd') { no_drop[fid] ++; } if (fid == 0) { if (c == '+') { flow0[(int)ttime] ++; fprintf(arr, "%f %d\n", ttime, seqno); } else if (c == 'd') fprintf(drop, "%f %d\n", ttime, seqno); } }

  19. Trace File Handle (cont.) printf("Average arrival rate\n"); for(i=0;i<5;i++) printf("flow %d: %f Mbps\n", i, (float)no_pkt[i]*8./60000.); printf("Average drop rate\n"); for(i=0;i<5;i++) printf("flow %d: %f\n", i, (float)no_drop[i]/(float)no_pkt[i]); for(i=0;i<60;i++) fprintf(out, "%d %f\n",i,(float)flow0[i]*8./1000);

  20. Average Sending and Drop Rates Average arrival rate flow 0: 0.216400 Mbps flow 1: 0.190533 Mbps flow 2: 0.208933 Mbps flow 3: 0.205333 Mbps flow 4: 0.184267 Mbps Average drop rate flow 0: 0.015404 flow 1: 0.017495 flow 2: 0.015954 flow 3: 0.016234 flow 4: 0.015919

  21. Sending Rate

  22. Packet Sent and Drop

  23. Congestion Window Trace

More Related