NS-3 Simulation

  • Upload
    marc

  • View
    206

  • Download
    5

Embed Size (px)

DESCRIPTION

2014 YU-ANTL Lab Seminar. NS-3 Simulation. April 1 , 2014 Yashashree Jadhav Advanced Networking Technology Lab. (YU-ANTL) Dept. of Information & Comm. Eng, Graduate School, Yeungnam University, KOREA (Tel : + 82-53-810-3940; Fax : +82-53-810-4742 - PowerPoint PPT Presentation

Citation preview

YNU-ANTL /

NS-3 Simulation2014 YU-ANTL Lab SeminarApril 1, 2014

Yashashree JadhavAdvanced Networking Technology Lab. (YU-ANTL)Dept. of Information & Comm. Eng, Graduate School, Yeungnam University, KOREA(Tel : +82-53-810-3940; Fax : +82-53-810-4742http://antl.yu.ac.kr/; E-mail : [email protected])

1Outline (1)IntroductionWhat is NS-3?NS-3 Vs. NS-2NS-3 Features

Building, installation and configuration NS-3Getting NS-3 Source (installation)Building and Configuration NS-3Testing NS-3

Abstractions

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#2Outline (2)ExampleExample - ConceptualNS-3 Models

NS-3 ScriptWired-ScriptBuilding wired-scriptWireless-Script Building wireless-script

DCE

IEEE802.11n Standard

References

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Introduction (1)What is NS-3?

NS-3 is a discrete-event network simulator for Internet systems

NS-3 allows researchers to study Internet protocols and large-scale systems in a controlled environmentNS-3 is a new simulator (not backwards-compatible with ns-2)

NS-3 is a free, open source software project organized around research community development and maintenance

Developed for network research and educationDeveloped after ns-2Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#4Introduction (2)NS-3 Vs. NS-2

NS-2 uses OTcl as its scripting environment

NS-3 uses C++ programs or python scripts to define simulationsSimulation programs are C++ executables or Python programs NS-3 is a new simulator (not backwards-compatible with NS-2)

Some NS-2 models that are mostly written in C++ have already been ported to NS-3

OTcl-based models can not be ported

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Introduction (3)NS-3 Features

It is a discrete event simulatorModular design / Open sourceActively developed (Contrast NS-2)Developed in C++ (Python binding available)Live visualizeLogging facility for debuggingTracing facility for getting outputCan be connected to a real networkDirect Code Execution (DCE)Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#

Getting NS-3 Source (Installation) (1)

Getting NS-3 source (installation)http://www.nsnam.org/Latest release: ns-3.19( 20 December 2013 )

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Getting NS-3 Source (Installation) (2)Procedure 1

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Getting NS-3 Source (Installation) (3)Procedure 1

Ready to build the NS-3 distribution

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Building and Configuration NS-3 (1)Building with build.pysudo ./build.py --enable-examples enable-tests

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Building and Configuration NS-3 (2)Building with wafcd ns-3.19sudo ./waf cleansudo ./waf -d optimized --enable-examples --enable-tests configure

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Building and Configuration NS-3 (3)Debug build that includes the examples and testssudo ./waf cleansudo ./waf -d debug --enable-examples --enable-tests configure

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Building and Configuration NS-3 (4)Build the debug versions of the ns-3 programssudo ./wafsudo ./waf -d debug enable-sudo --enable-examples --enable-tests configuresudo ./waf -d debug -o build/debug --enable-examples --enable-tests configure

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#

Testing NS-3 (1)

Testing ns-3sudo ./test.pysudo ./test.py -c core

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#

Testing NS-3 (2)

Running a Scriptsudo ./waf --run hello-simulator

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#

Abstractions

Key Abstractions

NodeApplicationNet deviceChannelAdvanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Example (1)Example - Conceptual

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Example (2)NS-3 Models

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#

Wired-Script (1)

Module IncludesThe code proper starts with a number of include statements

Namespace Declaration The next line in the wired script is a namespace declaration

Logging

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Wired-Script (2)Main Functions

Ns3 NS_LOG_ERROR Log error messages; NS_LOG_WARN Log warning messages; NS_LOG_DEBUG Log relatively rare, ad-hoc debugging messages; NS_LOG_INFO Log informational messages about program progress; NS_LOG_FUNCTION Log a message describing each function called; NS_LOG_LOGIC Log messages describing logical flow within a function; NS_LOG_ALL Log everything. NS_LOG_UNCOND Log the associated message unconditionally. Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Wired-Script (3)Create the ns-3 Node objects that will represent the computers in the simulation

We are constructing a point to point link

We will need to have a list of all of the NetDevice objects that are created

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Wired-Script (4)Protocol stacks installed on our nodesTCP,IP,UDP etc.

Ipv4AddressHelperMake the association between an IP address and a device

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Wired-Script (5)Two specializations of the core ns-3 class Application called UdpEchoServerApplicationUdpEchoClientApplicationUdpEchoServerHelper

UdpEchoClientHelper

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Wired-Script (6)SimulatorWhat we need to do at this point is to actually run the simulation

scheduled events in the simulator at 1.0 seconds, 2.0 seconds and two events at 10.0 seconds

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#

Building wired-script (1)

Building Your ScriptDrop your script into the scratch directoryNow build your script using waf

Run the example

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#

Wireless-Script (1)

Add the Wi-Fi and the mobility modules

The network topology illustration follows

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Wireless-Script (2)Wireless Network TopologyFor enabling or disabling logging components and for changing the number of devices created

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Wireless-Script (3)Part of the Wi-Fi Network

Configure the PHY and channel helpers

Create a channel object and associate it to our PHY layer object manager

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Wireless-Script (4)NqosWifiMacHelper object to set MAC parametersrate control algorithmAARF (Adaptive Auto-Rate Fallback ) algorithm

The SSID of the infrastructure network

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Simulation

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Wireless-Script (5)Create the wifi devices of these stations

Configure the AP (access point) node

Shares the same set of PHY-level Attributes (and channel) as the stations

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Wireless-Script (6)Set some Attributes controlling the position allocator functionality

Need to tell them how to moveRandomWalk2dMobilityModel random directionrandom speed

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Wireless-Script (7)Need to tell them how to moveRectangle (double _xMin, double _xMax, double _yMin, double _yMax)

Want the access point to remain in a fixed position during the simulation

Protocol stacks

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Wireless-Script (8)Assign IP addresses to the device interfaces

Enable internetwork routing

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Wireless-Script (9)Create just enough tracing to cover all three networks

Run the simulation, clean up and then exit the program

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#

Building wireless-script

Building Your ScriptDrop your script into the scratch directoryNow build your script using waf

Run the example

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#Simulation

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#

DCE (1)

Direct Code ExecutionDCE ns-3 module provides facilities to execute network protocols within ns-3 existing implementations of user space and kernel spaceDCE with iperf(dce-iperf)The example uses iperf traffic generator in a simulationDCE use we need to include the file ns3/dce-module.h

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#DCE (2)The network topology illustration follows

Main function

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#DCE (3)DceManagerHelperIt is the tool you will use within your script to parameter and install DceManager on the ns-3 nodes where you plan to run binaries

LinuxStackHelperIt is used to configure parameters of Linux kernel

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#DCE (4)Assign IP addresses to the device

DceApplicationHelperthis helper in order to define which application you want to run within ns-3

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#DCE (5)Launch Iperf on client node

Launch Iperf on server node

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#DCE (6)Run the simulation

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#DCE (7)Run the simulation

Server output

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#DCE (8)Client output

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#

IEEE802.11n Standard (1)

MAC configuration

QosSupported featureallows configuration of 802.11e/WMM-style QoS support

HtSupported featureAllows configuration of 802.11n High Throughput style support

ns3::EdcaTxopNused by QoS-enabled high MACs and also performs QoS operations like 802.11n-style MSDU aggregation

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (2)WifiMacHelperUsed to configure MAC parametersns3::QosWifiMacHelperCreate MAC instances with QoS support enabledAn MSDU aggregator for a particular Access Category (AC) in order to use 802.11n MSDU aggregation featureblock ack parametersFollowing example shows ns3::QosWifiMacHelper to create an AP with QoS enabled, aggregation on AC_VO, and Block Ack on AC_BE

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (3)ns3::HtWifiMacHelperCreation of MAC instances that have 802.11n-style High throughput (Ht) and QoS support enabled

Rate control algorithmsARF Rate control algorithmminstrel Rate control algorithm

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (4)PHY configurationYansWifiPhyHelperTo enable 802.11n High Throughput style parameters the following line of code could be used

WifiHelperIt sets the default wifi standard to 802.11a and sets the RemoteStationManager to ns3::ArfWifiManagerChange the RemoteStationManager by calling the WifiHelper::SetRemoteStationManagerTo change the wifi standard, call the WifiHelper::SetStandardWifi_PHY_STANDARD_80211n_2_4GHZWifi_PHY_STANDARD_80211n_5GHZ

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (5)Library

Topology

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (6)FeatureSet 802.11n Mac and PHY layer propertiesAlso check how frame aggregation feature (A-MSDU) workPacket in this simulation belonging to best effort traffic

Create Node

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (7)Set WiFi Standard

Set Physical Data Rate

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (8)Set Physical Layer

Set Mac Layer

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (9)Set AP and Station

Set Mobility Model

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (10)Assign IP address to AP and STA

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (11)Set Client and Server

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (12)Set Flow Monitor

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (13)Throughput 1 AP 1 STAPacket Size : 1500 ByteMax Packet : 100,000

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (14)Throughput Vs Offer Load1 Ap 1 StationPacket Size : 1500 ByteMax Packet :100,000

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (15)Topology

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (16)Main Function

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (17)Set point to point Channel

Set WiFi Nodes

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (18)Set standard and Physical data rate

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (19)Set Physical Layer

Set Mac Layer and Create WiFi Net Device

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (20)Set Mobility

Stack Install and Address assign to device

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (21)Set Server and Client

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (22)Flow Monitor

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (23)Aggregated Throughput Vs Offer LoadPacket Size : 1500 ByteMax Packet : 100,000

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#IEEE802.11n Standard (24)Aggregated Throughput Vs No of Stations1 Ap N StationPacket Size : 1500 ByteOffer Load/STA : 2.91589 Mbps/STA

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#References[1] http://www.nsnam.org[2] http://www.nsnam.org/docs/tutorial/tutorial.html[3] http://www.nsnam.org/wiki/index.php/MainPage

Advanced Networking Tech. Lab.Yeungnam University (YU-ANTL)YU-ANTL Lab. SeminarYashashree Jadhav#70