Network Simulator(NS2) - Mobile Networking - PowerPoint PPT Presentation

1 / 46
About This Presentation
Title:

Network Simulator(NS2) - Mobile Networking

Description:

Title: Author: Dynamic protocol Last modified by: Created Date: 1/19/2005 8:51:55 AM Document presentation format – PowerPoint PPT presentation

Number of Views:267
Avg rating:3.0/5.0
Slides: 47
Provided by: Dynamicp
Category:

less

Transcript and Presenter's Notes

Title: Network Simulator(NS2) - Mobile Networking


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
  • TcpAgentTcpAgent()
  • bind(window_, wind_)
  • // bind_time(), bind_bool(), bind_bw()
  • OTcl script
  • tcp set window_ 200

5
What is NS2?
  • ns-allinone-2.28 packages 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 a1 b3
    c15

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/ind
    ex.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 gt 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. To node the output node of the link a which
    the event occurs.
  • 5. Pkt type gives the packet type.

31
Study of Fundamental Skill
  • 6. Pkt size 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
    protocols packet sequence .
  • 12. Pkt id This is the unique id of the packet.

32
Mobile Networking
  • Contributed from CMUs 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 ltusually
    flat or hierarchical used for


  • wireless topologiesgt
  • -adhocRouting ltadhoc routing protocol like
    DSDV, DSR,
  • TORA, AODV etcgt
  • -llType ltLinkLayergt
  • -macType ltMAC type like Mac/802_11gt
  • -propType ltPropagation model like
    Propagation/TwoRayGroundgt
  • -ifqType ltInterface Queue type like
    Queue/DropTail/PriQueuegt
  • -ifqLen ltInterface Queue length like 50gt
  • -phyType ltnetwork interface type like
    phy/WirelessPhygt
  • -antType ltAnt type like antenna/OmniAntennagt
  • -channelType ltChannel type like
    Channel/WirelessChannelgt
  • -topoInstance ltthe topography instancegt
  • -wiredRouting ltturning wired routing ON or OFFgt

39
Mobile Networking
  • -mobileIP ltsetting the flag for mobileIP ON or
    OFFgt
  • -energyModel ltEnergyModel typegt
  • -initialEnergy ltspecified in Joulesgt
  • -rxPower ltspecified in Wgt
  • -txPower ltspecified in Wgt
  • -agentTrace lttracing at agent level turned ON
    or OFFgt
  • -routerTrace lttracing at router level turned
    ON or OFFgt
  • -macTrace lttracing at mac level turned ON or
    OFFgt
  • -movementTrace ltmobilenode movement logging
    turned ON
  • or OFFgt

40
Mobile Networking
  • Options for node configuration

??(Option) Available Value Default
???? ?? ???? ?? ???? ??
addressingType flat ,hierarchical flat
MPLS ON, OFF OFF
?? ? ?? ?? ???? ?? ?? ? ?? ?? ???? ?? ?? ? ?? ?? ???? ??
wiredRouting ON, OFF OFF
llType LL, LL/Sat NULL
macType Mac/802_11, Mac/Csma/Ca, Mac/Sat, Mac/Sat/UnslottedAloha, Mac/Tdma NULL
ifqType Queue/Drop Tail, Queue/DropTail/PriQueue NULL
phyType Phy/WirelessPhy, Phy/Sat NULL
41
Mobile Networking
????? ???? ?? ????? ???? ?? ????? ???? ??
adhocRouting DIFFUSION/RATE, DIFFUSION/PROB, DSDV, DSR, FLOODING, OMNIMCAST, AODV, TORA NULL
propType Propagation/TwoRayGround, Propagation/Shadowing NULL
propInstance Propagation/TwoRayGround, Propagation/Shadowing NULL
antType Antenna/OmniAntenna NULL
channel Channel/WirelessChannel, Channel/Sat NULL
topoInstance lttopology filegt NULL
mobileIP ON, OFF OFF
energyModel ON, OFF NULL
42
Mobile Networking
????? ???? ?? ????? ???? ?? ????? ???? ??
initialEnergy ltvalue in Joulesgt NULL
rxPower ltvalue in Wgt NULL
txPower ltvalue in Wgt NULL
idlePower ltvalue in Wgt NULL
agentTrace ON, OFF OFF
routerTrace ON, OFF OFF
macTrace ON, OFF OFF
movementTrace ON, OFF OFF
43
Mobile Networking
????? ???? ?? ????? ???? ?? ????? ???? ??
errProc UniformErrorProc NULL
toraDebug ON, OFF OFF
???? ???? ?? ???? ???? ?? ???? ???? ??
satNodeType ploar, geo, terminal, geo-repeater NULL
downlinkBW ltbandwidth value, e.g. "2Mb" NULL
44
Mobile Networking
  • Mobile network simulation

45
Mobile Networking
  • Sensor network simulation

46
  • ??? ??? ?????
Write a Comment
User Comments (0)
About PowerShow.com