* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Polygraph: Automatically Generating Signatures for
Survey
Document related concepts
Wireless USB wikipedia , lookup
Internet protocol suite wikipedia , lookup
Wake-on-LAN wikipedia , lookup
Deep packet inspection wikipedia , lookup
Distributed operating system wikipedia , lookup
Backpressure routing wikipedia , lookup
Policies promoting wireless broadband in the United States wikipedia , lookup
Airborne Networking wikipedia , lookup
Piggybacking (Internet access) wikipedia , lookup
Wireless security wikipedia , lookup
List of wireless community networks by region wikipedia , lookup
Recursive InterNetwork Architecture (RINA) wikipedia , lookup
IEEE 802.1aq wikipedia , lookup
Transcript
How (not) to Simulate Wireless Networks with ns Brad Karp [email protected] University College London ns Workshop MSR Cambridge 9th December, 2005 Outline • Overview of ns wireless functionality – History – Simple example ns overview material largely borrowed: – MobileNode configuration ns Manual (Chapter 16) – Controlling mobility Padmatraffic Haldar’s tutorial (11/2002) – Defining workloads – MobileNode architecture – Trace file format • Role of simulation in wireless research • Case study of simulation’s pitfalls: GPSR 2 History of ns Wireless Support • David Johnson’s Monarch group at CMU: – – – – – Free-space, two-ray ground reflection channel model 802.11 MAC layer Random waypoint mobility model ARP Ad hoc routing: Dynamic Source Routing (DSR), TORA, … – &c. • Other major supported protocols and links (outside scope of today’s talk): Mobile IP, Directed Diffusion, satellite links, &c. 3 ns Wireless Architecture • MobileNode at core of mobility support • MobileNodes can move in a given topology, receive/transmit signals to/from wireless channels • Wireless network stack consists of LL, ARP, MAC, IFQ, &c. • Allows simulations of multi-hop ad hoc networks, wireless LANs, sensor networks etc 4 Wireless Example: Ad hoc Routing • Scenario – 2 mobile nodes – moving within 500m x 500m flat topology – using DSDV ad hoc routing protocol – Random Waypoint mobility model – TCP traffic • Examples: – ns-2/ns-tutorial/examples/simple-wireless.tcl – ns-2/tcl/ex/wireless-demo-csci694.tcl 5 An Example – Step 1 # Define Global Variables # create simulator set ns [new Simulator] # create flat topology in 670m x 670m area set topo [new Topography] $topo load_flatgrid 500 500 6 An Example – Step 2 # Define wireless ns trace # ns trace set tracefd [open simple.tr w] $ns trace-all $tracefd 7 GOD (General Operations Director) • Stores all-pairs Dijkstra shortest path lengths • Allows comparison of path length with optimal • Automatically generated, contained in scenario file • set god [create-god <no of mnodes>] • $god set-dist <from> <to> <#hops> 8 Example –Step 3 • Create god set god [create-god 2] $ns at 900.00 “$god setdist 1 2 1” • Create wireless channel set thechan [new Channel/WirelessChannel] 9 An Example – Step 4 # Define how a mobile node is configured $ns node-config \ -adhocRouting DSDV \ -llType LL \ -macType Mac/802_11 \ -ifqLen 50 \ -ifqType Queue/DropTail/PriQueue \ -antType Antenna/OmniAntenna \ -propType Propagation/TwoRayGround \ -phyType Phy/WirelessPhy \ -channel $thechan \ -topoInstance $topo -agentTrace ON \ -routerTrace OFF \ -macTrace OFF \ -movementTrace OFF 10 An Example – Step 5 # Use “for” loop to create 3 nodes: for {set i 0} {$i < 2} {incr i} { set node($i) [$ns node] # disable random motion $node($i) random-motion 0 } 11 MobileNode Movement • Node position defined in 3D • Today, z axis not used $node set X_ <x1> $node set Y_ <y1> $node set Z_ <z1> $node at <time> setdest <newx> <newy> <speed> • Lots of these events over a simulation; manual generation tedious… 12 Random Waypoint Model • Place nodes uniformly at random • Node moves to uniformly randomly chosen destination, at velocity chosen uniformly at random • Between move events, node stays put for “pause time” • Meant to mimic user behavior: move, work, move… 13 Scenario Generator: Movement • setdest: MobileNode movement generator setdest -n <num_of_nodes> -p pausetime -M <maxspeed> -t <simtime> -x <maxx> -y <maxy> Source: ns-2/indep-utils/cmu-scengen/setdest/ 14 Example setdest Output $node_(2) set Z_ 0.000000000000 $node_(2) set Y_ 199.373306816804 $node_(2) set X_ 591.256560093833 $node_(1) set Z_ 0.000000000000 $node_(1) set Y_ 345.357731779204 $node_(1) set X_ 257.046298323157 $node_(0) set Z_ 0.000000000000 $node_(0) set Y_ 239.438009831261 $node_(0) set X_ 83.364418416244 $god_ set-dist 0 1 1 $ns_ at 50.000000000000 "$node_(2) setdest 369.463244915743 170.519203111152 3.371785899154" $ns_ at 51.000000000000 "$node_(1) setdest 221.826585497093 80.855495003839 14.909259208114" $ns_ at 33.000000000000 "$node_(0) setdest 89.663708107313 283.494644426442 19.153832288917" 15 Scenario Generator: Traffic • Generating traffic pattern files – CBR/TCP traffic ns cbrgen.tcl [-type cbr|tcp] [-nn nodes] [-seed seed] [-mc connections] [-rate rate (pkt/s)] – CBR traffic ns cbrgen.tcl –type cbr –nn 20 –seed 1 –mc 8 -rate 4 – TCP traffic ns cbrgen.tcl –type tcp -nn 15 -seed 0 –mc 6 Default packet size: 512 bytes, hardwired in script! Start time uniform in [0, 180] s, hardwired in script! • To evaluate routing, which traffic type would you use? • Source: ns-2/indep-utils/cmu-scen-gen/ 16 A Traffic Scenario set udp_(0) [new Agent/UDP] $ns_ attach-agent $node_(0) $udp_(0) set null_(0) [new Agent/Null] $ns_ attach-agent $node_(2) $null_(0) set cbr_(0) [new Application/Traffic/CBR] $cbr_(0) set packetSize_ 512 $cbr_(0) set interval_ 4.0 $cbr_(0) set random_ 1 $cbr_(0) set maxpkts_ 10000 $cbr_(0) attach-agent $udp_(0) $ns_ connect $udp_(0) $null_(0) $ns_ at 127.93667922166023 "$cbr_(0) start" ……. 17 An Example – Step 6 # Define node movement model source <movement-scenario-files> # Define traffic model source <traffic-scenario-files> 18 An Example – Step 7 # Tell ns the simulation stop time $ns at 200.0 “$ns halt” # Start your simulation $ns run 19 Energy Extension • Makes MobileNode energy-aware • Enable by adding options: $ns_ node-config \ –energyModel EnergyModel -initialEnergy 100.0 -txPower 0.6 -rxPower 0.2 20 Outline • Overview of ns wireless functionality – – – – – – – History Simple example MobileNode configuration Controlling mobility Defining traffic workloads MobileNode architecture Trace file format • Role of simulation in wireless research • Case study of simulation’s pitfalls: GPSR 21 Wireless Internals • MobileNode – Basic entity with address and port de-muxes, routing agent, &c. – Stack of network components, including IFQ, LL, MAC, NetIF, radio propagation model, &c. • Wireless channel 22 Portrait of A Mobile Node Node port classifier protocol agent Classifier: Forwarding 255 addr classifier defaulttarget_ LL Agent: Protocol Entity routing agent ARP Node Entry LL IFQ IFQ IFQ: Interface queue MAC MAC: Mac object PHY PHY: Net interface MAC PHY MobileNode CHANNEL Propagation and antenna models LL: Link layer object Prop/ant Radio propagation/ antenna models 23 Mobile Node : Components • Classifiers • defaulttarget_ points to routing agent object • 255 is the port id assigned for rtagent_ • Routing agent • Ad hoc routing protocol, e.g., AODV, DSDV, DSR; or directed diffusion 24 Mobile Node: Components • Link Layer – Same as LAN, but with a separate ARP module – Looks up IP-to-MAC mappings using ARP • ARP – Resolves IP address to hardware (MAC) address – Broadcasts ARP query • Interface queue (IFQ) – Gives priority to routing protocol packets – Has packet filtering (search and remove) capacity 25 Mobile Node: Components • MAC – 802.11 • IEEE RTS/CTS/DATA/ACK for unicast • Sends DATA directly for broadcast • Network interface (PHY) – Used by MobileNode to access channel – Stamps outgoing packets with meta-data – Interface with radio/antenna models 26 Mobile Node: Components • Radio Propagation Model – Friss-space model: attenuation at near distance – Two-ray ground reflection model: attenuation at far distance – Shadowing model: probabilistic • Antenna – Omni-directional, unity-gain 27 Wireless Channel • Duplicate packets to all mobile nodes attached to the channel except the sender • It is the receiver’s responsibility to decide if it will accept the packet – Collision is handled at individual receiver – O(N2) computation! 28 Wireless Trace Support • CMU trace format differs from standard ns trace format! • Configurable tracing: – – – – MAC (very voluminous!) Router forwarding Agent events Movement events • Format described in detail in ns manual • When in doubt, no substitute for reading the code! • Shortest path lengths logged per pkt rx (cost in-core?) • “New” wireless trace format – appears not to be in wide use yet – same information, formatted differently 29 Outline • Overview of ns wireless functionality – – – – – – – History Simple example MobileNode configuration Controlling mobility Defining traffic workloads MobileNode architecture Trace file format • Role of simulation in wireless research • Case study of simulation’s pitfalls: GPSR 30 Simulation as Way to Enable Area • Ad hoc routing: huge system deployment/debugging cost • 1998 Broch et al. paper a watershed for ad hoc routing: first even comparison of wide field of protocols • CMU ns wireless “extensions” the basis of most ad hoc networking research for next 5+ years 31 Simulation as Way to Kill Area • Simulators don’t evaluate motivation! – Why are 500 laptops in a gymnasium not simply connecting to base stations? • The founding of MobiHoc – cf. the founding of SIGMETRICS… • The founding of MobiSys • Secret tip: building a real system dramatically increases chances of acceptance! (because it’s HARD) 32 Things to Investigate Using ns • Coarse notion of capacity • Coarse notion of effect of mobility • Fine-grained behavior of your routing (or other hop-by-hop) protocol – Only place you can easily have “centralized’ view! 33 Things Not to Investigate Using ns Broadcast Packet Delivery Probability • Realistic loss behavior (interference, multipath fading, …) Roofnet measurements [SIGCOMM 2004] Node Pair 34 Not in ns (cont’d) • Realistic topology information – Roofnet finding: RTS/CTS useless in outdoor network! – Hidden terminal problem still mainstay of undergraduate networking courses everywhere… – GPSR free space ns simulation debacle (more later) • Fine-grained mobility behavior – Random Waypoint corresponds little to reality – GPSR density anomaly (more later) 35 When to Roll Your Own Simulator • GPSR greedy-only simulator – properties of node density, not of fine-grained radio propagation – ~250 lines of C, a morning’s work – far faster than ns will ever be • Simple visualization – GPSR topology visualizer • find connected components • show planar subgraphs • animate forwarding 36 Outline • Overview of ns wireless functionality – – – – – – – History Simple example MobileNode configuration Controlling mobility Defining traffic workloads MobileNode architecture Trace file format • Role of simulation in wireless research • Case study of simulation’s pitfalls: GPSR 37 Greedy Perimeter Stateless Routing (GPSR) Central idea: Machines can know their geographic locations. Route using geography. [MobiCom 2000] • Packet destination field: location of destination • Scalability: Nodes all know tiny own state positions, per e.g., router; low routing – by GPS (outdoors) protocol overhead; approximates shortest – by surveyed (forsuccess non-mobilerate nodes) paths; high position delivery – by short-range localization (indoors, [AT&T Camb, 1997], [Priyantha et al., 2000]) – &c. • Two forwarding algorithms: – Greedy mode simply chooses closest neighbor to destination – Perimeter mode recovers when no closer next hop available, by routing on planar subgraph of full network graph 38 Greedy Forwarding • Nodes learn immediate neighbors’ positions from beaconing/piggybacking on data packets • Locally optimal, greedy next hop choice: – Neighbor geographically nearest destination D x y 39 Greedy Forwarding Failure Greedy forwarding not always possible! Consider: D v circumnavigate voids?z How can we …based only on one-hop neighborhood? void y w x 40 Void Traversal: The Right-hand Rule Well-known graph traversal: right-hand rule Requires only neighbors’ positions Doesn’t work when edges in graph cross z one another!y x 41 Planarized Graphs: Example 200 nodes, placed uniformly at random on 2000-by-2000-meter region; 250-meter radio range Full Graph GG Subgraph RNG Subgraph 42 Packet Delivery Success Rate (50, 200; Dense) 43 GPSR: Making it Real • We implemented full GPSR for Berkeley mote sensors [NSDI 2005] – 3750 lines of nesC code – also includes: simple link thresholding, ARQ • Deployed on Mica 2 “dot” mote testbeds – 23-node, 50-node subsets of 100-node network in office building (Soda Hall; office walls; 433 MHz) – 40-node network in office building (Intel Research Berkeley; cubicles; 900 MHz) • Delivery success workload: 50 packets between all node pairs, serially 44 50-Node Testbed, Soda Hall GAME OVER Only 68.2% of node pairs connected!! What’s going on here?! 45 Planar, but Partitioned Absorption, reflection (multi-path), interference, antenna orientation differences, &c., lead to non-uniform radio ranges. RNG and GG partition graphs when radio ranges not uniform! Solution: entirely new protocol, CLDP, for Output of GPSR’s removing crossing edges [NSDIDistributed 2005]. GG Provably correct on all connected graphs. (arrows denote unidirectional links) 46 Key Lessons and Conclusion • Understand your algorithm’s correctness assumptions • Does the simulator model these properties accurately, or at least pessimistically? • Fading, interference, loss rate particular pitfalls • No substitute for building—even moreso than for Internet congestion control, as propagation too complex to model accurately 47 UCL: A Tradition of Great Networking Research in London • Hiring junior and senior networking faculty • Application deadline: 5th January, 2006 • Details at http://www.cs.ucl.ac.uk/ • Why UCL? – Research: sdr, rat, Landmark Routing, NAT, XORP, TFRC, XCP, GPSR, CLDP, GHT, Autograph, Polygraph, … – Students (Paul Francis, Mark Handley, Jon Crowcroft, …) – LONDON 48