You are on page 1of 39

Simulasi Jaringan

Pertemuan ke-2 (15 September 2018)


Simulasi jaringan sederhana

Dr. Teuku Yuliar Arif, ST., M.Kom

yuliar@unsyiah.ac.id

Magister Teknik Elektro - Universitas Syiah Kuala


Jaringan WiFi Sederhana
 Terdiri dari 1 Access Point (AP) dan 1
Station (STA).
 Contoh AP:

AP

 Contoh STA : STA/AP

2
Jaringan WiFi Sederhana

AP STA

application application

transport transport

network network

link link

physical physical
3
NS-3 basic simulation model
application
Application Application
Application Application
transport

network
Protocol Protocol
stack stack
link

Node physical Node

NetDevice NetDevice
NetDevice Channel NetDevice

Channel
Model Jaringan WiFi pada NS-3
Node Node

Application Application
Sockets-like
API

Protocol Packet(s) Protocol


stack stack

NetDevice NetDevice

Channel
Building with build.py
 We should see the following magic words:

6
NS-3 all-in-one package Directory Structure

7
Testing ns-3
 We can run the unit tests of the ns-3
distribution by running the script :
$ ./test.py -c core
 To run a program :
$ ./waf --run hello-simulator
 Waf first checks the program is built
correctly and executes a build if required.
 Waf then executes the program, which
produces the following output:
Hello Simulator
 Congratulations. You are now an ns-3 user.
8
NS-3 Key Abstractions
 1.Node
 Host, end system in the Internet
 Basic computing device abstraction
 Represented in C++ by the class Node

 2.Application
 A user program that generates some activity to be simulated
 Ns-3 applications run on ns-3 Nodes to drive simulations
 Represented in C++ by the class Application
 Ex: UDP Echo client/server, Onoff Application, Pingv4/6

 3.Channel
 Medium connected by nodes over which data flows
 Represented in C++ by the class Channel
 Ex: CsmaChannel, PointToPointChannel, WifiChannel
NS-3 Key Abstractions
 4. Net device
 Like a specific kind of network cable and a hardware device
(Network Interface Cards; NICs)
 NICs are controlled using the software driver, net devices
 Represented in C++ by the class NetDevice
 Provide methods for managing connections to Node and Channel
 Ex) CsmaNetDevice (work with CsmaChannel)
WifiNetDevice (work with WifiChannel)

 5. Topology helpers
 Topology helpers make ns-3 core operations as easy as possible
 Create a NetDevice, add an address, install that net device on a
Node, configure the node’s protocol stack and connet the
NetDevice to a Channel
NS-3 Key Abstractions
 5. Topology Helpers
I. NodeContainer: Provide a convenient way to create, manage and access
any Node object

II. PointToPointHelper:Configure and connect PointToPointNetDevice


and PointToPointChannel objects. Set DataRate on NetDevices and Delay
on Channel

III.NetDeviceContainer: To Install NetDevice at the nodes and create


Channel between the nodes

IV.InternetStackHelper: To Install an Internet Stack (TCP, UDP, IP, etc.)


on each of the nodes in the node container

V. Ipv4AddressHelper: Manage the allocation of IP address and assign


addresss to the devices using Ipv4InterfaceContainer
Simulasi Model Jaringan PtP
ns-allinone-3.29\ns-3.29\examples\tutorial\first.cc

PtP, Data rate 5Mbps, Delay 2 ms


Node Node

Application Application

Protocol Packet(s) Protocol


stack stack

NetDevice NetDevice
Channel
\ns-allinone-3.29\ns-3.29\examples\tutorial\first.cc
Emacs mode line

GNU legalese

Module Includes

Namespace declaration

Logging
\ns-allinone-3.29\ns-3.29\examples\tutorial\first.cc
declaration of the main function

Sets the time resolution


Enable logging
components
Node

Channel

Device

Protocol stack
IPv4 address
Address to device

Server application
\ns-allinone-3.29\ns-3.29\examples\tutorial\first.cc

Client application
Jaringan PTP Sederhana

application application

transport transport

network network

link link

physical physical
3
Jaringan WiFi Sederhana

3
Jaringan WiFi Sederhana

3
Jaringan WiFi Sederhana

link

physical

3
Jaringan WiFi Sederhana

link link

physical physical

3
Jaringan WiFi Sederhana

link link

physical physical

transport

network

3
Jaringan WiFi Sederhana

transport transport

network network

link link

physical physical

3
Jaringan WiFi Sederhana

transport transport

network network

link link

physical physical

application

3
Jaringan WiFi Sederhana

application

transport transport

network network

link link

physical physical

3
Jaringan WiFi Sederhana

application

transport transport

network network

link link

physical physical

application

3
Jaringan WiFi Sederhana

application application

transport transport

network network

link link

physical physical

3
NS-3 basic simulation code
NS-3 basic simulation code
Node Node
NS-3 basic simulation code
Node Node
NS-3 basic simulation code
Node Node

NetDevice NetDevice
NS-3 basic simulation code
Node Node

Protocol Protocol
stack stack

NetDevice NetDevice
NS-3 basic simulation code
Node Node

Protocol Protocol
Stack Stack
Ip: Ip:
1.1.1.2
1.1.1.1

NetDevice NetDevice
NS-3 basic simulation code
Node Node
Application Application
EchoServer EchoClient

Protocol Protocol
Stack Stack
Ip: Ip:
1.1.1.2
1.1.1.1

NetDevice NetDevice
NS-3 basic simulation code
Node Node
Application Application
EchoServer EchoClient

Protocol Protocol
Stack Stack
Ip: Ip:
1.1.1.2
1.1.1.1

NetDevice NetDevice
NS-3 basic simulation code
Node Node
Application Application
EchoServer EchoClient

Protocol Protocol
Stack Stack
Ip: Ip:
1.1.1.2
1.1.1.1

NetDevice NetDevice
NS-3 basic simulation code
Node Node
Application Application
EchoServer EchoClient

Protocol Protocol
Stack Stack
Ip: Ip:
1.1.1.2
1.1.1.1

NetDevice NetDevice
Tugas-2
 Pelajari ns-3-tutorial.pdf khususnya Bab-4 (Conceptual
Overview), Bab-5 (Tweaking) dan Bab-6 (Building
Topologies).
 Berdasarkan penjelasan pada Bab-6.3 (Building a Wireless
Network Toologi), buatlah simulasi jaringan WiFi dengan
skenario sbb:
 Pada jaringan WiFi hanya ada 2 node yaitu satu node Access Point (AP)
dan satu node station (STA).
 Channel WiFi gunakan YansWifiChannelHelper::Default
 Phy WiFi gunakan YansWifiPhyHelper::Default
 Remote station manager gunakan AarfWifiManager
 Buat nama SSID-nya no NIM anda
 Jarak antar AP dan STA adalah d meter (d = no absen anda dikelas).
 Gunakan IP network : 192.168.X.0/24 dimana X = nomor absen anda.
 Gunakan UdpEchoServerHelper untuk mencreate aplikasi echoserver.
 Gunakan ApplicationContainer dan installkan aplikasi echoserver di AP.
 Set aplikasi echoserver start pada detik ke 1,0 dan stop pada detik ke
10,0. 26
Tugas-2
 Gunakan UdpEchoClientHelper untuk mencreate aplikasi echoclient. Set
alamat echoserver (ip dan port) pada echoclient agar echo client
mengetahui alamat aplikasi echoserver. Set attribute echoclient sbb :
 Jumlah paket (MaxPackets) = 3 buah.

 Interval antar paket (Interval) = 1 detik.

 Ukuran paket (PacketSize) = 1500 byte.

 Gunakan ApplicationContainer dan installkan aplikasi echoclient di STA.


 Set aplikasi echoclient start pada detik ke 2,0 dan stop pada detik ke
10,0.
 Simulator stop pada detik ke 10,0.
 Simpan nama file simulasi t2-nimanda.cc
 Jalankan simulasi yang telah anda buat.
 Screenshoot hasil simulasi yang memperlihatkan kapan
paket dikirimkan dan diterima.
 Upload screenshot dan file source code simulasi dalam
format pdf (beri nama t2-nimanda.cc.pdf) paling
lambat jumat 21/9/2018.
27
28

You might also like