DOC PREVIEW
Berkeley ELENG 122 - Simulator ns2

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

Save
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

Unformatted text preview:

EE 122 Computer Networks Network Simulator ns2 Department of Electrical Engineering and Computer Sciences University of California Berkeley Berkeley CA 94720 1776 Adapted from F04 Slides K Fall J Heidemann P Huang K Lai A Parekh I Stoica S Shenker J Walrand Outline Goals Discrete Event Simulation Basic ns 2 Examples 2 1 What is ns 2 Discrete event simulator Models network protocols Wired wireless satellite TCP UDP multicast unicast Web Telnet FTP Ad hoc routing sensor networks Infrastructure stats tracing error models etc Multiple levels of detail in one simulator 3 Why simulate To examine protocol in controlled environment Repeatable experiments Alternatives Experimentation operational details but limited scale limited flexibility Analysis can provide deeper understanding but ignores implementation details 4 2 ns 2 components ns the Network Simulation engine executes tcl scripts containing simulation setup and events nam the Network AniMator visualize ns output tcl script specification of experiment ns 2 trace file output nam 5 Discrete Event Simulation model world as events maintain queue of events ordered by time maintain virtual time repeat extract event at head set virtual time event s time process it if processing generates another event add it to queue each event takes predefined amount of virtual time arbitrary amount of real time having a slow CPU makes simulation run slower in real time but doesn t change result 6 3 Discrete Event Simulation 7 oTcl overview programming language used for setting up simulation environment object oriented interpreted slow Used for Setting up topology Placing agents Injecting events Configuring tracing Examples variables set x 10 puts x is x expressions set y pow x 2 set y expr x x 3 control if x 0 return x else return expr x while x 0 puts x set x eval x 1 8 4 Basic ns 2 1 Create the simulator object set ns new Simulator 2 Set up the network topology set var ns node 3 Define traffic patterns ns link type node1 node2 bandwidth delay queuetype 4 Define agents set var new Agent agent type ns attach agent node variable agent variable ns connect agent variable agent variable 5 Define the trace files and monitors ns namtrace all namtracefile 6 Schedule simulation events ns at time event ftp 7 Run the simulator tcp ns run n0 n1 tcp sink n2 9 Basic ns 2 1 Create the Simulator set ns new Simulator 2 Set Up Network Topology set n0 ns node set n1 ns node set n2 ns node 3 Define Traffic Patterns ns duplex link n0 n1 4Mb 10ms DropTail ns duplex link n2 n1 1Mb 10ms DropTail ns queue limit n1 n2 10 n0 n1 n2 10 5 Basic ns 2 4 Define Agents Create a TCP agent and attach it to node n0 set tcp0 new Agent TCP ns attach agent n0 tcp0 Create a TCP sink agent and attach it to node n2 set sink new Agent TCPSink ns attach agent n2 sink Connect both agents ns connect tcp0 sink create an FTP source set ftp new Application FTP ftp set maxpkts 1000 ftp attach agent tcp0 ftp tcp tcp sink n0 n1 n2 11 Basic ns 2 5 Define Trace Files and Monitors open the nam trace file set nam trace fd open tcp tahoe nam w ns namtrace all nam trace fd define a finish procedure proc finish global ns nam trace fd trace fd close the nam trace file ns flush trace close nam trace fd execute nam on the trace file exit 0 ftp tcp n0 tcp sink n1 n2 12 6 Basic ns 2 6 Schedule Simulation Events ns at 0 0 ftp start ns at 10 0 ftp stop ns at 10 1 finish 7 Run the simulation Run the simulation ns run ftp tcp tcp sink n0 n1 n2 13 Create a simulator object set ns new Simulator Create three nodes set n0 ns node set n1 ns node set n2 ns node Connect both agents ns connect tcp0 sink Example Create link between the nodes ns duplex link n0 n1 4Mb 10ms DropTail ns duplex link n2 n1 1Mb 10ms DropTail ns queue limit n1 n2 10 Create a TCP agent and attach it to node n0 set tcp0 new Agent TCP ns attach agent n0 tcp0 Create a TCP sink agent and attach it to node n2 set sink new Agent TCPSink ns attach agent n2 sink create an FTP source set ftp new Application FTP ftp set maxpkts 1000 ftp attach agent tcp0 Inject starting events ns at 0 0 ftp start ns at 10 0 ftp stop ns at 10 1 finish Run the simulation ns run ftp tcp tcp sink n0 n1 n2 14 7 nam visualization demo Now I show an instance of nam running the example on the previous slide We just saw this tcl script specification of experiment Now I will show you this ns 2 trace file output nam 15 Analysis Other commands for configuring nam not discussed here 16 8 Questions 17 Project 2 Introduction 9 Overview Learning goals Project structure Submission details 19 Goals Investigating the behavior of TCP Effects of different window sizes on TCP dataflow Appreciate the different variants of TCP TCP with non TCP flows Queueing Droptail vs RED 20 10 Project Structure Project is divided into two main tasks Task 1 4 questions 10 points Task 2 8 questions 30 points 21 Task 1 Initial network configuration 2 TCP flows Observe what happens when the window sizes change 22 11 Results Trace file typically has the format time val Nam file format event type t time s src node d dst node p pkt type e pkt size c color i pkt id a flow id x src port dst port seqno null For example event r t 10 s 1 d 2 p tcp How do we access events awk 1 r 7 3 a 11 END print a task1 out nam 23 Task 1 modifications You will need to modify the script to create the following topology A third TCP flow is added 24 12 Task 2 You are given several black box unknown components tcp A sink A tcp B sink B tcp C sink C Queue A Queue B You must figure out what these components implement give reasons 25 Task 2 The black box components DO NOT work with the normal NS2 simulator A new bns executable has been provided Run the executable on solaris Type bns myscript tcl Scripts Scripts that simulate each component are provided Can also write your own scripts using the black box components if result from scripts are not clear 26 13 Task 2 Details TCP We will look at the following variants Tahoe slow start fast retransmit Reno fast recovery SACK selective acknowledgements There are 3 black box tcp s and 3 scripts tcp X tcl To answer the questions you will need to Plot curves with xgraph or gnuplot Answer some questions 27 Details cont Fast TCP Background Version of TCP for large bandwidth delay links Increases the congestion window faster avoids decreasing it unnecessarily Investigate link sharing with regular TCP Reno There are two …


View Full Document

Berkeley ELENG 122 - Simulator ns2

Documents in this Course
Lecture 6

Lecture 6

22 pages

Wireless

Wireless

16 pages

Links

Links

21 pages

Ethernet

Ethernet

10 pages

routing

routing

11 pages

Links

Links

7 pages

Switches

Switches

30 pages

Multicast

Multicast

36 pages

Switches

Switches

18 pages

Security

Security

16 pages

Switches

Switches

18 pages

Lecture 1

Lecture 1

56 pages

OPNET

OPNET

5 pages

Lecture 4

Lecture 4

16 pages

Ethernet

Ethernet

65 pages

Models

Models

30 pages

TCP

TCP

16 pages

Wireless

Wireless

48 pages

Load more
Download Simulator ns2
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 Simulator ns2 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 Simulator ns2 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?