SlideShare a Scribd company logo
Building Topology
[Part-2]
Topology
STA-1
STA-2
STA-3
AP
CSMA
P2P
WIFI
P1 P2
C1 C2 C3 C4
CLIENT
SERVER
UdpEchoServerHelper
UdpEchoCientHelper
RoadMap
● Writing Code
● Detail Understanding
– Logging
– Tracing
– Attributes
Flow Chart
Point To Point
CSMA
WIFI Station
WIFI AP
NODE
Container
Point To Point
CSMA
WIFI Station
WIFI AP
NetDe`vice
Container
Point To Point
CSMA
WIFI Station
WIFI AP
SetAttributes
NetDevice
Point To Point
CSMA
Attach
NetDevice to
PHY
&CHANNEL
WIFI Station
WIFI AP
Configure
PHY & MAC
WIFI Station
WIFI AP
Attach
NetDevice to
PHY
&CHANNEL
Point To Point
CSMA
WIFI Station
WIFI AP
Install
ProtocolStack
Point To Point
CSMA
WIFI Station
WIFI AP
Assign IP
Address
Install Application
Topology Description
● Channels & Net Device
– Wireless
– Point to Point
– CSMA
● Node Container
– Access Point Node
– Station Nodes
– Point to Point Nodes
– CSMA Nodes
● Node P1 & P2 having two Net Device of different types
Classes
● NodeContainer
● PointToPointHelper
● CsmaHelper
● YansWifiChannelHelper
●
YansWifiPhyHelper
● WifiHelper
● NetDeviceContainer
● MobilityHelper
● InternetStackHelper
● Ipv4AddressHelper
●
Ipv4InterfaceContainer
● UdpEchoServerHelper
● UdpEchoClientHelper
● ApplicationContainer
`
Include
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/csma-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/ipv4-global-routing-helper.h"
NODE
● We are having four different types of nodes.
● Create Four Different NodeContainer
– Point to Point
– Station Nodes
– Access Point
– CSMA NodeContainer n1,n2;
n1.Create(3);
[...]
N2.Create(1);
n2.Add(n1.Get(0));
void Create(uint32_t n);
Add()- used to add node in a node container
Create() - used to create node/s
NetDevice and Channel
● Three different NetDevice and Channel:-
– PointToPointHelper – NetDevice & Channel
– CsmaHelper – NetDevice & Channel
– YansWifiChannelHelper – Channel
– YansWifiPhyHelper – PHY
– WifiHelper – NetDevice
We use Install()method to attach NetDevice with Node
It will return an object to NetDeviceContainer
Configure WIFI NetDevice
`
NetDevice
PHY
MAC<attach>
YansWifiPhyHelper
NqosWifiMacHelper
YansWifiChannelHelper
WifiHelper
Node
Configure WIFI NetDevice
● WifiChannel & WifiPhy abstract class
– YansWifiChannel
● We use Helper [YansWifiChannelHelper]
● Set Channel related attributes
– [channel switch delay, energy of received signal,etc]
– YansWifiPhy
● We use Helper [YansWifiPhyHelper]
● Set PHY Layer related attributes
– [propogation delay] Set CHANNEL to PHY
void SetChannel(Ptr<YansWifiChannel>)-
Class YansWifiPhy
Configure MAC
● WifiMac abstract class
– List of MAC Types
● AdhocWifiMac – Infrastructure less network
● ApWifiMac – Access point Node MAC
● StaWifiMac – Station Node MAC
● Etc.
– We use Helper Class
● NqosWifiMacHelper or WifiMacHelper
– Set the appropiate MAC from the list and Set Attributes
● void SetType(T,A,V....);
● T- Type of MAC
● A- Name of Attribute
● V –Value of Attribute
Mobility
● It is used to track and maintain the
– Current Cartesian position
– Speed of an object
– Placement of Node
– Setup Mobility Model
Mobility
[Cartesian Position]
Source:http://en.wikipedia.org/wiki/Cartesian_coordinate_system
Mobility
● Assign Mobility to WIFI Nodes
– List of Mobility Model
● ConstantAccelerationMobilityModel
● ConstantPositionMobilityModel
● ConstantVelocityMobilityModel
● RandomDirection2dMobilityModel
● RandomWalk2dMobilityModel
● Etc
– List of Allocator Model (placement of Node)
● RandomDiscPositionAllocator
● RandomRectanglePositionAllocator
● GridPositionAllocator
● Etc.
Mobility Model
● RandomWalk2dMobilityModel
– 2D random walk mobility model
– Each instance moves with a speed and direction
choosen at random
– Nodes moves in Boundaries specified by Rectangle
– Rectangle(double xMin,double xMax,double yMin,double yMax)
x-axis
y-axis
xMin xMax
yMin
yMax
Allocator Model
● GridPositionAllocator
– Allocate position on a rectangular 2D grid
– List of Attributes
● MinX
● MinY
● DeltaX
● DeltaY
● GridWidth
● LayoutType
– ROW_FIRST
– COLUMN_FIRST
1 2 3
4
(MinX,MinY) DeltaX
DeltaY GridWidth
x-axis
y-axis
Mobility
● We use Helper Class
– MobilityHelper
● SetMobilityModel()-Set Mobility Model
● SetPositionAllocator() - Set Position Allocator
– Install the mobility on Nodes
– Mobility Model [Access Point & CSMA Nodes]
● ConstantPositionMobilityModel
Internet Stack & Ipv4Address
● Now its time to install Protocol Stack
– InternetStackHelper
● Install()
● Assign IP address to the NetDevice
– Ipv4InterfaceContainer
● Assign()
Application
STA-1
STA-2
STA-3
AP
CSMA
P2P
WIFI
P1 P2
C1 C2 C3 C4
CLIENT
SERVER
UdpEchoServerHelper
UdpEchoCientHelper
Animation
● AnimationInterface
– Set Methods for Nodes
● Description – SetNodeDescription(NodeContainer,”AP”)
● Color – SetNodeColor(NodeContainer , R,G,B)
● Position – SetConstantPosition(Node,X,Y)
● Etc.
– Add Background Image
● SetBackgroundImage(..,..,..,);
vodi EnablePacketMetadata(boolean value)
Start Simulation
Simulation::Run();
Simulation::Destroy();
return 0;
● Modify the Mobility Pattern using
– RandomWalk2dMobilityModel
● Distance- Change current direction and
speed after moving for this distance.
● Speed – speed of node
● Bounds – Area
To be Continued...

More Related Content

PDF
Building Topology in NS3
PDF
Tutorial ns 3-tutorial-slides
PDF
NS3 Overview
PDF
1 session installation
PPTX
Ground to ns3 - Basic wireless topology implementation
PDF
ns-3 Tutorial
PDF
Ns3 implementation wifi
PDF
Kvm performance optimization for ubuntu
Building Topology in NS3
Tutorial ns 3-tutorial-slides
NS3 Overview
1 session installation
Ground to ns3 - Basic wireless topology implementation
ns-3 Tutorial
Ns3 implementation wifi
Kvm performance optimization for ubuntu

What's hot (20)

PDF
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
ODP
OpenStack Oslo Messaging RPC API Tutorial Demo Call, Cast and Fanout
PDF
Unrevealed Story Behind Viettel Network Cloud Hotpot | Đặng Văn Đại, Hà Mạnh ...
PDF
Linux Networking Explained
PDF
Virtualized network with openvswitch
PDF
netfilter and iptables
PDF
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
PDF
오픈스택 기반 클라우드 서비스 구축 방안 및 사례
PDF
Easy, Secure, and Fast: Using NATS.io for Streams and Services
PDF
Open vSwitch 패킷 처리 구조
PPTX
Keystone - Openstack Identity Service
PPTX
OpenvSwitch Deep Dive
PDF
MAAS High Availability Overview
PPTX
Overview of Distributed Virtual Router (DVR) in Openstack/Neutron
PDF
The Best Storage Solution For CloudStack: LINSTOR
PPTX
Ansible presentation
PPTX
Tutorial: Using GoBGP as an IXP connecting router
PDF
Building a redundant CloudStack management cluster - Vladimir Melnik
PDF
게임사를 위한 Amazon GameLift 세션 - 이정훈, AWS 솔루션즈 아키텍트
PDF
LinuxCon 2015 Linux Kernel Networking Walkthrough
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
OpenStack Oslo Messaging RPC API Tutorial Demo Call, Cast and Fanout
Unrevealed Story Behind Viettel Network Cloud Hotpot | Đặng Văn Đại, Hà Mạnh ...
Linux Networking Explained
Virtualized network with openvswitch
netfilter and iptables
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
오픈스택 기반 클라우드 서비스 구축 방안 및 사례
Easy, Secure, and Fast: Using NATS.io for Streams and Services
Open vSwitch 패킷 처리 구조
Keystone - Openstack Identity Service
OpenvSwitch Deep Dive
MAAS High Availability Overview
Overview of Distributed Virtual Router (DVR) in Openstack/Neutron
The Best Storage Solution For CloudStack: LINSTOR
Ansible presentation
Tutorial: Using GoBGP as an IXP connecting router
Building a redundant CloudStack management cluster - Vladimir Melnik
게임사를 위한 Amazon GameLift 세션 - 이정훈, AWS 솔루션즈 아키텍트
LinuxCon 2015 Linux Kernel Networking Walkthrough
Ad

Viewers also liked (20)

PDF
Socio-technical System
PDF
Fundamental of Shell Programming
PDF
Inheritance
ODP
Introduction to Virtualization
PDF
Support formobility
PDF
Software Engineering Introduction
PDF
Introduction of Cloud Computing
PDF
Socket Programming using Java
PPT
PPT
PDF
Mobile transportlayer
PPT
Quality planning
PDF
WLAN - IEEE 802.11
PDF
Mobile Network Layer
PPTX
Spring sim 2010-riley
PDF
WiMAX implementation in ns3
PPTX
Jammers&amp;anti jammers
PDF
Cryptanalysis of image encryption using traditional encryption tecnhniques
PPTX
PDF
ICT role in Yemen
Socio-technical System
Fundamental of Shell Programming
Inheritance
Introduction to Virtualization
Support formobility
Software Engineering Introduction
Introduction of Cloud Computing
Socket Programming using Java
Mobile transportlayer
Quality planning
WLAN - IEEE 802.11
Mobile Network Layer
Spring sim 2010-riley
WiMAX implementation in ns3
Jammers&amp;anti jammers
Cryptanalysis of image encryption using traditional encryption tecnhniques
ICT role in Yemen
Ad

Similar to Building Complex Topology using NS3 (20)

PDF
DCCN 2016 - Tutorial 1 Advanced
PPTX
Performance analysis of CSMA/CA and TDMA MAC protocols in Wireless Mesh Netw...
PDF
Glomosim scenarios
PDF
Wireless Sensor Networks UNIT-2
PPTX
TINA showcase: RF Bandwidth Mapping
PPS
Fundamentals of Communication Networks
PDF
Data Center Network Design Using Metrics And Their Results...
PPTX
Cyber physical system in Wireless sensor network
PDF
matdid473708.pdf
PDF
IEEE 802 Standard Network’s Comparison under Grid and Random Node Arrangement...
DOCX
Running wireless simulations in ns
PPTX
firewall simenar ppt.pptx
PPTX
Adhoc Wireless Network
PDF
Gm3411871190
PDF
An Ant colony optimization algorithm to solve the broken link problem in wire...
PDF
Delay and Throughput Aware Cross-Layer TDMA Approach in WSN-based IoT Networks
PDF
Delay and Throughput Aware Cross-Layer TDMA Approach in WSN-based IoT Networks
PPTX
CPScom2012_mwijnants
DCCN 2016 - Tutorial 1 Advanced
Performance analysis of CSMA/CA and TDMA MAC protocols in Wireless Mesh Netw...
Glomosim scenarios
Wireless Sensor Networks UNIT-2
TINA showcase: RF Bandwidth Mapping
Fundamentals of Communication Networks
Data Center Network Design Using Metrics And Their Results...
Cyber physical system in Wireless sensor network
matdid473708.pdf
IEEE 802 Standard Network’s Comparison under Grid and Random Node Arrangement...
Running wireless simulations in ns
firewall simenar ppt.pptx
Adhoc Wireless Network
Gm3411871190
An Ant colony optimization algorithm to solve the broken link problem in wire...
Delay and Throughput Aware Cross-Layer TDMA Approach in WSN-based IoT Networks
Delay and Throughput Aware Cross-Layer TDMA Approach in WSN-based IoT Networks
CPScom2012_mwijnants

Recently uploaded (20)

PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PPT
Mechanical Engineering MATERIALS Selection
PPTX
Sustainable Sites - Green Building Construction
PDF
Structs to JSON How Go Powers REST APIs.pdf
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
additive manufacturing of ss316l using mig welding
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
Geodesy 1.pptx...............................................
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Operating System & Kernel Study Guide-1 - converted.pdf
Strings in CPP - Strings in C++ are sequences of characters used to store and...
Mechanical Engineering MATERIALS Selection
Sustainable Sites - Green Building Construction
Structs to JSON How Go Powers REST APIs.pdf
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
additive manufacturing of ss316l using mig welding
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
bas. eng. economics group 4 presentation 1.pptx
CH1 Production IntroductoryConcepts.pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Arduino robotics embedded978-1-4302-3184-4.pdf
Foundation to blockchain - A guide to Blockchain Tech
Geodesy 1.pptx...............................................

Building Complex Topology using NS3

  • 2. Topology STA-1 STA-2 STA-3 AP CSMA P2P WIFI P1 P2 C1 C2 C3 C4 CLIENT SERVER UdpEchoServerHelper UdpEchoCientHelper
  • 3. RoadMap ● Writing Code ● Detail Understanding – Logging – Tracing – Attributes
  • 4. Flow Chart Point To Point CSMA WIFI Station WIFI AP NODE Container Point To Point CSMA WIFI Station WIFI AP NetDe`vice Container Point To Point CSMA WIFI Station WIFI AP SetAttributes NetDevice Point To Point CSMA Attach NetDevice to PHY &CHANNEL WIFI Station WIFI AP Configure PHY & MAC WIFI Station WIFI AP Attach NetDevice to PHY &CHANNEL Point To Point CSMA WIFI Station WIFI AP Install ProtocolStack Point To Point CSMA WIFI Station WIFI AP Assign IP Address Install Application
  • 5. Topology Description ● Channels & Net Device – Wireless – Point to Point – CSMA ● Node Container – Access Point Node – Station Nodes – Point to Point Nodes – CSMA Nodes ● Node P1 & P2 having two Net Device of different types
  • 6. Classes ● NodeContainer ● PointToPointHelper ● CsmaHelper ● YansWifiChannelHelper ● YansWifiPhyHelper ● WifiHelper ● NetDeviceContainer ● MobilityHelper ● InternetStackHelper ● Ipv4AddressHelper ● Ipv4InterfaceContainer ● UdpEchoServerHelper ● UdpEchoClientHelper ● ApplicationContainer ` Include #include "ns3/core-module.h" #include "ns3/network-module.h" #include "ns3/csma-module.h" #include "ns3/internet-module.h" #include "ns3/point-to-point-module.h" #include "ns3/applications-module.h" #include "ns3/ipv4-global-routing-helper.h"
  • 7. NODE ● We are having four different types of nodes. ● Create Four Different NodeContainer – Point to Point – Station Nodes – Access Point – CSMA NodeContainer n1,n2; n1.Create(3); [...] N2.Create(1); n2.Add(n1.Get(0)); void Create(uint32_t n); Add()- used to add node in a node container Create() - used to create node/s
  • 8. NetDevice and Channel ● Three different NetDevice and Channel:- – PointToPointHelper – NetDevice & Channel – CsmaHelper – NetDevice & Channel – YansWifiChannelHelper – Channel – YansWifiPhyHelper – PHY – WifiHelper – NetDevice We use Install()method to attach NetDevice with Node It will return an object to NetDeviceContainer
  • 10. Configure WIFI NetDevice ● WifiChannel & WifiPhy abstract class – YansWifiChannel ● We use Helper [YansWifiChannelHelper] ● Set Channel related attributes – [channel switch delay, energy of received signal,etc] – YansWifiPhy ● We use Helper [YansWifiPhyHelper] ● Set PHY Layer related attributes – [propogation delay] Set CHANNEL to PHY void SetChannel(Ptr<YansWifiChannel>)- Class YansWifiPhy
  • 11. Configure MAC ● WifiMac abstract class – List of MAC Types ● AdhocWifiMac – Infrastructure less network ● ApWifiMac – Access point Node MAC ● StaWifiMac – Station Node MAC ● Etc. – We use Helper Class ● NqosWifiMacHelper or WifiMacHelper – Set the appropiate MAC from the list and Set Attributes ● void SetType(T,A,V....); ● T- Type of MAC ● A- Name of Attribute ● V –Value of Attribute
  • 12. Mobility ● It is used to track and maintain the – Current Cartesian position – Speed of an object – Placement of Node – Setup Mobility Model
  • 14. Mobility ● Assign Mobility to WIFI Nodes – List of Mobility Model ● ConstantAccelerationMobilityModel ● ConstantPositionMobilityModel ● ConstantVelocityMobilityModel ● RandomDirection2dMobilityModel ● RandomWalk2dMobilityModel ● Etc – List of Allocator Model (placement of Node) ● RandomDiscPositionAllocator ● RandomRectanglePositionAllocator ● GridPositionAllocator ● Etc.
  • 15. Mobility Model ● RandomWalk2dMobilityModel – 2D random walk mobility model – Each instance moves with a speed and direction choosen at random – Nodes moves in Boundaries specified by Rectangle – Rectangle(double xMin,double xMax,double yMin,double yMax) x-axis y-axis xMin xMax yMin yMax
  • 16. Allocator Model ● GridPositionAllocator – Allocate position on a rectangular 2D grid – List of Attributes ● MinX ● MinY ● DeltaX ● DeltaY ● GridWidth ● LayoutType – ROW_FIRST – COLUMN_FIRST 1 2 3 4 (MinX,MinY) DeltaX DeltaY GridWidth x-axis y-axis
  • 17. Mobility ● We use Helper Class – MobilityHelper ● SetMobilityModel()-Set Mobility Model ● SetPositionAllocator() - Set Position Allocator – Install the mobility on Nodes – Mobility Model [Access Point & CSMA Nodes] ● ConstantPositionMobilityModel
  • 18. Internet Stack & Ipv4Address ● Now its time to install Protocol Stack – InternetStackHelper ● Install() ● Assign IP address to the NetDevice – Ipv4InterfaceContainer ● Assign()
  • 19. Application STA-1 STA-2 STA-3 AP CSMA P2P WIFI P1 P2 C1 C2 C3 C4 CLIENT SERVER UdpEchoServerHelper UdpEchoCientHelper
  • 20. Animation ● AnimationInterface – Set Methods for Nodes ● Description – SetNodeDescription(NodeContainer,”AP”) ● Color – SetNodeColor(NodeContainer , R,G,B) ● Position – SetConstantPosition(Node,X,Y) ● Etc. – Add Background Image ● SetBackgroundImage(..,..,..,); vodi EnablePacketMetadata(boolean value)
  • 22. ● Modify the Mobility Pattern using – RandomWalk2dMobilityModel ● Distance- Change current direction and speed after moving for this distance. ● Speed – speed of node ● Bounds – Area