1 / 46

Network Simulator(NS2) - Mobile Networking

Network Simulator(NS2) - Mobile Networking. 2006. 4. 12 Sungkyunkwan University UTRI 2006710809 이 규 설. Contents. What is NS2? Installing NS2(linux) Study of Fundamental Skill Network Component Mobile Networking. What is NS2?. NS2(Network Simulator version 2)

naiya
Download Presentation

Network Simulator(NS2) - Mobile Networking

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 Simulator(NS2)- Mobile Networking 2006. 4. 12 Sungkyunkwan University UTRI 2006710809 이 규 설

  2. Contents • What is NS2? • Installing NS2(linux) • Study of Fundamental Skill • Network Component • Mobile Networking

  3. What is NS2? • NS2(Network Simulator version 2) • Discrete events , Object oriented simulator • Covers a very large number of application, protocol, network types, network elements and traffic models • TCP/IP protocol family - TCP, UDP, FTP, HTTP • History • 1989 – started as a variant of REAL network simulator • 1995 – developed NS1 through VINT project • 1996 – developed NS2 • Now – supported by CONSER, NSF, SAMAN, DARPA • Additional facilities of NS2 • NAM (Network AniMator) • trace-all • xgraph

  4. What is NS2? • relationship of OTcl and C++ • Ex) bind() function • C++ ‘s member function • TcpAgent::TcpAgent() { • bind(“window_”, &wind_); • } // bind_time(), bind_bool(), bind_bw() • OTcl script • $tcp set window_ 200

  5. What is NS2? • ns-allinone-2.28 package’s directory structure

  6. What is NS2? • NS2 objects

  7. What is NS2? • List of C++ Object($NS/ns-2.27/Makefile)

  8. What is NS2?

  9. What is NS2? • relationship of OTcl and C++ Principal of NS2 simulator

  10. What is NS2? • 1 minute TCL tutorial # Assigning a value is done through the ‘set’ command set a 1 set b [expr $a + 2] # define the procedure proc list_total {list} { set tmp 0 # foreach loopVar valueList {commandBody} foreach l $list { incr tmp $l } return $tmp } set c [list_total {1 2 3 4 5}] puts "a: $a b: $b c: $c“  result is “a:1 b:3 c:15”

  11. What is NS2? • 1 minute oTCL tutorial Class car car instproc init {args} { $self instvar wheels_ # self : A pointer to object itself set wheels_ 4 } Class vw -superclass car vw instproc init {args} { $self instvar wheels_ vendor_ set vendor_ "vw" eval $self next $args } set a [new car] puts "A: a car with [$a set wheels_] wheels" set b [new vw] puts "B: a [$b set vendor_] with [$b set wheels_] wheels"

  12. Installing NS2(linux) • Download site • http://www.isi.edu/nsnam/ns/ns-build.html(NS2 공식 홈페이지) • Manual • http://www.isi.edu/nsnam/ns/doc/index.html • Tutorial • http://www.isi.edu/nsnam/ns/tutorial/index.html • http://osiris.sunderland.ac.uk/~ca2stu/netsim/ • NS by Example • http://csl.changwon.ac.kr/ref_doc/ns2/examples/index.html • Member function of objects • http://www-sop.inria.fr/planete/software/ns-doc/ns-current/HIER.html

  13. Installing NS2(linux)

  14. Installing NS2(linux)

  15. Installing NS2(linux)

  16. Installing NS2(linux)

  17. Study of Fundamental Skill • Construction of the topology • determining the position of nodes and links • Writing out a scenario • Selection of protocols (traffic agents, application services) • Setup a additional variables • simulation time , etc …

  18. Study of Fundamental Skill

  19. Study of Fundamental Skill • An NS simulation starts with the command,set ns [new Simulator] • generates an NS simulator object instance, and assigns it to variable ns (italics is used for variables and values in this section). What this line does is the following: • Initialize the packet format (ignore this for now) • Create a scheduler (default is calendar scheduler) • List scheduler, Heap scheduler, Calendar scheduler • Select the default address format (ignore this for now) • The "Simulator" object has member functions that do the following: • Create objects such as nodes and links (described later) • Connect network component objects created (ex. attach-agent) • Set network component parameters (mostly for compound objects) • Create connections between agents • (ex. make connection between a "tcp" and "sink") • Specify NAM display options • Etc.(ns-2.X/tcl/lib/ns-lib.tcl)

  20. Study of Fundamental Skill • In order to have output files with data on the simulation or files used for visualization • we need to create the files using the “open” command • Trace file • This member function tells the simulator to record simulation traces • NAM Trace file • This member function tells the simulator to record simulation traces in NAM input format.

  21. Study of Fundamental Skill • Termination of the program is done a “finish” procedure • At the end of ns program we should call the procedure and specify at what time the termination should occur. • $ns at 125.0 “finish” • The simulation can then begin using “$ns run” • Simple example script…

  22. Study of Fundamental Skill • set ns [new Simulator] : • generates an NS simulator object instance, and assigns it to variable ns (italics is used for variables and values in this section). What this line does is the following: • Initialize the packet format (ignore this for now) • Create a scheduler (default is calendar scheduler) • List scheduler, Heap scheduler, Calendar scheduler • Select the default address format (ignore this for now) • The "Simulator" object has member functions that do the following: • Create objects such as nodes and links (described later) • Connect network component objects created (ex. attach-agent) • Set network component parameters (mostly for compound objects) • Create connections between agents • (ex. make connection between a "tcp" and "sink") • Specify NAM display options • Etc.(ns-2.X/tcl/lib/ns-lib.tcl)

  23. Study of Fundamental Skill • $ns color fid color : • is to set color of the packets for a flow specified by the flow id (fid). • $ns namtrace-all file-descriptor: • This member function tells the simulator to record simulation traces in NAM input format. It also gives the file name that the trace will be written to later by the command • $ns flush-trace : • Similarly, the member function trace-all is for recording the simulation trace in a general format. • proc finish {} : • is called after this simulation is over by the command $ns at 5.0 "finish". In this function, post-simulation processes are specified. • set n0 [$ns node]: • The member function node creates a node. A node in NS is compound object made of address and port classifiers (described in a later section).

  24. Study of Fundamental Skill • $ns duplex-link node1 node2 bandwidth delay queue-type : • creates two simplex links of specified bandwidth and delay, and connects the two specified nodes. • Link source codes "ns-2/tcl/libs/ns-lib.tcl" and "ns-2/tcl/libs/ns-link.tcl“ • We can insert error modules in a link component to simulate a lossy link • $ns queue-limit node1 node2 number : • This line sets the queue limit(size) of the two simplex links that connect node1 and node2 to the number specified. • $ns duplex-link-op node1 node2 ... : • Give node position (for NAM)

  25. Study of Fundamental Skill • set tcp [new Agent/TCP] : • This line shows how to create a TCP agent.(source agent) • Agents and traffic sources are in fact basic objects • “[new Agent/TCPSink]” create a destination agent • $ns attach-agent node agent : • The attach-agent member function attaches an agent object created to a node object. • $ns connect agent1 agent2 : • After two agents that will communicate with each other are created, the next thing is to establish a logical network connection between them.

  26. Study of Fundamental Skill • $ns at time "string“ : • This member function of a Simulator object makes the scheduler to schedule the execution of the specified string at given simulation time.

  27. Study of Fundamental Skill • The DropTail option • If the buffer capacity of the output queue is exceeded then the last packet to arrive is dropped • Many alternative options exist • RED ( Random Early Discard) • FQ (Fair Queueing) • DRR (Deficit Round Robin) • SFQ (Stochastic Fair Queueing) • CBQ (which including a priority and a round-robin scheduler) • TCP is a reliable congestion control protocol • there are a number variants of the TCP protocol, such as Tahoe, Reno, Newreno, Vegas

  28. Study of Fundamental Skill • Excute by • ns filename • NAM is excuted by a command in the otcl file. • exec nam out.nam & • raw2xg • It is command that convert trace file into xgraph form. • raw2xg –a out.tr > out.xg • Xgraph • xgraph out.xg or xgraph out?.xg NAM graphic interface

  29. Study of Fundamental Skill Xgraph interface

  30. Study of Fundamental Skill • When tracing into an output ascii file, the trace is organized in 12 fields as follows • The meanings of the fields are : 1. Event : It is given by one of four possible symbols r,+,-,d which correspond respectively to receive (at the output of the link), enqueued, dequeued, and dropped. 2. Time : the time at which the event occurs. 3. From node : the input node of the link at which the event occurs. 4. Tonode : the output node of the link a which the event occurs. 5. Pkttype : gives the packet type.

  31. Study of Fundamental Skill 6. Pktsize : gives the packet size . 7. Flags : some flags 8. Fid : This is flow id of IPv6 that a user can set for each flow at the input OTcl script. 9. Src addr : this is the source address in the form of “ node.port”. 10. dst addr : this is the destination address, given in the same form . 11. Seq num : This is the network layer protocol’s packet sequence #. 12. Pkt id : This is the unique id of the packet.

  32. Mobile Networking • Contributed from CMU’s Monarch project (Wireless extension to ns-2) • Various modules were added to ns-2 to simulate node mobility and wireless networking • Mobile Node • Ad-hoc Routing(DSR, DSDV, TORA, AODV) • MAC802.11 • Radio Propagation Model • Channel

  33. Mobile Networking • Agent • Responsible for packet generations and receptions • Can think of it as an Application layer • CBR(Constant Bit Rate), TCP, Sink, FTP, etc. • RTagent(DSDV, TORA, AODV) or DSR • Ad-hoc network routing protocols • Configure multi hop routes for packets • LL (Link Layer) • Runs data link protocols • Fragmentation and reassembly of packet • Runs Address Resolution Protocol(ARP) to resolve IP address to MAC address conversions

  34. Mobile Networking • IFq (Interface Queue) • PriQueue is implemented to give priority to routing protocol packets • Supports filter to remove packets destined to specific address • Mac Layer • IEEE 802.11 protocol is implemented • Uses RTS/CTS/DATA/ACK pattern for all unicast pkts and DATA for broadcast pkts

  35. Mobile Networking • NetIF (Network Interfaces) • Hardware interface used by mobilenode to access the channel • Simulates signal integrity, collision, tx error • Mark each transmitted packet with transmission power, wavelength etc. • Radio Propagation Model • Uses Friss-space attenuation(1/r2) at near distance and Two ray ground (1/r4) at far distance • Decides whether the packet can be received by the mobilenode with given distance, transmit power and wavelength • Implements Omni Directional Antenna module which has unity gain for all direction

  36. Mobile Networking • MobileNode 개념도

  37. Mobile Networking • SRNode 개념도

  38. Mobile Networking • Mobile node configuration $ns_ node-config -addressingType <usually flat or hierarchical used for wireless topologies> -adhocRouting <adhoc routing protocol like DSDV, DSR, TORA, AODV etc> -llType <LinkLayer> -macType <MAC type like Mac/802_11> -propType <Propagation model like Propagation/TwoRayGround> -ifqType <Interface Queue type like Queue/DropTail/PriQueue> -ifqLen <Interface Queue length like 50> -phyType <network interface type like phy/WirelessPhy> -antType <Ant type like antenna/OmniAntenna> -channelType <Channel type like Channel/WirelessChannel> -topoInstance <the topography instance> -wiredRouting <turning wired routing ON or OFF>

  39. Mobile Networking -mobileIP <setting the flag for mobileIP ON or OFF> -energyModel <EnergyModel type> -initialEnergy <specified in Joules> -rxPower <specified in W> -txPower <specified in W> -agentTrace <tracing at agent level turned ON or OFF> -routerTrace <tracing at router level turned ON or OFF> -macTrace <tracing at mac level turned ON or OFF> -movementTrace <mobilenode movement logging turned ON or OFF>

  40. Mobile Networking • Options for node configuration

  41. Mobile Networking

  42. Mobile Networking

  43. Mobile Networking

  44. Mobile Networking • Mobile network simulation

  45. Mobile Networking • Sensor network simulation

  46. 청취해 주셔서 감사합니다…

More Related