Session 3. Pcap 출력, animator 사용법 및 ns-3 기본 제공 어플리케이션

Slides:



Advertisements
Similar presentations
Internet Control Protocols Savera Tanwir. Internet Control Protocols ICMP ARP RARP DHCP.
Advertisements

CCNA2 Module 4. Discovering and Connecting to Neighbors Enable and disable CDP Use the show cdp neighbors command Determine which neighboring devices.
1 Semester 2 Module 4 Learning about Other Devices Yuda college of business James Chen
Session 1. NS-3 개요 ( 환경 구축 및 transport layer model) 이옥환, 신연철 Multimedia & Wireless Networking Laboratory, SNU
Leon-Garcia & Widjaja: Communication Networks Copyright ©2000 The McGraw Hill Companies A Little More on Chapter 7 And Start Chapter 8 TCP/IP.
Network Layer Packet Forwarding IS250 Spring 2010
CPSC 441 Tutorial - Network Tools 1 Network Tools CPSC 441 – Computer Communications Tutorial.
Introduction. 2 What Is SmartFlow? SmartFlow is the first application to test QoS and analyze the performance and behavior of the new breed of policy-based.
5/12/05CS118/Spring051 A Day in the Life of an HTTP Query 1.HTTP Brower application Socket interface 3.TCP 4.IP 5.Ethernet 2.DNS query 6.IP router 7.Running.
1 Internet Control Message Protocol (ICMP) RIZWAN REHMAN CCS, DU.
TCP/IP Tools Lesson 5. Objectives Skills/ConceptsObjective Domain Description Objective Domain Number Using basic TCP/IP commands Understanding TCP/IP3.6.
1 ICMP : Internet Control Message Protocol Computer Network System Sirak Kaewjamnong.
Network Layer4-1 NAT: Network Address Translation local network (e.g., home network) /24 rest of.
1 ECE453 – Introduction to Computer Networks Lecture 12 – Network Layer (IV)
Herramientas para diagnósticos. Ping USO: Ping nombre.dominio o dirección IP Options: -t Ping the specifed host until interrupted. -a Resolve addresses.
ICMP : Internet Control Message Protocol. Introduction ICMP is often considered part of the IP layer. It communicates error messages and other conditions.
NS-3를 이용한 Proxy Mobile IPv6 Simulation
TCP/IP Essentials A Lab-Based Approach Shivendra Panwar, Shiwen Mao Jeong-dong Ryoo, and Yihan Li Chapter 5 UDP and Its Applications.
IP Forwarding.
Fall 2005Computer Networks20-1 Chapter 20. Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv ARP 20.2 IP 20.3 ICMP 20.4 IPv6.
© Jörg Liebeherr (modified by M. Veeraraghavan) 1 ICMP: A helper protocol to IP The Internet Control Message Protocol (ICMP) is the protocol used for error.
Chapter 6-2 the TCP/IP Layers. The four layers of the TCP/IP model are listed in Table 6-2. The layers are The four layers of the TCP/IP model are listed.
1 Internet Control Message Protocol (ICMP) Used to send error and control messages. It is a necessary part of the TCP/IP suite. It is above the IP module.
Internet 1) Internet basic concepts 2) The IP protocol stack 3) The IP datagram header (IPv4 and IPv6) 4) Addressing and routing 5) Example: downloading.
1 Network Layer Lecture 16 Imran Ahmed University of Management & Technology.
Internet Protocol Formats. IP (V4) Packet byte 0 byte1 byte 2 byte 3 data... – up to 65 K including heading info Version IHL Serv. Type Total Length Identifcation.
Monitoring Troubleshooting TCP/IP Chapter 3. Objectives for this Chapter Troubleshoot TCP/IP addressing Diagnose and resolve issues related to incorrect.
ERICSON BRANDON M. BASCUG Alternate - REGIONAL NETWORK ADMINISTRATOR HOW TO TROUBLESHOOT TCP/IP CONNECTIVITY.
1 CSE 5346 Spring Network Simulator Project.
Dohyung Kim Computer network lab,
Data Communications and Networks Chapter 6 – IP, UDP and TCP ICT-BVF8.1- Data Communications and Network Trainer: Dr. Abbes Sebihi.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
11 CS716 Advanced Computer Networks By Dr. Amir Qayyum.
1 © 2004, Cisco Systems, Inc. All rights reserved. CCNA 2 v3.1 Module 8 TCP/IP Suite Error and Control Messages.
1 Kyung Hee University Chapter 9 ICMP. 2 Kyung Hee University 9.1 Introduction  IP protocol has no error-reporting or error-correcting mechanism When.
4: Network Layer4-1 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside a router r 4.4 IP: Internet.
Victoria Manfredi September 13, 2016.
Internet Control Message Protocol (ICMP)
Internet Control Message Protocol (ICMP)
Networks Problem Set 3 Due Nov 10 Bonus Date Nov 9
Lab 2: Packet Capture & Traffic Analysis with Wireshark
Chapter 19 Network Layer Protocols
Network Commands 2 Linux Ubuntu A.S.
Network Tools and Utilities
Internet Control Message Protocol (ICMP)
Chapter 9 ICMP.
Networks Problem Set 3 Due Oct 29 Bonus Date Oct 26
COMPUTER NETWORKS CS610 Lecture-33 Hammad Khalid Khan.
Part1: Ipconfig ping command Tracert command Getmac command
Session 6. Wired LAN in ns-3
Session 8. LTE in ns-3 박태준 Multimedia & Wireless Networking Laboratory, SNU
Session 4. 어플리케이션 및 헤더 만들기 변성호, 이규진
Internet Control Message Protocol (ICMP)
Internet Control Message Protocol (ICMP)
Session 2. Logging과 Command Line Argument 사용법
Internet Control Message Protocol (ICMP)
Communication Networks NETW 501 Tutorial 3
Session 1. ns-3 기초 신연철 Multimedia & Wireless Networking Laboratory, SNU
Internet Control Message Protocol (ICMP)
Internet Control Message Protocol (ICMP)
NS3-Basic 문준영.
Internet Control Message Protocol Version 4 (ICMPv4)
Process-to-Process Delivery:
Internet Control Message Protocol
Internet Control Message Protocol
Ns-3 Tutorial Xin Li.
ns-3 Training Visualization ns-3 Annual Meeting June 2016
ns-3 Direct Code Execution ns-3 Annual Meeting June 2016
Computer Networks Protocols
TCP/IP Protocol Suite 1 Chapter 9 Upon completion you will be able to: Internet Control Message Protocol Be familiar with the ICMP message format Know.
Presentation transcript:

Session 3. Pcap 출력, animator 사용법 및 ns-3 기본 제공 어플리케이션 구종회, 변성호 Multimedia & Wireless Networking Laboratory, SNU jhkoo@mwnl.snu.ac.kr shbyeon@mwnl.snu.ac.kr

Contents Tracing system Animator Application Exercise ASCII PCAP UdpEcho OnOffApplication UdpClientServer Exercise

Tracing & Animator

Tracing System Tracing is a structured form of simulation output

ASCII Tracing AsciiTraceHelper ascii; ASCII Tracing Trace file similar to that of NS-2 AsciiTraceHelper ascii; pointToPoint.EnableAsciiAll (ascii.CreateFileStream(“myfirst.tr”)); Simulator::Run (); Simulator::Destroy (); return 0; Output (myfirst.tr) + 2 /NodeList/0/DeviceList/0/$ns3::PointToPointNetDevice/TxQueue/Enqueue ns3::PppHeader (Point-to-Point Protocol: IP (0x0021)) ns3::Ipv4Header (tos 0x0 ttl 64 id 0 protocol 17 offset 0 flags [none] length: 1052 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 1032 49153 > 9) Payload (size=1024) - 2 /NodeList/0/DeviceList/0/$ns3::PointToPointNetDevice/TxQueue/Dequeue ns3::PppHeader (Point-to-Point Protocol: IP (0x0021)) ns3::Ipv4Header (tos 0x0 ttl 64 id 0 protocol 17 offset 0 flags [none] length: 1052 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 1032 49153 > 9) Payload (size=1024) …

ASCII Tracing Trace file format 00 + 01 2 02 /NodeList/0/DeviceList/0/$ns3::PointToPointNetDevice/TxQueue/Enqueue 03 ns3::PppHeader ( 04 Point-to-Point Protocol: IP (0x0021)) 05 ns3::Ipv4Header ( 06 tos 0x0 ttl 64 id 0 protocol 17 offset 0 flags [none] 07 length: 1052 10.1.1.1 > 10.1.1.2) 08 ns3::UdpHeader ( 09 length: 1032 49153 > 9) 10 Payload (size=1024)

PCAP Tracing PCAP Tracing .pcap file format Traffic trace analyze pointToPoint.EnablePcapAll (“myfirst”); Reading output with tcpdump $ tcpdump -nn -tt -r myfirst-0-0.pcap reading from file myfirst-0-0.pcap, link-type PPP (PPP) 2.000000 IP 10.1.1.1.49153 > 10.1.1.2.9: UDP, length 1024 2.514648 IP 10.1.1.2.9 > 10.1.1.1.49153: UDP, length 1024 $ tcpdump -nn -tt -r myfirst-1-0.pcap reading from file myfirst-1-0.pcap, link-type PPP (PPP) 2.257324 IP 10.1.1.1.49153 > 10.1.1.2.9: UDP, length 1024 2.257324 IP 10.1.1.2.9 > 10.1.1.1.49153: UDP, length 1024

PCAP Tracing Reading output with Wireshark http://www.wireshark.org/download.html

Tracing system Simple tracing system Use trace source and trace sink ASCII tracing PCAP tracing Used to generate output for checking the operation and measure the system performance Use trace source and trace sink Study the advanced tracing system in Session 5

NetAnim Newest version 3.105 An offline animator based on the Qt 4 toolkit. It animates the simulation using an XML trace file collected during simulation.

NetAnim How to build Summary of features http://www.nsnam.org/wiki/NetAnim_3.105 Summary of features Animate packets over wired-links and wireless-links Limited support for LTE traces. No support for IPv6 Packet timeline on packet meta-data. Node position statistics with node trajectory plotting Path of a mobile node Print brief packet-meta data on packets Use custom icons for nodes Parse flow-monitor XML files and display statistics for each flow Show IP and MAC information Including peer IP and MAC for point-to-point links. Step through a simulation one event at a time and pause the simulation at a given time Print the routing table

NetAnim Update the name of the node Update the size of the node AnimationInterface::UpdateNodeDescription (uint32_t nodeId, string name); Update the size of the node AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height) Update the color of the node AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b) Update the image of the node AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId).

NetAnim Example (src/netanim/examples/wireless-animation.cc) // include netanim header - mandatory #include “ns3/netanim-module.h” // xml generation - mandatory AnimationInterface anim (“wireless-animation.xml”); // for stationary nodes anim.SetConstantPosition(n,100,200); // ‘n’ is a node pointer

NetAnim Example (src/netanim/examples/wireless-animation.cc) for (uint32_t i = 0; i < wifiStaNodes.GetN (); ++i) { anim.UpdateNodeDescription (wifiStaNodes.Get (i), "STA"); // Optional anim.UpdateNodeColor (wifiStaNodes.Get (i), 255, 0, 0); // Optional } for (uint32_t i = 0; i < wifiApNode.GetN (); ++i) anim.UpdateNodeDescription (wifiApNode.Get (i), "AP"); // Optional anim.UpdateNodeColor (wifiApNode.Get (i), 0, 255, 0); // Optional for (uint32_t i = 0; i < csmaNodes.GetN (); ++i) anim.UpdateNodeDescription (csmaNodes.Get (i), "CSMA"); // Optional anim.UpdateNodeColor (csmaNodes.Get (i), 0, 0, 255); // Optional anim.EnablePacketMetadata (); // Optional

NetAnim Start the animation

NetAnim Control the speed Simulation time Pause the animation

To show node trajectory Activated when double click a node NetAnim To show node trajectory Activated when double click a node Node trajectory

“Packets” tab for packet timeline NetAnim Packet timeline “Packets” tab for packet timeline

Application

Applications in NS-3 An Application generates packets Applications are associated with individual nodes Class ns3::Application can be used as a base class for ns3 applications Various application modules are provided by ns3 Application helper Can make it easy to install application to node With “Install” method

* CBR: constant bit rate Applications in NS-3 UdpEcho: A client sends packets to a server and the server returns packets OnOffApplication: During the “On” state, CBR traffic generated UdpClientServer: A UDP client and server BulkSendApplication: Send data up to MaxBytes or until the application is stopped (if MaxBytes is zero) PacketSink: Receive and consume packets V4Ping: Send one ICMP ECHO request, waits for a REPLY, and calculate RTT Ping6: Send ping with IPv6 address Radvd: Router advertisement daemon * CBR: constant bit rate

Application void Application::SetStartTime(Time time); Specifies when the application should be started The application subclasses should override the private StartApplication method, which is called at the time specified, to cause the application to begin void ApplicationContainer::Start(Time start); Call Application::SetStartTime method for all of applications in the application container

Applications in NS-3 void Application::SetStopTime(Time time); Specifies when an application is to stop The application subclasses should override the private StopApplication method, to be notified when that time has come void ApplicationContainer::Stop(Time stop); Call Application::SetStopTime method for all of applications in the application container

Applications in NS-3 virtual void Application::StartApplication(void); The StartApplication method is called at the start time specified by SetStartTime This method should be overridden by all or most application subclasses virtual void Application::StopApplication(void); The StopApplication method is called at the stop time specified by SetStopTime

UdpEcho server/client the port the server will wait on for incoming packets UdpEchoServerHelper UdpEchoServerHelper::UdpEchoServerHelper (uint16_t port2 ) ApplicationContainer UdpEchoServerHelper::Install (Ptr<Node> echoserver) UdpEchoClientHelper UdpEchoClientHelper::UdpEchoClientHelper (Address IP2, uint16_t port2) void UdpEchoClientHelper::Setattribute ( name, value ) ApplicationContainer UdpEchoClientHelper::Install (Ptr<Node> echoclient ) - Ptr<Node> node - std:string nodeName - NodeContainer c IP address and port number of the remote udp echo server

UdpEcho server/client Example UdpEchoServerHelper echoServer (9); ApplicationContainer serverApps = echoServer.Install (nodes.Get (1)); UdpEchoClientHelper echoClient (interfaces.GetAddress (1), 9); echoClient.SetAttribute ("MaxPackets", UintegerValue (1)); echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.))); echoClient.SetAttribute ("PacketSize", UintegerValue (1024)); ApplicationContainer clientApps = echoClient.Install (nodes.Get (0)); serverApps.Start (Seconds (1.0)); serverApps.Stop (Seconds (10.0)); clientApps.Start (Seconds (2.0)); clientApps.Stop (Seconds (10.0));

OnOffApplication Class ns::OnOffApplication Example Generate traffic to a single destination according to an OnOff pattern After Application::StartApplication is called, “On” and “Off” states alternate onTime and offTime variables  duration of each state “Off” state: no traffic is generated, “On” state: CBR traffic is generated The attributes, data rate and packet size, characterize CBR traffic Example Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (137)); onoff.SetAttribute (“DataRate”, StringValue (“14kb/s”));

Attributes for OnOffApplication DataRate: The data rate in on state. Set with class: DataRateValue Underlying type: DataRate Initial value: 500000bps PacketSize: The size of packets sent in on state Set with class: ns3::UintegerValue Underlying type: uint32_t 1:4294967295 Initial value: 512 OnTime: A RandomVariable used to pick the duration of the 'On' state. Set with class: RandomVariableValue Underlying type: RandomVariable Initial value: Constant:1 OffTime: A RandomVariable used to pick the duration of the 'Off' state.

UdpClientServer A UDP client sends UDP packets and a UDP server receives UDP packets Classes PacketLossCounter: count the number of lost packets SeqTsHeader: Packet header for UDP client/server application sequence number, time stamp UdpClient/UdpServer: A UDP client/server UdpClientHelper/UdpServerHelper Create a client/server application UdpTraceClient UdpTraceClientHelper

Attributes for UdpClient MaxPackets: The maximum number of packets the application will send Set with class: ns3::UintegerValue Underlying type: uint32_t 0:4294967295 Initial value: 100 Interval: The time to wait between packets Set with class: ns3::TimeValue Underlying type: Time –9223372036854775808.0ns:+9223372036854775807.0ns Initial value: +1000000000.0ns RemoteAddress: The destination Address of the outbound packets Set with class: AddressValue Underlying type: Address Initial value: 00-00-00 RemotePort: The destination port of the outbound packets Underlying type: uint16_t 0:65535 PacketSize: Size of packets generated. The minimum packet size is 12 bytes which is the size of the header carrying the sequence number and the time stamp. Underlying type: uint32_t 12:1500 Initial value: 1024

Attributes for UdpServer Port: Port on which we listen for incoming packets. Set with class: ns3::UintegerValue Underlying type: uint16_t 0:65535 Initial value: 100 PacketWindowSize: The size of the window used to compute the packet loss. This value should be a multiple of 8. Underlying type: uint16_t 8:256 Initial value: 32 Private Attributes PacketLossCounter m_lossCounter Lost packet counter uint16_t m_port Port on which we listen for incoming packets. uint32_t m_received Number of received packets.

Simulation Example

Simulation Example UDP packet transmission OnOff application Point-to-point link

UdpEcho Application Example (1) #include "ns3/core-module.h“ #include "ns3/network-module.h“ #include "ns3/internet-module.h“ #include "ns3/point-to-point-module.h“ #include "ns3/applications-module.h“ using namespace ns3; NS_LOG_COMPONENT_DEFINE (“OnOffExample"); int main (int argc, char *argv[]) { bool verbose = true; CommandLine cmd; cmd.AddValue ("verbose", "Tell echo applications to log if true", verbose); cmd.Parse (argc,argv); To determine whether the logging components are enabled or not command line argument for variable “verbose”

UdpEcho Application Example (2) if (verbose) { LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO); LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO); } NodeContainer p2pNodes; // create the nodecontainer, “p2pNodes” p2pNodes.Create (2); // If verbose = 1, log components are enable Create a node container and 2 nodes for p2p link

UdpEcho Application Example (3) PointToPointHelper pointToPoint; pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps")); pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms")); NetDeviceContainer p2pDevices; p2pDevices = pointToPoint.Install (p2pNodes); InternetStackHelper stack; stack.Install (p2pNodes.Get (0)); stack.Install (p2pNodes.Get (1)); p2p link generation and install on the p2p nodes Install Internet stack on the nodes

UdpEcho Application Example (4) Allocate IP address Ipv4AddressHelper address; address.SetBase ("10.1.1.0", "255.255.255.0"); Ipv4InterfaceContainer p2pInterfaces; p2pInterfaces = address.Assign (p2pDevices); UdpEchoServerHelper echoServer (9); ApplicationContainer serverApps = echoServer.Install (p2pNodes.Get (1)); serverApps.Start (Seconds (1.0)); serverApps.Stop (Seconds (10.0)); UdpEchoClientHelper echoClient (p2pInterfaces.GetAddress (1), 9); echoClient.SetAttribute ("MaxPackets", UintegerValue (100)); echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.))); echoClient.SetAttribute ("PacketSize", UintegerValue (1024)); Setup echoServer and Install it on node1 Setup echoClient Attributes of echoClient

UdpEcho Application Example (5) ApplicationContainer clientApps = echoClient.Install (p2pNodes.Get (0)); clientApps.Start (Seconds (2.0)); clientApps.Stop (Seconds (10.0)); Ipv4GlobalRoutingHelper::PopulateRoutingTables (); pointToPoint.EnablePcapAll ("second"); Simulator::Run (); Simulator::Destroy (); return 0; } Install echoClient on node0 enable pcap tracing

OnOff Application Example (1) #include <iostream> #include <fstream> #include "ns3/point-to-point-module.h" #include "ns3/core-module.h" #include "ns3/network-module.h" #include "ns3/applications-module.h" #include "ns3/internet-module.h" using namespace ns3; int main (int argc, char *argv[]) { CommandLine cmd; cmd.Parse (argc, argv);

OnOff Application Example (2) NodeContainer terminals; terminals.Create (2); PointToPointHelper pointToPoint; pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps")); pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms")); NetDeviceContainer p2pDevices; p2pDevices = pointToPoint.Install (terminals); Create a node container and 2 nodes for p2p link Create a netdevice container and p2p link

OnOff Application Example (3) InternetStackHelper internet; internet.Install (terminals.Get (0)); internet.Install (terminals.Get (1)); Ipv4AddressHelper ipv4; ipv4.SetBase ("10.1.1.0", "255.255.255.0"); ipv4.Assign (p2pDevices); Install Internet stack on the nodes Allocate IP address

OnOff Application Example (4) uint16_t port = 9; OnOffHelper onoff ("ns3::UdpSocketFactory", Address (InetSocketAddress (Ipv4Address ("10.1.1.2"), port))); onoff.SetAttribute ("OnTime", StringValue(“ns3::ConstantRandomVariable[Constant=1.0]”)); onoff.SetAttribute ("OffTime", StringValue(“ns3::ConstantRandomVariable[Constant=1.0]”)); onoff.SetAttribute ("DataRate", DataRateValue(5000000)); ApplicationContainer app = onoff.Install (terminals.Get (0)); app.Start (Seconds (1.0)); app.Stop (Seconds (10.0)); Setup OnOff application Install OnOff application sender on a node

OnOff Application Example (5) PacketSinkHelper sink ("ns3::UdpSocketFactory", Address (InetSocketAddress (Ipv4Address::GetAny (), port))); app = sink.Install (terminals.Get (1)); app.Start (Seconds (1.0)); Simulator::Stop(Seconds (15)); Simulator::Run (); Simulator::Destroy (); } Create a packet sink to receive packets and install it on a node Running simulator

Exercise

Exercise UDP Udpclientserver application p2p link: DataRate 5 Mbps, Delay 10 us Application & flow Udpclientserver Application UDP flow: node0  node1, UDP 5 Mbps, 1 – 10s

Exercise 2. (Optional) use NetAnim Check and verify all the output system of onoff application example print out all of the logging into .out file use AsciiTraceHelper use PCAP trace and … Check .pcap file both TCPDUMP and Wireshark 2. (Optional) use NetAnim

References Network Simulator NS-3 tutorial NS-3 manual http://www.nsnam.org NS-3 tutorial http://www.nsnam.org/docs/release/3.22/tutorial/singlehtml/index.html NS-3 manual http://www.nsnam.org/docs/release/3.22/manual/singlehtml/index.html

Thank You !