The document introduces a tutorial on simulating communication between devices within LAN and WLAN networks using the Network Simulator 3 (NS-3). It describes creating a virtual machine with NS-3 and Eclipse for developing network simulations and demonstrates simulating a simple network topology with point-to-point, CSMA/CD Ethernet, and CSMA/CA WiFi links between nodes, including capturing traffic between an echo client and server using pcap tracing.
DCCN 2016 - Tutorial 1 - Communication with LAN/WLAN
1. Introduction NS-3 Tutorial C2 Conclusion
DCCN Tutorial C2: Communication Between
Devices Within LAN/WLAN Networks
Pavel Masek, Jiri Hosek
Brno University of Technology,
Faculty of Electrical Engineering and Communication,
Department of Telecommunication.
masekpavel@feec.vutbr.cz, hosek@feec.vutbr.cz
November 23, 2016
2. Introduction NS-3 Tutorial C2 Conclusion
WISLAB Research Group – http://www.wislab.cz
WISLAB - Wireless System Laboratory of Brno
Coordinated by Dr. Hosek
Experienced researchers and MSc. / Ph.D.
students
Working with the up-to-date equipment
Nowadays, focused mainly on the IoT domain
Communication in 4G / 5G mobile networks
Intel US, Huawei, AT&T, TUT, IITIS, PFUR, SUAI
SmartHome Gateway
Telekom Austria Group
Wearables
Augmented reality, smart glasses
MTC Communication in NS-3
Member of well-known alliances AllSeen Alliance or HGi
Contributor to 3GPP standards and recommendations
3. Introduction NS-3 Tutorial C2 Conclusion
DCCN Tutorials: Agenda
Tutorial #1 [Wed 23.11.16] - Communication
between devices within LAN/WLAN networks
Tutorial #2 [Thu 24.11.16] - Implementation of 4G cellular
communication within the SmartGrid ecosystem
Tutorial #3 [Fri 25.11.16] - Implementation of QoS
mechanisms for Device-to-Device (D2D) communication
between mobile devices
Main goal
From basic network topology to advanced communication
mechanisms used in today’s IoT/M2M scenarios – utilizing
Network Simulator 3 (NS-3) tool for timely use-cases
4. Introduction NS-3 Tutorial C2 Conclusion
Network Simulator 3 (NS-3) – https://www.nsnam.org
NS-3 is written in C++, with bindings available for
Python
Simulation programs are C++ executables or Python
programs
NS-3 is a GNU GPLv2 licensed project
Mainly supported fro Linux/Unix, MacOS, and FreeBSD
Currently, port to Visual Studio is available
No backwards compatibility with NS-2
In comparison with other network simulators, oriented to
command-line and Unix (no IDE provided in
standard NS-3 framework)
5. Introduction NS-3 Tutorial C2 Conclusion
NS-3 Simulation Basics
Simulation time advances in discrete jumps from event
to event
C++ functions schedule events to occur at specific
simulation times
Several supporting libraries, not system-installed, can be in
parallel to NS-3 (netAnim, pybindgen, etc.)
A simulation scheduler orders the event execution
Simulation::Run() gets it all started
Simulation stops at specific time or when events end
6. Introduction NS-3 Tutorial C2 Conclusion
Motivation – Why to Use NS-3?
You want to study network performance or protocol
operation in a controllable or scalable environment
You are comfortable writing C++ or Python code, and
combining NS-3 with other code
You like the idea of working on an active open source
project
NS-3 has the models you are looking for, or you can
provide / integrate what is missing
Well-known projects
LENA (LTE-EPC Network Simulator)
DCE (Direct Code Execution)
7. Introduction NS-3 Tutorial C2 Conclusion
Created Virtual Machine for Development
Created as a VMware virtual machine (possible to run
via VMware Workstation/Player or VirtualBox)
Based on Ubuntu 14.04 LTS 32bit (Long Term Support)
Possible to make ”Snapshoots”
Already pre-configured
Eclipse environment bounded with NS-3 (no need to
develop straightforward from the command line; possible to
use advanced debugger)
Visualization tools: NetAnim, FlowMonitor, Python
visualizer
Tracing: Wireshark, trace files in NS-3, routing tables, etc.
As the utilized version, NS-3.23 was chosen – verified
functionality, stable, already contains new syntax
8. Introduction NS-3 Tutorial C2 Conclusion
Created Virtual Machine for Development
Created as a VMware virtual machine (possible to run
via VMware Workstation/Player or VirtualBox)
Based on Ubuntu 14.04 LTS 32bit (Long Term Support)
Possible to make ”Snapshoots”
Already pre-configured
Eclipse environment bounded with NS-3 (no need to
develop straightforward from the command line; possible to
use advanced debugger)
Visualization tools: NetAnim, FlowMonitor, Python
visualizer
Tracing: Wireshark, trace files in NS-3, routing tables, etc.
As the utilized version, NS-3.23 was chosen – verified
functionality, stable, already contains new syntax
10. Introduction NS-3 Tutorial C2 Conclusion
Network Scenario – LAN/WLAN communication
Default network topology implementing IEEE 802.11
PHY and MAC models
Scalable for future projects (number of nodes, used
communication technologies, etc.)
Intended network topology
Three groups of nodes (P2P, CSMA/CD, WiFi
(CSMA/CA))
n0 n1 n2 n3 n4
Point-to-point
LAN
10.1.2.0/24
10.1.1.0/24
n5n6n7
* * **
AP
Wi-Fi 10.1.3.0/24
11. Introduction NS-3 Tutorial C2 Conclusion
Tasks
1 Check structure of given code, understand to topology
helpers, containers, nodes, etc
2 Run the prepared simulation scenario
3 View output files (tracing files) via tcpdump and
Wireshark
4 Try to change provided code (rebuild the scenario) and
check the output files (e.g., change source and
destination nodes for data transmission, amount of
payload, etc.)
19. Introduction NS-3 Tutorial C2 Conclusion
T1: PCAP Tracing
pointToPoint.EnablePcapAll ("wlan_lan");
phy.EnablePcap ("wlan_lan", apDevices.Get (0));
csma.EnablePcap ("wlan_lan",csmaDevices.Get (0),true);
Pcap tracing started on both P2P nodes (CSMA/CA and
CSMA/CD) – our backbone
Promiscuous mode configured on the WiFi (CSMA/CA)
network
20. Introduction NS-3 Tutorial C2 Conclusion
T3: Captured Communication from ”Echo” Server
reading from file wlan_lan -1-1.pcap , link -type EN10MB
(Ethernet)
2.017837 ARP , Request who -has 10.1.2.4 (ff:ff:ff:ff:ff
:ff) tell 10.1.2.1 , length 50
2.017861 ARP , Reply 10.1.2.4 is -at 00:00:00:00:00:06 ,
length 50
2.017861 IP 10.1.3.3.49153 > 10.1.2.4.9: UDP , length
1024
2.022966 ARP , Request who -has 10.1.2.1 (ff:ff:ff:ff:ff
:ff) tell 10.1.2.4 , length 50
2.022966 ARP , Reply 10.1.2.1 is -at 00:00:00:00:00:03 ,
length 50
2.023072 IP 10.1.2.4.9 > 10.1.3.3.49153: UDP , length
1024
21. Introduction NS-3 Tutorial C2 Conclusion
T3: Captured Communication from ”Echo” Client
reading from file wlan_lan -1-1.pcap , link -type EN10MB
(Ethernet)
2.017837 ARP , Request who -has 10.1.2.4 (ff:ff:ff:ff:ff
:ff) tell 10.1.2.1 , length 50
2.017861 ARP , Reply 10.1.2.4 is -at 00:00:00:00:00:06 ,
length 50
2.017861 IP 10.1.3.3.49153 > 10.1.2.4.9: UDP , length
1024
2.022966 ARP , Request who -has 10.1.2.1 (ff:ff:ff:ff:ff
:ff) tell 10.1.2.4 , length 50
2.022966 ARP , Reply 10.1.2.1 is -at 00:00:00:00:00:03 ,
length 50
2.023072 IP 10.1.2.4.9 > 10.1.3.3.49153: UDP , length
1024
22. Introduction NS-3 Tutorial C2 Conclusion
T4: Possible Modifications (Individual Tasks)
1 Add number of WiFi nodes and change location of the
”Echo” client node
2 Change number of transmitted data (payload)
3 Change total number of sent packets
4 Check performed changes via Wireshark (pass: student)
Run terminal: sudo wireshark
Open captured files
23. Introduction NS-3 Tutorial C2 Conclusion
Final Conclusion
We have got familiar with Network Simulator 3
Initial network topology created and simulated
Utilizing NS-3 structure (helpers, containers, etc.)
Ready to be extended by other communication technologies
Tracing of generated data traffic
Next time: Tutorial C4
Implementation of 4G (LTE) cellular communication
within the SmartGrid ecosystem
24. Introduction NS-3 Tutorial C2 Conclusion
Thank you for your attention.
Pavel Masek, Jiri Hosek
masekpavel@feec.vutbr.cz, hosek@feec.vutbr.cz
Brno University of Technology,
Faculty of Electrical Engineering and Communication,
Department of Telecommunication.